Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

phpguru's avatar

How to consume API with generated token?

I've got Laravel & Spark set up and have been working on my API that I've currently been using only with the logged-in user's session. What do I need to do, say, from a remote site or using Postman, to use the API with my user's generated token?

Specifically what I'm after is, what do I put in Postman? An X-Authenticated header? Where do I put and what do I call my API Key and Secret from the Laravel Spark settings page, to avoid refreshing my browser every minute to get a new valid web token?

0 likes
1 reply
jurjen's avatar

In your app go to http://your.app/settings#/api and generate an API token. Then make the same API requests as you would in your app but append ?api_token=YOUR_API_TOKEN to the URL's.

Please or to participate in this conversation.