Skip to content

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

NameTypeDescription
idULIDUnique identifier
inserted_atString(format:datetime)Creation timestamp
nameString(1..64)The display name of the API Key
notesStringAny additional notes about the API Key
smpp_secretString(8..8)The SMPP secret, only available upon creation of a new API Key
smpp_system_idString(15..15)The SMPP System ID associated with this API Key. Please note, SMS queues are bound to the smpp_system_id
tokenString(32..64)Primary HTTP Authorization token, it shall be used with the Bearer scheme. Example: Authorization: Bearer API_KEY_TOKEN
updated_atString(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.1
Accept: application/json, text/plain
Content-Type: application/json
Content-Length: 64
Authorization: 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 201
Content-Type: application/json
Content-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.1
Accept: application/json, text/plain
Content-Type: application/json
Content-Length: 64
Authorization: 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 201
Content-Type: application/json
Content-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.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123

Response:

HTTP/1.1 200
Content-Type: application/json
Content-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.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123

Response:

HTTP/1.1 200
Content-Type: application/json
Content-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"
}