API clients

Programs that call the API with credentials of their own, such as Terraform, CI, connectors and agents. Each gets access tokens from its organization's token endpoint with the client credentials grant, limited to its scopes.

The API client model

An API client: a program that calls the API with credentials of its own, such as Terraform, CI, a connector or an agent. It gets access tokens from its organization's token endpoint with the OAuth 2.0 client credentials grant (RFC 6749 §4.4), and every token carries at most the client's scopes. The secret is shown once, when the client is created or its secret is rotated.

Properties

  • Name
    id
    Type
    string
    Description

    API client ID. It is also the OAuth client_id.

  • Name
    etag
    Type
    string
    Description

    Current version.

  • Name
    name
    Type
    string
    Description

    Display name, unique within the organization.

  • Name
    description
    Type
    string
    Description

    Free text.

  • Name
    scopes
    Type
    array of strings
    Description

    The scopes the client's access tokens may carry, from the oauth2 security scheme.

  • Name
    workload_audiences
    Type
    array of strings
    Description

    The audiences this may ask for workload tokens for: short-lived JWTs that other platforms trust, such as sts.amazonaws.com. Exact strings; empty means none.

  • Name
    federated_credentials
    Type
    array of objects
    Description

    Outside identities this trusts instead of a secret (see docs/federated-credentials.md).

  • Name
    federated_credentials[].name
    Type
    string
    Description

    A name for it, unique on the API client or agent, such as github-main.

  • Name
    federated_credentials[].issuer
    Type
    string
    Description

    The platform's issuer, exactly as its tokens' iss: an https URL that serves /.well-known/openid-configuration.

  • Name
    federated_credentials[].subject
    Type
    string
    Description

    The sub a token must have, exactly. Set this or subject_pattern. Can be null.

  • Name
    federated_credentials[].subject_pattern
    Type
    string
    Description

    A pattern the sub must match instead, where * stands for any run of characters. It must start with a literal part, so repo:acme/infra:* is allowed and *:ref:refs/heads/main is not. Can be null.

  • Name
    federated_credentials[].audience
    Type
    string
    Description

    The aud a token must carry: what the workload asks its platform for, such as the organization's issuer URL.

  • Name
    federated_credentials[].claims
    Type
    object
    Description

    Other claims a token must carry with exactly these values, such as GitHub's repository_owner or environment.

  • Name
    labels
    Type
    object
    Description

    Labels.

  • Name
    managed_by
    Type
    string
    Description

    The tool that manages this resource, such as terraform. Can be null.

  • Name
    created_at
    Type
    timestamp
    Description

    When the client was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    When the client last changed.


GET/v1/api-clients

List api clients

Needs the api-clients:read scope.

Query parameters

  • Name
    page_size
    Type
    integer
    Description

    Results per page, 1 to 200. 0 or absent means 50; more than 200 means 200 (AIP-158).

  • Name
    page_token
    Type
    string
    Description

    next_page_token from the previous page.

  • Name
    updated_since
    Type
    timestamp
    Description

    Only resources changed at or after this time.

  • Name
    name
    Type
    string
    Description

    Only the client with this exact name.

Request

GET
/v1/api-clients
curl https://acme.ext.passway.com/v1/api-clients \
  -H "Authorization: Bearer $PASSWAY_TOKEN"

Response

{
  "data": [
    {
      "id": "apc_01jd8k3m2v9x4q7r5t6w8y0z1a",
      "etag": "3f9a",
      "name": "terraform-ci",
      "description": "…",
      "scopes": [
        "…"
      ],
      "workload_audiences": [
        "…"
      ],
      "federated_credentials": [
        {}
      ],
      "labels": {
        "passway.example/cost-center": "4410",
        "team": "facilities"
      },
      "managed_by": "terraform",
      "created_at": "2026-11-30T14:02:11Z",
      "updated_at": "2026-11-30T14:02:11Z"
    }
  ],
  "next_page_token": null
}

POST/v1/api-clients

Create an api client

Returns the client secret, which is never shown again. A caller can give only scopes it has itself.

Needs the api-clients:write scope.

Headers

  • Name
    Idempotency-Key
    Type
    string
    Description

    A unique key, such as a UUID. Repeating a successful request with the same key within 24 hours returns the original response; reusing it for a different request returns 422; repeating it while the first is still running returns 409 with Retry-After.

Required attributes

  • Name
    name
    Type
    string
    Description

    Display name, unique within the organization.

  • Name
    scopes
    Type
    array of strings
    Description

    The scopes the client's access tokens may carry, from the oauth2 security scheme. A caller can give only scopes it has itself.

