API Key
A record that represents an access token for use with various APIs and messaging channels.
Note: The API key provided in the Authorization header must have the apik_ prefix.
Schema
| Name | Type | Description |
|---|---|---|
| id | ULID | Unique identifier |
| inserted_at | String(format:datetime) | Creation timestamp |
| name | String(1..64) | The display name of the API Key |
| notes | String | Any additional notes about the API Key |
| smpp_secret | String(8..8) | The SMPP secret, only available upon creation of a new API Key |
| smpp_system_id | String(15..15) | The SMPP System ID associated with this API Key. Please note, SMS queues are bound to the smpp_system_id |
| token | String(32..64) | Primary HTTP Authorization token, it shall be used with the Bearer scheme. Example: Authorization: Bearer API_KEY_TOKEN |
| updated_at | String(format:datetime) | Last update timestamp |
Examples
Create API Key
Creates an API key for the immediate account.
Request:
POST https://api.swift-api.com/api/v1/api_keys HTTP/1.1Accept: application/json, text/plainContent-Type: application/jsonContent-Length: 64Authorization: Bearer apik_ABC123
{ "data": { "name": "string", "notes": "This API Key will be used for the Westcoast SMS Application.\n" }, "type": "api_key"}Response:
HTTP/1.1 201Content-Type: application/jsonContent-Length: 402
{ "data": { "id": "01J0CRVTXX9KBD9NWS02R5R8RT", "inserted_at": "2024-06-14T00:00:00.000000Z", "name": "string", "notes": "This API Key will be used for the Westcoast SMS Application.\n", "smpp_secret": "PASSWORD", "smpp_system_id": "ABCDEF123456789", "token": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "api_key"}Create API Key for Account
Create a new API key under the specified account.
Request:
POST https://api.swift-api.com/api/v1/accounts/{account_id}/api_keys HTTP/1.1Accept: application/json, text/plainContent-Type: application/jsonContent-Length: 64Authorization: Bearer apik_ABC123{ "data": { "name": "string", "notes": "This API Key will be used for the Westcoast SMS Application.\n" }, "type": "api_key"}Response:
HTTP/1.1 201Content-Type: application/jsonContent-Length: 402
{ "data": { "id": "01J0CRVTXX9KBD9NWS02R5R8RT", "inserted_at": "2024-06-14T00:00:00.000000Z", "name": "string", "notes": "This API Key will be used for the Westcoast SMS Application.\n", "smpp_secret": "PASSWORD", "smpp_system_id": "ABCDEF123456789", "token": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "api_key"}List API Keys
List all API Keys from immediate and sub accounts.
Request:
GET https://api.swift-api.com/api/v1/api_keys HTTP/1.1Accept: application/json, text/plainAuthorization: Bearer apik_ABC123Response:
HTTP/1.1 200Content-Type: application/jsonContent-Length: 673
{ "data": { "items": [ { "data": { "id": "01J0CRVTXX9KBD9NWS02R5R8RT", "inserted_at": "2024-06-14T00:00:00.000000Z", "name": "string", "notes": "This API Key will be used for the Westcoast SMS Application.\n", "smpp_secret": "PASSWORD", "smpp_system_id": "ABCDEF123456789", "token": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "api_key" } ], "page_info": { "after": "string", "before": "string", "limit": 0.0, "total": 0.0 } }, "type": "list"}Get API Key
Retrieve an API key by ID.
Request:
GET https://api.swift-api.com/api/v1/api_keys/{id} HTTP/1.1Accept: application/json, text/plainAuthorization: Bearer apik_ABC123Response:
HTTP/1.1 200Content-Type: application/jsonContent-Length: 402
{ "data": { "id": "01J0CRVTXX9KBD9NWS02R5R8RT", "inserted_at": "2024-06-14T00:00:00.000000Z", "name": "string", "notes": "This API Key will be used for the Westcoast SMS Application.\n", "smpp_secret": "PASSWORD", "smpp_system_id": "ABCDEF123456789", "token": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "api_key"}