Make a call to the Passport API

The Passport API lets you manage namespaces, resource groups, secret references, and endpoints programmatically. This tutorial shows you how to make your first call to it using curl.

For details on every available endpoint, see the API reference.

Get an API key

Before you can call the Passport API, you’ll need an API key. To learn more, see Create an API key.

Make an API call

Include your API key in the Authorization header of every request as a bearer token. Passport validates it against your organization’s WorkOS account, and a valid key has admin-equivalent access to every namespace, resource group, secret reference, and endpoint in your organization, including the secrets mapped to them.

For your first call, use the Get a namespace endpoint. This requires an existing namespace, so make sure you’ve created one first.

  1. Send a request without the Authorization header to see how the Passport API responds when a request isn’t authenticated:

    curl https://api.usepassport.ai/public/v1/namespaces/<namespaceId>

    The Passport API returns an HTTP 401 Unauthorized response.

  2. Send the same request with your API key:

    curl https://api.usepassport.ai/public/v1/namespaces/<namespaceId> \
    -H "Authorization: Bearer sk_..."

    The Passport API returns a successful response with the namespace’s details in the response body:

    {
    "data": {
    "id": "3f7c2b6e-1c2d-4a5b-9e8f-0a1b2c3d4e5f",
    "name": "Production APIs",
    "description": "Production namespace for customer-facing services"
    }
    }

Every successful Passport API response follows this data envelope. List endpoints also include a pagination object. Error responses use an error envelope with code and message fields instead.

Rate limiting

Each API key is limited to a fixed number of requests per minute. If you exceed it, the Passport API returns an HTTP 429 Too Many Requests response with a Retry-After header and RateLimit-* headers describing your current limit and how much of it remains.