Optional attributes

  • Name
    description
    Type
    string
    Description

    Free text.

  • Name
    workload_audiences
    Type
    array of strings
    Description

    The audiences this may ask for workload tokens for (see POST /oauth/token with audience): at most 10 exact strings.

  • Name
    federated_credentials
    Type
    array of objects
    Description

    Outside identities this trusts instead of a secret: tokens another platform issues to a workload, such as a GitHub Actions job.

  • Name
    federated_credentials[].name
    Type
    string
    Description

    A name for it, unique on the API client or agent, such as github-main.

  • Name
    federated_credentials[].issuer
    Type
    string
    Description

    The platform's issuer, exactly as its tokens' iss: an https URL that serves /.well-known/openid-configuration.

  • Name
    federated_credentials[].subject
    Type
    string
    Description

    The sub a token must have, exactly. Set this or subject_pattern. Can be null.

  • Name
    federated_credentials[].subject_pattern
    Type
    string
    Description

    A pattern the sub must match instead, where * stands for any run of characters. It must start with a literal part, so repo:acme/infra:* is allowed and *:ref:refs/heads/main is not. Can be null.

  • Name
    federated_credentials[].audience
    Type
    string
    Description

    The aud a token must carry: what the workload asks its platform for, such as the organization's issuer URL.

  • Name
    federated_credentials[].claims
    Type
    object
    Description

    Other claims a token must carry with exactly these values, such as GitHub's repository_owner or environment.

  • Name
    labels
    Type
    object
    Description

    Labels.

  • Name
    managed_by
    Type
    string
    Description

    The tool that manages this resource. Terraform sets terraform.

Request

POST
/v1/api-clients
curl -X POST https://acme.ext.passway.com/v1/api-clients \
  -H "Authorization: Bearer $PASSWAY_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "terraform-ci",
    "scopes": [
      "…"
    ],
    "labels": {
      "passway.example/cost-center": "4410",
      "team": "facilities"
    },
    "managed_by": "terraform"
  }'

Response

{
  "api_client": {
    "id": "apc_01jd8k3m2v9x4q7r5t6w8y0z1a",
    "etag": "3f9a",
    "name": "terraform-ci",
    "description": "…",
    "scopes": [
      "…"
    ],
    "workload_audiences": [
      "…"
    ],
    "federated_credentials": [
      {
        "name": "github-main",
        "issuer": "https://token.actions.githubusercontent.com",
        "subject": "repo:acme/infra:ref:refs/heads/main",
        "subject_pattern": "repo:acme/infra:environment:*",
        "audience": "https://acme.ext.passway.com",
        "claims": {}
      }
    ],
    "labels": {
      "passway.example/cost-center": "4410",
      "team": "facilities"
    },
    "managed_by": "terraform",
    "created_at": "2026-11-30T14:02:11Z",
    "updated_at": "2026-11-30T14:02:11Z"
  },
  "client_secret": "pwcs_7Hq2kX9vN4mP8sL3wQ5rT1yU6iO0pA2s"
}

GET/v1/api-clients/{api_client_id}

Get an api client

Needs the api-clients:read scope.

Path parameters

  • Name
    api_client_id
    Type
    string
    Description

    API client ID: apc_ followed by 1 to 64 lowercase letters and digits.

Request

GET
/v1/api-clients/{api_client_id}
curl https://acme.ext.passway.com/v1/api-clients/apc_01jd8k3m2v9x4q7r5t6w8y0z1a \
  -H "Authorization: Bearer $PASSWAY_TOKEN"

Response

{
  "id": "apc_01jd8k3m2v9x4q7r5t6w8y0z1a",
  "etag": "3f9a",
  "name": "terraform-ci",
  "description": "…",
  "scopes": [
    "…"
  ],
  "workload_audiences": [
    "…"
  ],
  "federated_credentials": [
    {
      "name": "github-main",
      "issuer": "https://token.actions.githubusercontent.com",
      "subject": "repo:acme/infra:ref:refs/heads/main",
      "subject_pattern": "repo:acme/infra:environment:*",
      "audience": "https://acme.ext.passway.com",
      "claims": {}
    }
  ],
  "labels": {
    "passway.example/cost-center": "4410",
    "team": "facilities"
  },
  "managed_by": "terraform",
  "created_at": "2026-11-30T14:02:11Z",
  "updated_at": "2026-11-30T14:02:11Z"
}

PATCH/v1/api-clients/{api_client_id}

Update an api client

A JSON merge patch (RFC 7396): fields in the body replace the current ones, null removes a field where the schema allows null, and objects such as labels are merged. Requires If-Match with the current etag.

Needs the api-clients:write scope.

Path parameters

  • Name
    api_client_id
    Type
    string
    Description

    API client ID: apc_ followed by 1 to 64 lowercase letters and digits.

Headers

  • Name
    If-Match
    Type
    string
    Description

    The resource's current etag, in double quotes. Required.

