# Get an organization's OAuth authorization server metadata

Public RFC 8414 authorization server metadata, one document per organization, cached in Redis.

`GET /.well-known/oauth-authorization-server/org/orgId`

- Sign-in: None at the router: the operation is public, or checks its own proof (a signature, a token in the body, a signed link).
- Rate limit: Up to 120 requests a minute per IP address.

Public RFC 8414 authorization server metadata, one document per organization, cached in Redis. Answers 404 `not_found` for an id that is not shaped like an org key, for an unknown organization, or when the document cannot be built.

## Request

| Field   | Type   | Required | Constraints | Description |
| ------- | ------ | -------- | ----------- | ----------- |
| `orgId` | string | Yes      | -           | -           |

## Example request

Replace each `YOUR_...` value with your own.

```bash title="cURL"
curl -X GET "https://api.console.buildbase.app/.well-known/oauth-authorization-server/org/YOUR_ORG_ID"
```

```ts title="TypeScript"
const response = await fetch(
  'https://api.console.buildbase.app/.well-known/oauth-authorization-server/org/YOUR_ORG_ID',
  {
    method: 'GET',
  }
);
if (!response.ok) {
  throw new Error(`${response.status}: ${await response.text()}`);
}
const data = await response.json();
```

```python title="Python"
import requests

response = requests.get(
    "https://api.console.buildbase.app/.well-known/oauth-authorization-server/org/YOUR_ORG_ID",
    timeout=30,
)
response.raise_for_status()
data = response.json()
```

## Responses

### 200 OK

OK

```json title="Example"
{
  "agent_auth": {
    "claim_endpoint": "http://localhost:3000/api/v1/auth/oauth2/agent/identity/claim?org=000000000000000000000001",
    "claim_uri": "http://localhost:3000/api/v1/auth/oauth2/agent/identity/claim?org=000000000000000000000001",
    "identity_assertion": {
      "assertion_types_supported": ["verified_email"],
      "credential_types_supported": ["access_token"]
    },
    "identity_endpoint": "http://localhost:3000/api/v1/auth/oauth2/agent/identity?org=000000000000000000000001",
    "identity_types_supported": ["service_auth", "identity_assertion"],
    "register_uri": "http://localhost:3000/api/v1/auth/oauth2/agent/identity?org=000000000000000000000001",
    "service_auth": {
      "credential_types_supported": ["access_token"]
    },
    "skill": "http://localhost:3000/org/000000000000000000000001/auth.md"
  },
  "authorization_endpoint": "[REDACTED]",
  "authorization_response_iss_parameter_supported": true,
  "code_challenge_methods_supported": ["S256"],
  "device_authorization_endpoint": "[REDACTED]",
  "grant_types_supported": [
    "authorization_code",
    "refresh_token",
    "urn:ietf:params:oauth:grant-type:device_code",
    "urn:workos:agent-auth:grant-type:claim"
  ],
  "introspection_endpoint": "http://localhost:3000/api/v1/auth/oauth2/introspect?org=000000000000000000000001",
  "introspection_endpoint_auth_methods_supported": [
    "client_secret_basic",
    "client_secret_post"
  ],
  "issuer": "http://localhost:3000/org/000000000000000000000001",
  "response_types_supported": ["code"],
  "revocation_endpoint": "http://localhost:3000/api/v1/auth/oauth2/revoke?org=000000000000000000000001",
  "revocation_endpoint_auth_methods_supported": [
    "none",
    "client_secret_basic",
    "client_secret_post"
  ],
  "token_endpoint": "[REDACTED]",
  "token_endpoint_auth_methods_supported": [
    "[REDACTED]",
    "[REDACTED]",
    "[REDACTED]"
  ]
}
```

### Any other status

Any other answer the handler sends itself (its own refusals). Not described yet.

## Errors

Each refusal, what it means, and what to do. The request changed nothing.

### 429 Too Many Requests

**What it means:** A rate limit in `x-rateLimit` was reached. `retryAfter` and the `Retry-After` header say how many seconds until the window resets.

**What to do:** Wait the number of seconds in the `Retry-After` header (also `retryAfter` in the body), then retry. Slow down repeated calls.

```json title="Example"
{
  "success": false,
  "message": "string",
  "reason": "rate_limited",
  "retryAfter": 1
}
```

## Related

- [Discovery guide](/agents/agent-ready): how this part of BuildBase works
- [All Discovery operations](/http-api/reference/discovery)
- [API reference](/http-api/reference): every operation, by tag
- [Sign-in and credentials for the HTTP API](/http-api/authentication)
- [How the HTTP API reports errors](/http-api/errors)
- [Make your first call](/http-api/first-call)
- [Error codes](/reference/error-codes): every `code` the API returns
- OpenAPI: operation `discovery.oauthAuthorizationServer.org.get` in [public-v1.json](https://docs.buildbase.app/openapi/public-v1.json)
