> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authorization

> OAuth 2.0 pushed authorization requests, customer consent, and token exchange.

Authorization uses OAuth 2.0 pushed authorization requests (RFC 9126) with PKCE (Proof Key for Code Exchange, `S256`) and mutual TLS, followed by a browser redirect to Coinbase for customer authentication and consent, and a token exchange.

## POST `/oauth2/par`

Pushed authorization request authenticated with your PSD2 qualified website authentication certificate (QWAC) over mutual TLS. Send parameters as `application/x-www-form-urlencoded`.

### Request body

| Name | Type | Description |
| - | - | - |
| `response_type` | string, required | Must be `code`. |
| `client_id` | string, required | Full `organizationIdentifier` (object identifier `2.5.4.97`) from your QWAC subject. |
| `redirect_uri` | string, required | Canonical HTTPS callback URI on a domain covered by your QWAC. |
| `state` | string, required | Opaque value echoed on the callback for cross-site request forgery (CSRF) protection. |
| `code_challenge` | string, required | Base64url-encoded SHA-256 hash of the PKCE `code_verifier`. |
| `code_challenge_method` | string, required | Must be `S256`. |
| `authorization_details` | string, required | JSON array containing one authorization detail object. For account information (AIS), `[{"type":"psd2_ais","access":["balances","transactions"]}]` (`balances`, `transactions`, or both). For payment initiation (PIS), `[{"type":"psd2_pis","instructed_amount":{"amount":"25.00","currency":"EUR"}}]` (plus optional `remittance_information_unstructured` and `end_to_end_identification`). |

### Response

`201` · `application/json`

**Example**

```json theme={null}
{
  "request_uri": "MOCK-REQUEST-URI",
  "expires_in": 60
}
```

| Name | Type | Description |
| - | - | - |
| `request_uri` | string | Single-use handle for `/psd2/authorize`. Expires after 60 seconds. |
| `expires_in` | integer | Lifetime of `request_uri` in seconds. |

### Errors

| Status | Code | Meaning |
| - | - | - |
| 400 | `invalid_authorization_details` | Check the service type and the fields inside `authorization_details`. |
| 400 | `invalid_request` | Check the form fields. `redirect_uri` must be HTTPS on a domain the certificate covers. |
| 400 | `unauthorized_client` | Check your organisation's role and eligibility for the service in Luxembourg. |
| 401 | `invalid_client` | The provider identity, certificate, or `client_id` did not pass validation. |
| 503 | `temporarily_unavailable` | The service is temporarily unavailable. Retry later. |

## GET `/psd2/authorize`

Browser entry point for a pushed authorization request. Does not use mutual TLS. Other query parameters are ignored. The pushed values apply. After customer authentication and consent, Coinbase redirects the browser back to `redirect_uri` with `code` and `state` (or `error`).

### Query parameters

| Name | Type | Description |
| - | - | - |
| `client_id` | string, required | Organisation identifier matching the `/oauth2/par` request. |
| `request_uri` | string, required | Single-use request URI returned by `/oauth2/par`. |

## POST `/oauth2/token`

Exchanges an authorization code or refresh token for a certificate-bound access token over mutual TLS using the same QWAC. Send parameters as `application/x-www-form-urlencoded`.

### Request body

| Name | Type | Description |
| - | - | - |
| `grant_type` | string, required | `authorization_code` or `refresh_token`. Refresh is supported for AIS only. |
| `client_id` | string, required | Organisation identifier from your QWAC. |
| `redirect_uri` | string | Required for `authorization_code`. Must match the URI from `/oauth2/par`. |
| `code` | string | Required for `authorization_code`. Authorization code from the callback. |
| `code_verifier` | string | Required for `authorization_code`. PKCE verifier matching `code_challenge`. |
| `refresh_token` | string | Required for `refresh_token`. Refresh token from a prior AIS token response. |

### Response

`200` · `application/json`

**Account information example**

```json theme={null}
{
  "access_token": "…",
  "token_type": "Bearer",
  "expires_in": 3600,
  "consent_id": "MOCK-CONSENT-ID",
  "refresh_token": "…"
}
```

**Payment initiation example**

```json theme={null}
{
  "access_token": "…",
  "token_type": "Bearer",
  "expires_in": 3600,
  "consent_id": "pmt_MOCK-CONSENT-ID",
  "authorization_details": [
    {
      "type": "psd2_pis",
      "account_id": "MOCK-ACCOUNT-ID"
    }
  ]
}
```

| Name | Type | Description |
| - | - | - |
| `access_token` | string | Bearer token bound to your QWAC. |
| `token_type` | string | Always `Bearer`. |
| `expires_in` | integer | Token lifetime in seconds. |
| `consent_id` | string | Consent identifier for status lookups. Payment authorizations start with `pmt_`. |
| `refresh_token` | string | AIS only. Payment tokens cannot be refreshed. |
| `authorization_details` | object\[] | PIS only. Names the wallet the customer chose as `type` and `account_id`. |

### Errors

| Status | Code | Meaning |
| - | - | - |
| 400 | `invalid_grant` | The code or refresh token is expired, already used, or the verifier or redirect URI did not match. |
| 401 | `invalid_client` | The provider identity, certificate, or `client_id` did not pass validation. |
| 503 | `temporarily_unavailable` | The service is temporarily unavailable. Retry later. |

## What to read next

* [Account Information Services (AIS)](https://docs.cdp.coinbase.com/psd2/account-information.md)
* [Payment Initiation Services (PIS)](https://docs.cdp.coinbase.com/psd2/payment-initiation.md)
* [Consent status](https://docs.cdp.coinbase.com/psd2/consent-status.md)
