Skip to main content

List API Keys

GET /v1/keys
Returns all API keys associated with your account.
Authentication required. Only the key prefix and metadata are returned — full key values are never retrievable after creation.

Example

curl https://api.acn.exchange/v1/keys \
  -H "Authorization: Bearer acn_sk_your_api_key"

Response

{
  "data": [
    {
      "id": "key_abc123",
      "name": "Production Agent",
      "prefix": "acn_sk_a1b2",
      "created_at": "2026-03-01T12:00:00Z",
      "last_used_at": "2026-03-08T10:30:00Z"
    },
    {
      "id": "key_def456",
      "name": "Development",
      "prefix": "acn_sk_x9y8",
      "created_at": "2026-02-15T08:00:00Z",
      "last_used_at": "2026-03-07T14:15:00Z"
    }
  ]
}

Create API Key

POST /v1/keys
Create a new API key. The full key is returned only once in the response — store it securely.

Request Body

FieldTypeRequiredDescription
namestringYesA descriptive name for the key (e.g., “Production Agent”)

Example

curl -X POST https://api.acn.exchange/v1/keys \
  -H "Authorization: Bearer acn_sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My New Agent"
  }'

Response

{
  "id": "key_ghi789",
  "name": "My New Agent",
  "key": "acn_sk_lm3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b",
  "prefix": "acn_sk_lm3n",
  "created_at": "2026-03-08T12:00:00Z"
}
The key field is shown only in this response. Copy and store it immediately. ACN stores only a hash of the key and cannot retrieve it for you.

Revoke API Key

DELETE /v1/keys/:keyId
Permanently revoke an API key. The key will immediately stop working for all requests.

Path Parameters

ParameterTypeDescription
keyIdstringThe key ID (e.g., key_abc123)

Example

curl -X DELETE https://api.acn.exchange/v1/keys/key_abc123 \
  -H "Authorization: Bearer acn_sk_your_api_key"

Response

{
  "id": "key_abc123",
  "status": "revoked",
  "revoked_at": "2026-03-08T12:00:00Z"
}
Revoking a key is permanent and cannot be undone. Create a new key if needed.

Error Codes

CodeDescription
ACN-AUTH-001Missing or invalid authentication
ACN-AUTH-002Key not found
ACN-AUTH-003Cannot revoke the key you’re currently using (use a different key)