{"_id":"594786236cbc29000f8f26cd","project":"54eb50e5615ffc1900305a16","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":28,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915","59b8eeeb707542001076d3b6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"category":{"_id":"56d8147c3eb4dd0b00201aac","project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":0,"pages":[],"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-03-03T10:39:56.158Z","from_sync":false,"order":20,"slug":"settings","title":"Settings"},"user":"54eb4fdedf7add210007b29b","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-06-19T08:06:59.849Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","examples":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":true,"order":1,"body":"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.\n\nUse API keys in your API request headers like in this example:\n```\nAuthorization: App 003026bbc133714df1834b8638bb496e-8f4b3d9a-e931-478d-a994-28a725159ab9\n```\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Important\",\n  \"body\": \"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 mange API keys with another API key.\"\n}\n[/block]\nAvailable methods:\n* [Create new API key](#create-new-api-key)\n* [List all API keys](#list-all-api-keys)\n* [Get single API key](#get-single-api-key)\n* [Update API key](#update-api-key)\n\n\n##API key model\n|Property name|Type|Description|\n|-|-|-|\n|accountKey|string|Key used to uniquely identify the account. Use `_` as parameter value for your current account or [account key](/docs/account-get) for sub accounts.|\n|key|string|Key used to uniquely identify API key.|\n|publicApiKey|string|Generated API Key for authorization.|\n|name|string|APi key name for easy distinction between multiple API keys.|\n|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.|\n|permissions|array|List of API permission collections. Possible values are `ALL` - for all APIs and `TFA` - for methods required to perform [client side TFA](/docs/api-key-create). If `permissions` are not specified, `ALL` will be set by default.|\n|validFrom|datetime|Valid from date.|\n|validTo|datetime|Valid to date.|\n|enabled|boolean|Whether API key is enabled for use.|\n\n[block:api-header]\n{\n  \"title\": \"Create new API key\"\n}\n[/block]\nUse this method to create new API key for your account or sub accounts.\n```\nPOST https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys\n```\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST settings/1/accounts/_/api-keys HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n    \\\"name\\\": \\\"Api key 1\\\",\\n    \\\"allowedIPs\\\": [\\n        \\\"127.0.0.1\\\", \\n        \\\"192.168.1.1\\\"\\n    ],\\n    \\\"permissions\\\": [\\n      \\\"ALL\\\"\\n    ],\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"name\\\": \\\"Api key 1\\\",\\n    \\\"key\\\": \\\"C6DFA0B215B2CF24EF04794F718A3FC8\\\",\\n    \\\"publicApiKey\\\": \\\"7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77\\\",\\n    \\\"accountKey\\\": \\\"EF04794F718A3FC8C6DFA0B215B2CF24\\\",\\n    \\\"allowedIPs\\\": [\\n        \\\"127.0.0.1\\\",\\n        \\\"192.168.1.1\\\"\\n    ],\\n    \\\"permissions\\\": [\\n      \\\"ALL\\\"\\n    ]\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\",\\n    \\\"enabled\\\": true\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"List all API keys\"\n}\n[/block]\nUse this method to list all API keys for your account or sub account.\n```\nGET https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys\n```\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET settings/1/accounts/_/api-keys HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"apiKeys\\\": [\\n    {\\n      \\\"key\\\": \\\"C6DFA0B215B2CF24EF04794F718A3FC8\\\",\\n      \\\"publicApiKey\\\": \\\"7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77\\\",\\n      \\\"accountKey\\\": \\\"EF04794F718A3FC8C6DFA0B215B2CF24\\\",\\n      \\\"name\\\": \\\"permissions test key ALL\\\",\\n      \\\"allowedIPs\\\": [\\n          \\\"127.0.0.1\\\",\\n          \\\"192.168.1.1\\\"\\n      ],\\n      \\\"validFrom\\\": \\\"2017-03-15T15:40:00.000+0000\\\",\\n      \\\"validTo\\\": \\\"2017-06-15T15:40:00.000+0000\\\",\\n      \\\"enabled\\\": true,\\n      \\\"permissions\\\": [\\n        \\\"ALL\\\"\\n      ]\\n    },\\n      \\\"key\\\": \\\"G5DFA0B215B2CF24EF04794F718A3DF9\\\",\\n      \\\"publicApiKey\\\": \\\"4ac7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797a22\\\",\\n      \\\"accountKey\\\": \\\"EF04794F718A3FC8C6DFA0B215B2CF24\\\",\\n      \\\"name\\\": \\\"permissions test key ALL\\\",\\n      \\\"allowedIPs\\\": [\\n          \\\"127.0.0.1\\\",\\n          \\\"192.168.1.1\\\"\\n      ],\\n      \\\"validFrom\\\": \\\"2017-03-15T15:40:00.000+0000\\\",\\n      \\\"validTo\\\": \\\"2017-06-15T15:40:00.000+0000\\\",\\n      \\\"enabled\\\": true,\\n      \\\"permissions\\\": [\\n        \\\"ALL\\\"\\n      ]\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nYou can also filter keys by `enabled` parameter like this:\n```\nGET https://api.infobip.com/settings/1/accounts/_/api-keys?enabled=true\n```\n[block:api-header]\n{\n  \"title\": \"Get single API key\"\n}\n[/block]\nUse this method to get single API key for your account or sub account.\n```\nGET https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys/{key}\n```\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET settings/1/accounts/_/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8 HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"name\\\": \\\"Api key 1\\\",\\n    \\\"key\\\": \\\"C6DFA0B215B2CF24EF04794F718A3FC8\\\",\\n    \\\"publicApiKey\\\": \\\"7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77\\\",\\n    \\\"accountKey\\\": \\\"EF04794F718A3FC8C6DFA0B215B2CF24\\\",\\n    \\\"allowedIPs\\\": [\\n        \\\"127.0.0.1\\\",\\n        \\\"192.168.1.1\\\"\\n    ],\\n    \\\"permissions\\\": [\\n      \\\"ALL\\\"\\n    ]\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\",\\n    \\\"enabled\\\": true\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nYou can also get single API key by `publicApiKey` like this:\n```\nGET https://api.infobip.com/settings/1/accounts/_/api-keys?publicApiKey=7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77\n```\nor by `name`:\n```\nGET https://api.infobip.com/settings/1/accounts/_/api-keys?name=Api+key+1\n```\n[block:api-header]\n{\n  \"title\": \"Update API key\"\n}\n[/block]\nUse this method to update single API key for your account or sub account.\n```\nPUT https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys/{key}\n```\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PUT settings/1/accounts/_/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8 HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n    \\\"name\\\": \\\"Api key 1\\\",\\n    \\\"allowedIPs\\\": [\\n        \\\"127.0.0.1\\\", \\n        \\\"192.168.1.1\\\"\\n    ],\\n    \\\"permissions\\\": [\\n      \\\"ALL\\\"\\n    ],\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\",\\n  \\t\\\"enabled\\\": true,\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"name\\\": \\\"Api key 1\\\",\\n    \\\"key\\\": \\\"C6DFA0B215B2CF24EF04794F718A3FC8\\\",\\n    \\\"publicApiKey\\\": \\\"7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77\\\",\\n    \\\"accountKey\\\": \\\"EF04794F718A3FC8C6DFA0B215B2CF24\\\",\\n    \\\"allowedIPs\\\": [\\n        \\\"127.0.0.1\\\",\\n        \\\"192.168.1.1\\\"\\n    ],\\n    \\\"permissions\\\": [\\n      \\\"ALL\\\"\\n    ]\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\",\\n    \\\"enabled\\\": true\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"Create and manage your API keys.","slug":"api-key","type":"basic","title":"API key"}

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 ``` [block:callout] { "type": "info", "title": "Important", "body": "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 mange API keys with another API key." } [/block] Available methods: * [Create new API key](#create-new-api-key) * [List all API keys](#list-all-api-keys) * [Get single API key](#get-single-api-key) * [Update API key](#update-api-key) ##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](/docs/account-get) 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](/docs/api-key-create). 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.| [block:api-header] { "title": "Create new API key" } [/block] Use this method to create new API key for your account or sub accounts. ``` POST https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys ``` Request example: [block:code] { "codes": [ { "code": "POST settings/1/accounts/_/api-keys HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n \"name\": \"Api key 1\",\n \"allowedIPs\": [\n \"127.0.0.1\", \n \"192.168.1.1\"\n ],\n \"permissions\": [\n \"ALL\"\n ],\n \"validFrom\": \"2015-02-12T09:58:20.323+0100\",\n \"validTo\": \"2016-02-12T09:58:20.323+0100\"\n}", "language": "json" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"name\": \"Api key 1\",\n \"key\": \"C6DFA0B215B2CF24EF04794F718A3FC8\",\n \"publicApiKey\": \"7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77\",\n \"accountKey\": \"EF04794F718A3FC8C6DFA0B215B2CF24\",\n \"allowedIPs\": [\n \"127.0.0.1\",\n \"192.168.1.1\"\n ],\n \"permissions\": [\n \"ALL\"\n ]\n \"validFrom\": \"2015-02-12T09:58:20.323+0100\",\n \"validTo\": \"2016-02-12T09:58:20.323+0100\",\n \"enabled\": true\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "List all API keys" } [/block] 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: [block:code] { "codes": [ { "code": "GET settings/1/accounts/_/api-keys HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json", "language": "json" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"apiKeys\": [\n {\n \"key\": \"C6DFA0B215B2CF24EF04794F718A3FC8\",\n \"publicApiKey\": \"7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77\",\n \"accountKey\": \"EF04794F718A3FC8C6DFA0B215B2CF24\",\n \"name\": \"permissions test key ALL\",\n \"allowedIPs\": [\n \"127.0.0.1\",\n \"192.168.1.1\"\n ],\n \"validFrom\": \"2017-03-15T15:40:00.000+0000\",\n \"validTo\": \"2017-06-15T15:40:00.000+0000\",\n \"enabled\": true,\n \"permissions\": [\n \"ALL\"\n ]\n },\n \"key\": \"G5DFA0B215B2CF24EF04794F718A3DF9\",\n \"publicApiKey\": \"4ac7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797a22\",\n \"accountKey\": \"EF04794F718A3FC8C6DFA0B215B2CF24\",\n \"name\": \"permissions test key ALL\",\n \"allowedIPs\": [\n \"127.0.0.1\",\n \"192.168.1.1\"\n ],\n \"validFrom\": \"2017-03-15T15:40:00.000+0000\",\n \"validTo\": \"2017-06-15T15:40:00.000+0000\",\n \"enabled\": true,\n \"permissions\": [\n \"ALL\"\n ]\n }\n ]\n}", "language": "json" } ] } [/block] You can also filter keys by `enabled` parameter like this: ``` GET https://api.infobip.com/settings/1/accounts/_/api-keys?enabled=true ``` [block:api-header] { "title": "Get single API key" } [/block] Use this method to get single API key for your account or sub account. ``` GET https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys/{key} ``` Request example: [block:code] { "codes": [ { "code": "GET settings/1/accounts/_/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8 HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json", "language": "json" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"name\": \"Api key 1\",\n \"key\": \"C6DFA0B215B2CF24EF04794F718A3FC8\",\n \"publicApiKey\": \"7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77\",\n \"accountKey\": \"EF04794F718A3FC8C6DFA0B215B2CF24\",\n \"allowedIPs\": [\n \"127.0.0.1\",\n \"192.168.1.1\"\n ],\n \"permissions\": [\n \"ALL\"\n ]\n \"validFrom\": \"2015-02-12T09:58:20.323+0100\",\n \"validTo\": \"2016-02-12T09:58:20.323+0100\",\n \"enabled\": true\n}", "language": "json" } ] } [/block] 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 ``` [block:api-header] { "title": "Update API key" } [/block] Use this method to update single API key for your account or sub account. ``` PUT https://api.infobip.com/settings/1/accounts/{accountKey}/api-keys/{key} ``` Request example: [block:code] { "codes": [ { "code": "PUT settings/1/accounts/_/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8 HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n \"name\": \"Api key 1\",\n \"allowedIPs\": [\n \"127.0.0.1\", \n \"192.168.1.1\"\n ],\n \"permissions\": [\n \"ALL\"\n ],\n \"validFrom\": \"2015-02-12T09:58:20.323+0100\",\n \"validTo\": \"2016-02-12T09:58:20.323+0100\",\n \t\"enabled\": true,\n}", "language": "json" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"name\": \"Api key 1\",\n \"key\": \"C6DFA0B215B2CF24EF04794F718A3FC8\",\n \"publicApiKey\": \"7bd7d59cfe90e4d32b1d2f20d39c86df-fbaa8670-1008-ac7a-398a-3c11ac797c77\",\n \"accountKey\": \"EF04794F718A3FC8C6DFA0B215B2CF24\",\n \"allowedIPs\": [\n \"127.0.0.1\",\n \"192.168.1.1\"\n ],\n \"permissions\": [\n \"ALL\"\n ]\n \"validFrom\": \"2015-02-12T09:58:20.323+0100\",\n \"validTo\": \"2016-02-12T09:58:20.323+0100\",\n \"enabled\": true\n}", "language": "json" } ] } [/block]