Authenticate API requests

Authenticate a trusted client with an API key, then verify that it can access the intended project.

Steps

  1. Create an API key in Studio for the client.
  2. Store it in a secret manager or local environment file excluded from source control.
  3. Send it as Authorization: Bearer <API_KEY> on each request.
  4. Confirm access with a read request before using operations that change resources.

Keep API keys server-side. A browser client should call a backend that holds the key.

Try it with REST

GET /projects

bash
export VERYFRONT_API_KEY="<API_KEY>"

curl --silent --show-error --fail-with-body \
  https://api.veryfront.com/projects \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"

Verify

For the REST example, inspect the projects in data. Confirm the intended project is present. A successful request to a different project doesn't prove the access you need.

For a 401, check the key value, its validity, and the header format. For a denied or unavailable project resource, check the project reference and access associated with the credential.

Use the error body to distinguish authentication from request validation or resource errors. Don't log the key while diagnosing a request.

Next

API reference

SurfaceVerification request
RESTList projects checks accessible project context.
GraphQLCurrent User checks the authenticated identity.
MCPGet Current User checks the assistant's authenticated identity.