> Documentation index for AI agents: https://docs.pagerduty.com/llms.txt

# Create an OAuth client

`POST https://api.pagerduty.com/webhook_subscriptions/oauth_clients`

Create a new OAuth client for webhook subscriptions. The client credentials will be validated by attempting to obtain an access token before creation.

Requires admin or owner role permissions.

Maximum of 10 OAuth clients per account.

## Authorization

- **api_key** (apiKey) — `Authorization` header. The API Key with format `Token token=<API_KEY>`

## Header parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Accept` | string | yes | The `Accept` header is used as a versioning header. Default: `application/vnd.pagerduty+json;version=2`. |

## Request body (`application/json`) — required

| Field | Type | Required | Description |
|---|---|---|---|
| `oauth_client` | object | yes |  |
| `oauth_client.name` | string | yes | A human-readable name for the OAuth client. Max length: 255. |
| `oauth_client.client_id` | string | yes | The OAuth client ID provided by the OAuth server. Max length: 255. |
| `oauth_client.client_secret` | string | yes | The OAuth client secret provided by the OAuth server. Max length: 255. |
| `oauth_client.scope` | string |  | The OAuth scopes requested for this client. Max length: 255. |
| `oauth_client.token_url` | string (uri) | yes | The OAuth token endpoint URL. Max length: 255. |
| `oauth_client.grant_type` | string | yes | The OAuth grant type (currently only client_credentials is supported) One of: `client_credentials`. |

Example: Create OAuth Client

```json
{
  "oauth_client": {
    "name": "PagerDuty Webhook Integration",
    "client_id": "oauth-client-id",
    "client_secret": "oauth-secret-id",
    "token_url": "https://foo.oauth-server.com/oauth_token.do",
    "grant_type": "client_credentials"
  }
}
```

## Response 201

OAuth client created successfully

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `oauth_client` | object |  |  |
| `oauth_client.id` | string |  | The ID of the OAuth client. Read-only. |
| `oauth_client.type` | string | yes | The type of object being created. One of: `oauth_client`. Default: `oauth_client`. |
| `oauth_client.name` | string | yes | A human-readable name for the OAuth client. Max length: 255. |
| `oauth_client.client_id` | string | yes | The OAuth client ID provided by the OAuth server. Max length: 255. |
| `oauth_client.scope` | string \| null |  | The OAuth scopes requested for this client. Max length: 255. |
| `oauth_client.token_url` | string (uri) | yes | The OAuth token endpoint URL. Max length: 255. |
| `oauth_client.grant_type` | string | yes | The OAuth grant type (currently only client_credentials is supported) One of: `client_credentials`. |
| `oauth_client.status` | string |  | The current status of the OAuth client. Read-only. One of: `active`, `error`. |

Example: Get OAuth Client

```json
{
  "oauth_client": {
    "id": "AGMEB7F7YJYELCPG4Y5YWMYGXE",
    "type": "oauth_client",
    "name": "PagerDuty Webhook Integration",
    "client_id": "oauth-client-id",
    "scope": null,
    "token_url": "https://foo.oauth-server.com/oauth_token.do",
    "grant_type": "client_credentials",
    "status": "active"
  }
}
```

## Response 400

Caller provided invalid arguments. Please review the response for error
details. Retrying with the same arguments will *not* work.

## Response 401

Caller did not supply credentials or did not provide the correct
credentials.

If you are using an API key, it may be invalid or your Authorization header may be malformed.

## Response 403

Caller is not authorized to view the requested resource.

While your authentication is valid, the authenticated user or token does not have permission to perform this action.

## Developer Agreement

Your access to and use of the PagerDuty Developer Services is governed by the [PagerDuty Developer Agreement](https://docs.pagerduty.com/developer/pagerduty-developer-agreement).