Optional attributes

  • Name
    name
    Type
    string
    Description

    New name.

  • Name
    description
    Type
    string
    Description

    New description.

  • Name
    scopes
    Type
    array of strings
    Description

    New scopes, replacing the current ones.

  • Name
    workload_audiences
    Type
    array of strings
    Description

    New workload audiences, replacing the current ones.

  • Name
    federated_credentials
    Type
    array of objects
    Description

    New federated credentials, replacing the current ones.

  • Name
    federated_credentials[].name
    Type
    string
    Description

    A name for it, unique on the API client or agent, such as github-main.

  • Name
    federated_credentials[].issuer
    Type
    string
    Description

    The platform's issuer, exactly as its tokens' iss: an https URL that serves /.well-known/openid-configuration.

  • Name
    federated_credentials[].subject
    Type
    string
    Description

    The sub a token must have, exactly. Set this or subject_pattern. Can be null.

  • Name
    federated_credentials[].subject_pattern
    Type
    string
    Description

    A pattern the sub must match instead, where * stands for any run of characters. It must start with a literal part, so repo:acme/infra:* is allowed and *:ref:refs/heads/main is not. Can be null.

  • Name
    federated_credentials[].audience
    Type
    string
    Description

    The aud a token must carry: what the workload asks its platform for, such as the organization's issuer URL.

  • Name
    federated_credentials[].claims
    Type
    object
    Description

    Other claims a token must carry with exactly these values, such as GitHub's repository_owner or environment.

  • Name
    labels
    Type
    object
    Description

    Labels to set or remove, or null to remove every label. Can be null.

  • Name
    managed_by
    Type
    string
    Description

    New managing tool, or null to clear it. Can be null.

Request

PATCH
/v1/api-clients/{api_client_id}
curl -X PATCH https://acme.ext.passway.com/v1/api-clients/apc_01jd8k3m2v9x4q7r5t6w8y0z1a \
  -H "Authorization: Bearer $PASSWAY_TOKEN" \
  -H 'If-Match: "3f9a"' \
  -H "Content-Type: application/merge-patch+json" \
  -d '{
    "labels": {
      "old-label": null,
      "team": "security"
    }
  }'

Response

{
  "id": "apc_01jd8k3m2v9x4q7r5t6w8y0z1a",
  "etag": "3f9a",
  "name": "terraform-ci",
  "description": "…",
  "scopes": [
    "…"
  ],
  "workload_audiences": [
    "…"
  ],
  "federated_credentials": [
    {
      "name": "github-main",
      "issuer": "https://token.actions.githubusercontent.com",
      "subject": "repo:acme/infra:ref:refs/heads/main",
      "subject_pattern": "repo:acme/infra:environment:*",
      "audience": "https://acme.ext.passway.com",
      "claims": {}
    }
  ],
  "labels": {
    "passway.example/cost-center": "4410",
    "team": "facilities"
  },
  "managed_by": "terraform",
  "created_at": "2026-11-30T14:02:11Z",
  "updated_at": "2026-11-30T14:02:11Z"
}

DELETE/v1/api-clients/{api_client_id}

Delete an api client

Revokes the client's access tokens. A caller can delete only clients whose scopes it has.

Needs the api-clients:write scope.

Path parameters

  • Name
    api_client_id
    Type
    string
    Description

    API client ID: apc_ followed by 1 to 64 lowercase letters and digits.

Headers

  • Name
    If-Match
    Type
    string
    Description

    The resource's current etag, in double quotes. Required.

Request

DELETE
/v1/api-clients/{api_client_id}
curl -X DELETE https://acme.ext.passway.com/v1/api-clients/apc_01jd8k3m2v9x4q7r5t6w8y0z1a \
  -H "Authorization: Bearer $PASSWAY_TOKEN" \
  -H 'If-Match: "3f9a"'

Response

204 Deleted

POST/v1/api-clients/{api_client_id}:rotate-secret

Rotate an API client's secret

Returns a new secret, which replaces the old one at once and revokes the client's access tokens. A caller can rotate only clients whose scopes it has.

Needs the api-clients:write scope.

Path parameters

  • Name
    api_client_id
    Type
    string
    Description

    API client ID: apc_ followed by 1 to 64 lowercase letters and digits.

Headers

  • Name
    If-Match
    Type
    string
    Description

    If set, the action only runs if the resource's etag still matches.

  • Name
    Idempotency-Key
    Type
    string
    Description

    A unique key, such as a UUID. Repeating a successful request with the same key within 24 hours returns the original response; reusing it for a different request returns 422; repeating it while the first is still running returns 409 with Retry-After.

Request

POST
/v1/api-clients/{api_client_id}:rotate-secret
curl -X POST https://acme.ext.passway.com/v1/api-clients/apc_01jd8k3m2v9x4q7r5t6w8y0z1a:rotate-secret \
  -H "Authorization: Bearer $PASSWAY_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"

Response

{
  "api_client": {
    "id": "apc_01jd8k3m2v9x4q7r5t6w8y0z1a",
    "etag": "3f9a",
    "name": "terraform-ci",
    "description": "…",
    "scopes": [
      "…"
    ],
    "workload_audiences": [
      "…"
    ],
    "federated_credentials": [
      {
        "name": "github-main",
        "issuer": "https://token.actions.githubusercontent.com",
        "subject": "repo:acme/infra:ref:refs/heads/main",
        "subject_pattern": "repo:acme/infra:environment:*",
        "audience": "https://acme.ext.passway.com",
        "claims": {}
      }
    ],
    "labels": {
      "passway.example/cost-center": "4410",
      "team": "facilities"
    },
    "managed_by": "terraform",
    "created_at": "2026-11-30T14:02:11Z",
    "updated_at": "2026-11-30T14:02:11Z"
  },
  "client_secret": "pwcs_7Hq2kX9vN4mP8sL3wQ5rT1yU6iO0pA2s"
}