# CIBA

Standard OAuth entry points: OAuth clients, CIBA backchannel approval (poll) and Rich Authorization Requests of type `provenance_action`.

Related guide: [CIBA authorization server](https://provenanceauth.com/docs/mandate/guides/ciba-authorization-server.md)

## Endpoints

- `POST /v1/oauth/clients`: [Create an OAuth client](#post-v1-oauth-clients)
- `GET /.well-known/openid-configuration`: [Get the OpenID configuration](#get-well-known-openid-configuration)
- `GET /v1/oauth/clients/{id}`: [Get an OAuth client](#get-v1-oauth-clients-id)
- `PATCH /v1/oauth/clients/{id}`: [Update an OAuth client](#patch-v1-oauth-clients-id)
- `GET /v1/oauth/clients`: [List OAuth clients](#get-v1-oauth-clients)
- `DELETE /v1/oauth/clients/{id}`: [Delete an OAuth client](#delete-v1-oauth-clients-id)
- `POST /v1/oauth/bc_authorize`: [Ask a person to approve (CIBA)](#post-v1-oauth-bc-authorize)
- `POST /v1/oauth/clients/{id}/rotate_secret`: [Rotate an OAuth client's secret](#post-v1-oauth-clients-id-rotate-secret)

## The oauth client object

### Attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | no | The client id (`occ_…`), used as `client_id`, `iss` and `sub` in its assertions. |
| `object` | enum | no | The type of object. One of `oauth_client`. |
| `name` | string | no | The name people see on the approval page ("Acme Payables"). |
| `auth_method` | enum | no | How the client authenticates. `private_key_jwt` is preferred. One of `private_key_jwt`, `client_secret_basic`. |
| `jwks_uri` | string \| null | no | `private_key_jwt`: an https URL serving the client's public keys (cached 5 minutes). |
| `jwks` | object \| null | no | `private_key_jwt`: the client's public keys inline (`{ keys: [...] }`, EC P-256 or OKP Ed25519). |
| `allowed_scopes` | array of strings | no | The scopes the client may ask for. Always includes `openid`. |
| `allowed_details_types` | array of enums | no | The `authorization_details` types the client may send. |
| `delivery_modes` | array of enums | no | How the client learns of a decision. |
| `notification_endpoint` | string \| null | no | Ping: the registered `backchannel_client_notification_endpoint` (https). |
| `status` | enum | no | A disabled client can't authenticate. One of `active`, `disabled`. |
| `environment` | string | no | The environment the client belongs to (`sandbox` or `live`). |
| `created_at` | timestamp | no | When it was created. |
| `updated_at` | timestamp | no | When it last changed. |
| `last_used_at` | timestamp \| null | no | When it last authenticated (to the minute); null before its first request. |
| `client_secret` | string | no | `client_secret_basic`: the secret, returned once at create and rotate. |
| `deleted` | boolean | no | Always true for a deleted object. |

### Example

```json
{
  "id": "occ_01M6VQDEB8RNTXAP66V3F2YKG8",
  "object": "oauth_client",
  "name": "Acme Payables",
  "auth_method": "private_key_jwt",
  "jwks_uri": null,
  "jwks": {
    "keys": [
      {
        "kty": "EC",
        "crv": "P-256",
        "x": "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
        "y": "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0",
        "kid": "acme-2026-11",
        "alg": "ES256"
      }
    ]
  },
  "allowed_scopes": [
    "openid"
  ],
  "allowed_details_types": [
    "provenance_action"
  ],
  "delivery_modes": [
    "poll"
  ],
  "notification_endpoint": null,
  "status": "active",
  "environment": "sandbox",
  "created_at": "2026-11-07T19:22:53.672Z",
  "updated_at": "2026-11-07T19:22:53.672Z",
  "last_used_at": null
}
```

## Create an OAuth client

`POST /v1/oauth/clients`

Creates a confidential client for the CIBA endpoints. `private_key_jwt` takes a JWKS URL or inline public keys (ES256 or EdDSA); `client_secret_basic` returns its secret once. Pro, Growth and Enterprise; one client on the Free plan. A live-mode developer's change waits for an owner or admin.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `name` | body | string | yes | The name people see on the approval page (1 to 80 characters). |
| `auth_method` | body | enum | no | How the client authenticates. One of `private_key_jwt`, `client_secret_basic`. |
| `jwks_uri` | body | string | no | `private_key_jwt`: an https URL serving the client's public keys. |
| `jwks` | body | object | no | `private_key_jwt`: the public keys inline (`{ keys: [...] }`, 1 to 10). |
| `allowed_scopes` | body | array of strings | no | The scopes the client may ask for; must include `openid`. |
| `allowed_details_types` | body | array of enums | no | The `authorization_details` types it may send. |
| `delivery_modes` | body | array of enums | no | How the client learns of a decision. |
| `notification_endpoint` | body | string | no | Ping: the backchannel_client_notification_endpoint (https). |

### Returns

The client. A `client_secret_basic` client's `client_secret` is shown only here. See [the oauth client object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`oauth_client_jwks_invalid`](https://provenanceauth.com/docs/platform/errors.md#oauth_client_jwks_invalid)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/oauth/clients" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Payables",
    "auth_method": "private_key_jwt",
    "jwks": {
      "keys": [
        {
          "kty": "EC",
          "crv": "P-256",
          "x": "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
          "y": "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0",
          "kid": "acme-2026-11",
          "alg": "ES256"
        }
      ]
    }
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "Acme Payables",
    "auth_method": "private_key_jwt",
    "jwks": {
      "keys": [
        {
          "kty": "EC",
          "crv": "P-256",
          "x": "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
          "y": "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0",
          "kid": "acme-2026-11",
          "alg": "ES256"
        }
      ]
    }
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/oauth/clients", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "name": "Acme Payables",
    "auth_method": "private_key_jwt",
    "jwks": {
        "keys": [
            {
                "kty": "EC",
                "crv": "P-256",
                "x": "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
                "y": "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0",
                "kid": "acme-2026-11",
                "alg": "ES256"
            }
        ]
    }
}).json()
```

### Response 201

```json
{
  "id": "occ_01M6VQDEB8RNTXAP66V3F2YKG8",
  "object": "oauth_client",
  "name": "Acme Payables",
  "auth_method": "private_key_jwt",
  "jwks_uri": null,
  "jwks": {
    "keys": [
      {
        "kty": "EC",
        "crv": "P-256",
        "x": "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
        "y": "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0",
        "kid": "acme-2026-11",
        "alg": "ES256"
      }
    ]
  },
  "allowed_scopes": [
    "openid"
  ],
  "allowed_details_types": [
    "provenance_action"
  ],
  "delivery_modes": [
    "poll"
  ],
  "notification_endpoint": null,
  "status": "active",
  "environment": "sandbox",
  "created_at": "2026-11-07T19:22:53.672Z",
  "updated_at": "2026-11-07T19:22:53.672Z",
  "last_used_at": null
}
```

## Get the OpenID configuration

`GET /.well-known/openid-configuration`

OpenID Connect discovery: the CIBA backchannel endpoint and delivery modes, the `authorization_details` types, the client auth methods, the token endpoint and the keys that sign id tokens. The same CIBA fields are in the RFC 8414 metadata.

Auth: none. No API key needed.

### Parameters

No parameters.

### Returns

The configuration.

### Errors

- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
curl "$PROVENANCE_API/.well-known/openid-configuration"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/.well-known/openid-configuration`)).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/.well-known/openid-configuration").json()
```

### Response 200

```json
{
  "issuer": "http://127.0.0.1:50287",
  "token_endpoint": "http://127.0.0.1:50287/v1/oauth/token",
  "jwks_uri": "http://127.0.0.1:50287/.well-known/jwks.json",
  "response_types_supported": [],
  "subject_types_supported": [
    "pairwise"
  ],
  "id_token_signing_alg_values_supported": [
    "ES256"
  ],
  "scopes_supported": [
    "openid"
  ],
  "claims_supported": [
    "iss",
    "sub",
    "aud",
    "… 5 more"
  ],
  "acr_values_supported": [
    "passkey",
    "biometric",
    "session"
  ],
  "backchannel_authentication_endpoint": "http://127.0.0.1:50287/v1/oauth/bc_authorize",
  "backchannel_token_delivery_modes_supported": [
    "poll",
    "ping"
  ],
  "backchannel_user_code_parameter_supported": false,
  "authorization_details_types_supported": [
    "provenance_action"
  ],
  "token_endpoint_auth_methods_supported": [
    "private_key_jwt",
    "client_secret_basic"
  ],
  "token_endpoint_auth_signing_alg_values_supported": [
    "ES256",
    "EdDSA"
  ],
  "grant_types_supported": [
    "urn:openid:params:grant-type:ciba"
  ]
}
```

## Get an OAuth client

`GET /v1/oauth/clients/{id}`

One of the account's OAuth clients, without its secret.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The client. See [the oauth client object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/oauth/clients" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme Payables", "auth_method": "client_secret_basic" }' > step.json
export CLIENT_ID=$(jq -r '.id' step.json)
curl "$PROVENANCE_API/v1/oauth/clients/$CLIENT_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/oauth/clients/$CLIENT_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "Acme Payables", "auth_method": "client_secret_basic" }),
})).json();
const clientId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients/${clientId}`, {
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/oauth/clients", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "name": "Acme Payables",
    "auth_method": "client_secret_basic"
}).json()
client_id = step1["id"]
data = httpx.get(f"{api}/v1/oauth/clients/{client_id}", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

```json
{
  "id": "occ_01M6VQDEB9JXE382XWMNF1HS2F",
  "object": "oauth_client",
  "name": "Acme Payables",
  "auth_method": "client_secret_basic",
  "jwks_uri": null,
  "jwks": null,
  "allowed_scopes": [
    "openid"
  ],
  "allowed_details_types": [
    "provenance_action"
  ],
  "delivery_modes": [
    "poll"
  ],
  "notification_endpoint": null,
  "status": "active",
  "environment": "sandbox",
  "created_at": "2026-11-07T19:22:53.673Z",
  "updated_at": "2026-11-07T19:22:53.673Z",
  "last_used_at": null
}
```

## Update an OAuth client

`PATCH /v1/oauth/clients/{id}`

Changes the client's name, keys, allowed scopes and detail types, delivery modes or status (`disabled` stops it authenticating). The auth method can't change. A live-mode developer's change waits for an owner or admin.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `name` | body | string | no | The name people see on the approval page. |
| `jwks_uri` | body | string \| null | no | `private_key_jwt`: an https URL serving the client's public keys. |
| `jwks` | body | object \| null | no | `private_key_jwt`: the public keys inline. |
| `allowed_scopes` | body | array of strings | no | The scopes the client may ask for; must include `openid`. |
| `allowed_details_types` | body | array of strings | no | The `authorization_details` types it may send. |
| `delivery_modes` | body | array of strings | no | How the client learns of a decision. |
| `notification_endpoint` | body | string \| null | no | Ping: the notification endpoint (https). |
| `status` | body | enum | no | `disabled` stops the client authenticating. One of `active`, `disabled`. |

### Returns

The updated client. See [the oauth client object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`oauth_client_jwks_invalid`](https://provenanceauth.com/docs/platform/errors.md#oauth_client_jwks_invalid)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/oauth/clients" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme Payables", "auth_method": "client_secret_basic" }' > step.json
export CLIENT_ID=$(jq -r '.id' step.json)
curl -X PATCH "$PROVENANCE_API/v1/oauth/clients/$CLIENT_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "disabled" }'
curl -s -X DELETE "$PROVENANCE_API/v1/oauth/clients/$CLIENT_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "Acme Payables", "auth_method": "client_secret_basic" }),
})).json();
const clientId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients/${clientId}`, {
  method: "PATCH",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({ "status": "disabled" }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/oauth/clients", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "name": "Acme Payables",
    "auth_method": "client_secret_basic"
}).json()
client_id = step1["id"]
data = httpx.patch(f"{api}/v1/oauth/clients/{client_id}", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "status": "disabled"
}).json()
```

### Response 200

```json
{
  "id": "occ_01M6VQDECQF8ZAP65CXG1SS0KH",
  "object": "oauth_client",
  "name": "Acme Payables",
  "auth_method": "client_secret_basic",
  "jwks_uri": null,
  "jwks": null,
  "allowed_scopes": [
    "openid"
  ],
  "allowed_details_types": [
    "provenance_action"
  ],
  "delivery_modes": [
    "poll"
  ],
  "notification_endpoint": null,
  "status": "disabled",
  "environment": "sandbox",
  "created_at": "2026-11-07T19:22:53.719Z",
  "updated_at": "2026-11-07T19:22:53.762Z",
  "last_used_at": null
}
```

## List OAuth clients

`GET /v1/oauth/clients`

Lists the account's OAuth clients in this environment, without their secrets.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | no | Page size, 1–100 (default 20). Outside the range → 400 parameter_invalid. |
| `cursor` | query | string | no | Opaque; pass a response's `next_cursor` back to get the next page. |

### Returns

The OAuth clients.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/oauth/clients" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients`, {
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/oauth/clients", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [
    {
      "id": "occ_01M6VQDEB8RNTXAP66V3F2YKG8",
      "object": "oauth_client",
      "name": "Acme Payables",
      "auth_method": "private_key_jwt",
      "jwks_uri": null,
      "jwks": {
        "keys": [
          {
            "kty": "EC",
            "crv": "P-256",
            "x": "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
            "y": "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0",
            "kid": "acme-2026-11",
            "alg": "ES256"
          }
        ]
      },
      "allowed_scopes": [
        "openid"
      ],
      "allowed_details_types": [
        "provenance_action"
      ],
      "delivery_modes": [
        "poll"
      ],
      "notification_endpoint": null,
      "status": "active",
      "environment": "sandbox",
      "created_at": "2026-11-07T19:22:53.672Z",
      "updated_at": "2026-11-07T19:22:53.672Z",
      "last_used_at": null
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```

## Delete an OAuth client

`DELETE /v1/oauth/clients/{id}`

Deletes the client. Requests it already made keep their decisions and receipts; it can't authenticate again.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The deleted client. See [the oauth client object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/oauth/clients" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme Payables", "auth_method": "client_secret_basic" }' > step.json
export CLIENT_ID=$(jq -r '.id' step.json)
curl -X DELETE "$PROVENANCE_API/v1/oauth/clients/$CLIENT_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "Acme Payables", "auth_method": "client_secret_basic" }),
})).json();
const clientId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients/${clientId}`, {
  method: "DELETE",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/oauth/clients", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "name": "Acme Payables",
    "auth_method": "client_secret_basic"
}).json()
client_id = step1["id"]
data = httpx.delete(f"{api}/v1/oauth/clients/{client_id}", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

```json
{
  "id": "occ_01M6VQDEGX6NPP3MP23RA4Y176",
  "object": "oauth_client",
  "deleted": true
}
```

## Ask a person to approve (CIBA)

`POST /v1/oauth/bc_authorize`

CIBA backchannel authentication. The client authenticates (`private_key_jwt` or `client_secret_basic`), names a person the account knows with exactly one hint, and describes each action in `authorization_details`. The account's policy decides; an approval goes to that person. Errors follow RFC 6749 (`{ error, error_description }`).

Auth: none. No API key needed.

### Parameters

No parameters.

### Returns

The request is open. Poll the token endpoint with `auth_req_id`, at most once per `interval` seconds.

### Errors

- [`ciba_client_invalid`](https://provenanceauth.com/docs/platform/errors.md#ciba_client_invalid)
- [`ciba_unauthorized_client`](https://provenanceauth.com/docs/platform/errors.md#ciba_unauthorized_client)
- [`ciba_hint_unknown`](https://provenanceauth.com/docs/platform/errors.md#ciba_hint_unknown)
- [`ciba_details_invalid`](https://provenanceauth.com/docs/platform/errors.md#ciba_details_invalid)
- [`ciba_binding_message_too_long`](https://provenanceauth.com/docs/platform/errors.md#ciba_binding_message_too_long)
- [`oauth_invalid_request`](https://provenanceauth.com/docs/platform/errors.md#oauth_invalid_request)
- [`access_denied`](https://provenanceauth.com/docs/platform/errors.md#access_denied)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
curl -X POST "$PROVENANCE_API/v1/oauth/bc_authorize" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "openid",
    "login_hint": "ana@acme.example",
    "binding_message": "Code 7Q4-K2",
    "authorization_details": "[{\"type\":\"provenance_action\",\"action_type\":\"pay_invoice\",\"description\":\"Pay invoice INV-1042 to Brindlecote Supplies for $2,400\",\"amount\":2400,\"currency\":\"USD\",\"counterparty\":\"brindlecote.example\"}]",
    "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
    "client_assertion": "eyJhbGciOiJFUzI1NiIsImtpZCI6ImFjbWUtMjAyNi0xMSJ9.eyJpc3MiOiJvY2NfMDFNNkg5UUsyQjdROVYzTjhLNFQ2VzFZMFIifQ.c2ln"
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/bc_authorize`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "scope": "openid",
    "login_hint": "ana@acme.example",
    "binding_message": "Code 7Q4-K2",
    "authorization_details": "[{\"type\":\"provenance_action\",\"action_type\":\"pay_invoice\",\"description\":\"Pay invoice INV-1042 to Brindlecote Supplies for $2,400\",\"amount\":2400,\"currency\":\"USD\",\"counterparty\":\"brindlecote.example\"}]",
    "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
    "client_assertion": "eyJhbGciOiJFUzI1NiIsImtpZCI6ImFjbWUtMjAyNi0xMSJ9.eyJpc3MiOiJvY2NfMDFNNkg5UUsyQjdROVYzTjhLNFQ2VzFZMFIifQ.c2ln"
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/oauth/bc_authorize", json={
    "scope": "openid",
    "login_hint": "ana@acme.example",
    "binding_message": "Code 7Q4-K2",
    "authorization_details": "[{\"type\":\"provenance_action\",\"action_type\":\"pay_invoice\",\"description\":\"Pay invoice INV-1042 to Brindlecote Supplies for $2,400\",\"amount\":2400,\"currency\":\"USD\",\"counterparty\":\"brindlecote.example\"}]",
    "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
    "client_assertion": "eyJhbGciOiJFUzI1NiIsImtpZCI6ImFjbWUtMjAyNi0xMSJ9.eyJpc3MiOiJvY2NfMDFNNkg5UUsyQjdROVYzTjhLNFQ2VzFZMFIifQ.c2ln"
}).json()
```

### Response 200

```json
{
  "auth_req_id": "cba_Vq7m2KxT9nB4wC1zD3fG6hJ0kL5pSrY8aE1uR8oI2tY",
  "expires_in": 600,
  "interval": 5
}
```

## Rotate an OAuth client's secret

`POST /v1/oauth/clients/{id}/rotate_secret`

`client_secret_basic` clients: a new secret, returned once. The old one stops working at once.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The client with its new `client_secret`, shown only here. See [the oauth client object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/oauth/clients" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme Payables", "auth_method": "client_secret_basic" }' > step.json
export CLIENT_ID=$(jq -r '.id' step.json)
curl -X POST "$PROVENANCE_API/v1/oauth/clients/$CLIENT_ID/rotate_secret" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/oauth/clients/$CLIENT_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "Acme Payables", "auth_method": "client_secret_basic" }),
})).json();
const clientId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/clients/${clientId}/rotate_secret`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/oauth/clients", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
    "name": "Acme Payables",
    "auth_method": "client_secret_basic"
}).json()
client_id = step1["id"]
data = httpx.post(f"{api}/v1/oauth/clients/{client_id}/rotate_secret", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()
```

### Response 200

```json
{
  "id": "occ_01M6VQDEE381KSGYR5YQ5GZMHJ",
  "object": "oauth_client",
  "name": "Acme Payables",
  "auth_method": "client_secret_basic",
  "jwks_uri": null,
  "jwks": null,
  "allowed_scopes": [
    "openid"
  ],
  "allowed_details_types": [
    "provenance_action"
  ],
  "delivery_modes": [
    "poll"
  ],
  "notification_endpoint": null,
  "status": "active",
  "environment": "sandbox",
  "created_at": "2026-11-07T19:22:53.763Z",
  "updated_at": "2026-11-07T19:22:53.852Z",
  "last_used_at": null,
  "client_secret": "ocs_ysBM8dn9VT-ZRIakqx51q9KRiAhZU3LuizvXNwZD54U"
}
```
