# exchangeApiKey

mutation · in the family [Open doors](/reference/open-doors/)

## What it does

An integration’s sign-in — it exchanges its API key secret for a working session.

Exchange an ApiKey secret for an API session: the key must be active AND reach-live (the minter's CURRENT ownerships — group + the named org); mints the 24 h-absolute no-idle API session and returns the bearer token ONCE. EVERY failure is uniform.

## Careful

Every failure is uniform — nothing leaks about which keys exist.

## Who may call it

No key needed for this call.

## Arguments

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `input` | [ExchangeApiKeyInput](/types/ExchangeApiKeyInput/) `ExchangeApiKeyInput!` | yes | No further notes. |

## Returns

[ApiKeyExchangeResult](/types/ApiKeyExchangeResult/) `ApiKeyExchangeResult!` — The exchangeApiKey result — the opaque API-session bearer token (returned ONCE) + its absolute deadline.

## Example request

```graphql
mutation ExampleExchangeApiKey($input: ExchangeApiKeyInput!) {
  exchangeApiKey(input: $input) {
    token
    expiresAt
  }
}
```

Variables:

```json
{
  "input": {
    "secret": "<your key secret>",
    "orgId": "01900000-0000-7000-8000-b0cf4f3c0000"
  }
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

## Example response

```json
{
  "data": {
    "exchangeApiKey": {
      "token": "<your session token>",
      "expiresAt": "2027-01-31T00:00:00.000Z"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

## Errors this call can answer

- `VALIDATION/INVALID` — Something in the request is not valid. ([VALIDATION](/errors/VALIDATION/))
- `AUTHN/LOGIN_FAILED` — The sign-in was not accepted. ([AUTHN](/errors/AUTHN/))
- `RATE_LIMIT/LOGIN_LOCKED` — Too many failed sign-in attempts. ([RATE_LIMIT](/errors/RATE_LIMIT/))
- `RATE_LIMIT/THROTTLED` — Too many requests in a short time. ([RATE_LIMIT](/errors/RATE_LIMIT/))
- `VALIDATION/VERSION_REQUIRED` — The request did not say which app version it came from. ([VALIDATION](/errors/VALIDATION/))
