API key

Create and manage your API keys.

API Keys allow you to generate an authentication credential that is separate from your username and password. They are independent from one another and are easily disposable. You should create unique API keys for each of your applications or servers so that you can easily revoke them without disrupting other systems if needed.

Use API keys in your API request headers like in this example:

Authorization: App 003026bbc133714df1834b8638bb496e-8f4b3d9a-e931-478d-a994-28a725159ab9

Important

In order to manage your API keys, Basic authorization needs to be used (as shown in examples below). You will not be able to create or manage API keys with another API key.

Available methods:

API key model

Property name Type Description
accountKey string Key used to uniquely identify the account. Use _ as parameter value for your current account or account key for sub accounts.
key string Key used to uniquely identify API key.
publicApiKey string Generated API Key for authorization.
name string APi key name for easy distinction between multiple API keys.
allowedIPs array Array of allowed IP addresses for API call origin. If allowedIPs is not included, there will be no IP restrictions for API requests.
permissions array List of API permission collections. Possible values are ALL - for all APIs and TFA - for methods required to perform client side TFA. If permissions are not specified, ALL will be set by default.
validFrom datetime Valid from date.
validTo datetime Valid to date.
enabled boolean Whether API key is enabled for use.

Create a new API key

Use this method to create a new API key for your account or sub accounts.

POST https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys

Request example:

POST settings/1/accounts/_/api-keys HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{
    "name": "Api key 1",
    "allowedIPs": [
        "127.0.0.1", 
        "192.168.1.1"
    ],
    "permissions": [
      "ALL"
    ],
    "validFrom": "2015-02-12T09:58:20.323+0100",
    "validTo": "2016-02-12T09:58:20.323+0100"
}	
  

Response:

{
    "name": "Api key 1",
    "key": "C6DFA0B215B2CF24EF04794F718A3FC8",
    "publicApiKey": "7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77",
    "accountKey": "EF04794F718A3FC8C6DFA0B215B2CF24",
    "allowedIPs": [
        "127.0.0.1",
        "192.168.1.1"
    ],
    "permissions": [
      "ALL"
    ]
    "validFrom": "2015-02-12T09:58:20.323+0100",
    "validTo": "2016-02-12T09:58:20.323+0100",
    "enabled": true
}	
  

List all API keys

Use this method to list all API keys for your account or sub account.

GET https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys

Request example:

GET settings/1/accounts/_/api-keys HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json	
  

Response:

{
  "apiKeys": [
    {
      "key": "C6DFA0B215B2CF24EF04794F718A3FC8",
      "publicApiKey": "7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77",
      "accountKey": "EF04794F718A3FC8C6DFA0B215B2CF24",
      "name": "permissions test key ALL",
      "allowedIPs": [
          "127.0.0.1",
          "192.168.1.1"
      ],
      "validFrom": "2017-03-15T15:40:00.000+0000",
      "validTo": "2017-06-15T15:40:00.000+0000",
      "enabled": true,
      "permissions": [
        "ALL"
      ]
    },
      "key": "G5DFA0B215B2CF24EF04794F718A3DF9",
      "publicApiKey": "4ac7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797a22",
      "accountKey": "EF04794F718A3FC8C6DFA0B215B2CF24",
      "name": "permissions test key ALL",
      "allowedIPs": [
          "127.0.0.1",
          "192.168.1.1"
      ],
      "validFrom": "2017-03-15T15:40:00.000+0000",
      "validTo": "2017-06-15T15:40:00.000+0000",
      "enabled": true,
      "permissions": [
        "ALL"
      ]
    }
  ]
}	
  

You can also filter keys by enabled parameter like this:

GET https://api.infobip.com/settings/1/accounts/_/api-keys?enabled=true

Get a single API key

Use this method to get a single API key for your account or sub account.

GET https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys/{key}

Request example:

GET settings/1/accounts/_/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json	
  

Response:

{
    "name": "Api key 1",
    "key": "C6DFA0B215B2CF24EF04794F718A3FC8",
    "publicApiKey": "7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77",
    "accountKey": "EF04794F718A3FC8C6DFA0B215B2CF24",
    "allowedIPs": [
        "127.0.0.1",
        "192.168.1.1"
    ],
    "permissions": [
      "ALL"
    ]
    "validFrom": "2015-02-12T09:58:20.323+0100",
    "validTo": "2016-02-12T09:58:20.323+0100",
    "enabled": true
}	
  

You can also get single API key by publicApiKey like this:

GET https://api.infobip.com/settings/1/accounts/_/api-keys?publicApiKey=7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77

or by name:

GET https://api.infobip.com/settings/1/accounts/_/api-keys?name=Api+key+1

Update an API key

Use this method to update a single API key for your account or sub account.

PUT https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys/{key}

Request example:

PUT settings/1/accounts/_/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{
    "name": "Api key 1",
    "allowedIPs": [
        "127.0.0.1", 
        "192.168.1.1"
    ],
    "permissions": [
      "ALL"
    ],
    "validFrom": "2015-02-12T09:58:20.323+0100",
    "validTo": "2016-02-12T09:58:20.323+0100",
  	"enabled": true,
}	
  

Response:

{
    "name": "Api key 1",
    "key": "C6DFA0B215B2CF24EF04794F718A3FC8",
    "publicApiKey": "7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77",
    "accountKey": "EF04794F718A3FC8C6DFA0B215B2CF24",
    "allowedIPs": [
        "127.0.0.1",
        "192.168.1.1"
    ],
    "permissions": [
      "ALL"
    ]
    "validFrom": "2015-02-12T09:58:20.323+0100",
    "validTo": "2016-02-12T09:58:20.323+0100",
    "enabled": true
}