Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

API works in browser but throws 403 on Postman

default discord avatar
kaspartr6 months ago
1

I'm attempting to use the REST API outside of the browser but there are many questions.


1. How do you use the User's API-KEY in the authorization header? There is no documentation on that.


2. Every request from Postman returns 403: Forbidden even through the same request work in the browser there the same user is logged in. It doesn't even seem to reach API key authentication and is immediate.



I there proper documentation on how to actually use the API which seems to be an important feature of PayloadCMS?



I would like to use the User API key shown in the admin dashboard.



I tried this but also have 403 immediately.



I see, yes that works finally.

  • default discord avatar
    minsomai9 months ago
     headers: {
          Authorization: `JWT ${token}`,
        }
      });

    @567578449439621124



    replace token with the one your received from login endpoint.





    for those API keys, header value is different



    const response = await fetch('http://localhost:3000/api/pages', {
      headers: {
        Authorization: `users API-Key ${YOUR_API_KEY}`,
      },
    })


    https://payloadcms.com/docs/authentication/config
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.