API Keys
Create, list, and revoke API keys programmatically.
Create a key
curlbash
curl -X POST https://api.fileswitch.co/api/v1/integrations/api-keys \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "ci-server", "expiresInDays": 90}'Response (201) — the full key is shown exactly once:
Responsejson
{
"success": true,
"data": {
"id": "c47afec6-083c-4228-a108-2271ce598dff",
"name": "ci-server",
"keyPrefix": "fc_ab12cd34",
"lastFour": "5678",
"lastUsedAt": null,
"expiresAt": "2026-10-29T13:00:00.000Z",
"revokedAt": null,
"createdAt": "2026-07-31T13:00:00.000Z",
"fullKey": "fc_ab12cd34..."
}
}nameis required (1–100 characters).expiresInDaysis optional (1–365); omit it for a non-expiring key.- Returns HTTP 403 with code
API_KEYS_REQUIRE_PAID_PLANon a free plan. - Returns HTTP 403 with code
API_KEY_LIMIT_REACHEDwhen the plan allowance is exhausted.
Endpoints
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /integrations/api-keys | JWT | List API keys for the authenticated user. |
| POST | /integrations/api-keys | JWT | Create an API key (paid plans only). |
| POST | /integrations/api-keys/:id/revoke | JWT | Permanently revoke an API key. |
Keys are scoped to the authenticated user; attempting to revoke another user's key returns 404.