{"_id":"5698e793d36db20d00ddba45","project":"54eb50e5615ffc1900305a16","editedParams":true,"parentDoc":null,"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"},"__v":2,"editedParams2":true,"category":{"_id":"5947ae0d4005e2000f3a4fec","project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-06-19T10:57:17.545Z","from_sync":false,"order":23,"slug":"deprecated","title":"Deprecated"},"user":"54eb4fdedf7add210007b29b","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-15T12:35:31.302Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":true,"api":{"results":{"codes":[{"status":200,"name":"","code":"{\n    \"name\": \"Updated name\",\n    \"key\": \"C6DFA0B215B2CF24EF04794F718A3FC8\",\n    \"publicApiKey\": \"d0f64a8194b48b8bb2b86e6385d22792-5af80fc8-44b0-4998-9b64-d850f659bc97\",\n    \"accountKey\": \"D0F64A8194B48B8BB2B86E6385D22792\",\n    \"allowedIPs\": [\n        \"127.0.0.1\",\n        \"192.168.1.2\"\n    ],\n    \"validFrom\": \"2015-02-12T09:58:20.323+0100\",\n    \"validTo\": \"2016-02-12T09:58:20.323+0100\",\n    \"enabled\": false\n}","language":"json"},{"name":"OK - XML","code":"<?xml version='1.0' encoding='UTF-8'?>\n<apiKey>\n  \t<name>Updated name</name>\n  \t<key>C6DFA0B215B2CF24EF04794F718A3FC8</key>\n    <publicApiKey>d0f64a8194b48b8bb2b86e6385d22792-5af80fc8-44b0-4998-9b64-d850f659bc97</publicApiKey>\n    <accountKey>D0F64A8194B48B8BB2B86E6385D22792</accountKey>\n    <allowedIPs>\n        <allowedIP>127.0.0.1</allowedIP>\n        <allowedIP>192.168.1.2</allowedIP>\n    </allowedIPs>\n    <validFrom>2015-02-12T09:58:20.323+0100</validFrom>\n\t\t<validTo>2016-02-12T09:58:20.323+0100</validTo>\n    <enabled>false</enabled>\n</apiKey>","language":"xml","status":200},{"language":"json","code":"{\n  \"requestError\": {\n    \"serviceException\": {\n      \"messageId\": \"BAD_REQUEST\",\n      \"text\": \"Bad request\"\n    }\n  }\n}","status":400}]},"settings":"","examples":{"codes":[{"language":"json","code":"PUT settings/1/accounts/D0F64A8194B48B8BB2B86E6385D22792/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8 HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json\n \n{\n    \"name\": \"Updated name\",\n    \"allowedIPs\": [\n        \"127.0.0.1\",\n        \"192.168.1.2\"\n    ],\n    \"validFrom\": \"2015-02-12T09:58:20.323+0100\",\n    \"validTo\": \"2016-02-12T09:58:20.323+0100\",\n    \"enabled\": false\n}"},{"code":"POST settings/1/accounts/D0F64A8194B48B8BB2B86E6385D22792/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8 HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/xml\nAccept: application/xml\n\n<ApiKey>\n    <name>Updated name</name>\n    <allowedIPs>\n\t    <allowedIP>127.0.0.1</allowedIP>\n\t    <allowedIP>192.168.1.2</allowedIP>\n\t</allowedIPs>\n\t<validFrom>2015-02-12T09:58:20.323+0100</validFrom>\n  <validTo>2016-02-12T09:58:20.323+0100</validTo>\n  <enabled>false</enabled>\n</ApiKey>","language":"xml"},{"code":"curl -X PUT -H \"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\" -H \"Content-Type: application/json\" -d '{\n    \"name\": \"Updated name\",\n    \"allowedIPs\": [\n        \"127.0.0.1\",\n        \"192.168.1.2\"\n    ],\n    \"validFrom\": \"2015-02-12T09:58:20.323+0100\",\n    \"validTo\": \"2016-02-12T09:58:20.323+0100\",\n    \"enabled\": false\n}' 'https://api.infobip.com/settings/1/accounts/D0F64A8194B48B8BB2B86E6385D22792/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8'","language":"curl"},{"language":"php","code":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"https://api.infobip.com/settings/1/accounts/D0F64A8194B48B8BB2B86E6385D22792/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => \"{\\n    \\\"name\\\": \\\"Updated name\\\",\\n    \\\"allowedIPs\\\": [\\n        \\\"127.0.0.1\\\",\\n        \\\"192.168.1.2\\\"\\n    ],\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\",\\n    \\\"enabled\\\": false\\n}\",\n  CURLOPT_HTTPHEADER => array(\n    \"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n    \"content-type: application/json\"\n  ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"code":"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.infobip.com/settings/1/accounts/D0F64A8194B48B8BB2B86E6385D22792/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"authorization\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\nrequest[\"content-type\"] = 'application/json'\nrequest.body = \"{\\r\\n    \\\"name\\\": \\\"Updated name\\\",\\r\\n    \\\"allowedIPs\\\": [\\r\\n        \\\"127.0.0.1\\\",\\r\\n        \\\"192.168.1.2\\\"\\r\\n    ],\\r\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\r\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\",\\r\\n    \\\"enabled\\\": false\\r\\n}\"\n\nresponse = http.request(request)\nputs response.read_body","language":"ruby"},{"language":"python","code":"import http.client\n\nconn = http.client.HTTPSConnection(\"api.infobip.com\")\n\npayload = \"{\\r\\n    \\\"name\\\": \\\"Updated name\\\",\\r\\n    \\\"allowedIPs\\\": [\\r\\n        \\\"127.0.0.1\\\",\\r\\n        \\\"192.168.1.2\\\"\\r\\n    ],\\r\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\r\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\",\\r\\n    \\\"enabled\\\": false\\r\\n}\"\n\nheaders = {\n    'authorization': \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n    'content-type': \"application/json\",\n    }\n\nconn.request(\"PUT\", \"/settings/1/accounts/D0F64A8194B48B8BB2B86E6385D22792/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"language":"java","code":"HttpResponse<String> response = Unirest.put(\"https://api.infobip.com/settings/1/accounts/D0F64A8194B48B8BB2B86E6385D22792/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8\")\n  .header(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\")\n  .header(\"content-type\", \"application/json\")\n  .body(\"{\\r\\n    \\\"name\\\": \\\"Updated name\\\",\\r\\n    \\\"allowedIPs\\\": [\\r\\n        \\\"127.0.0.1\\\",\\r\\n        \\\"192.168.1.2\\\"\\r\\n    ],\\r\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\r\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\",\\r\\n    \\\"enabled\\\": false\\r\\n}\")\n  .asString();"},{"language":"csharp","code":"var client = new RestClient(\"https://api.infobip.com/settings/1/accounts/D0F64A8194B48B8BB2B86E6385D22792/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nrequest.AddParameter(\"application/json\", \"{\\r\\n    \\\"name\\\": \\\"Updated name\\\",\\r\\n    \\\"allowedIPs\\\": [\\r\\n        \\\"127.0.0.1\\\",\\r\\n        \\\"192.168.1.2\\\"\\r\\n    ],\\r\\n    \\\"validFrom\\\": \\\"2015-02-12T09:58:20.323+0100\\\",\\r\\n    \\\"validTo\\\": \\\"2016-02-12T09:58:20.323+0100\\\",\\r\\n    \\\"enabled\\\": false\\r\\n}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"language":"javascript","code":"var data = JSON.stringify({\n  \"name\": \"Updated name\",\n  \"allowedIPs\": [\n    \"127.0.0.1\",\n    \"192.168.1.2\"\n  ],\n  \"validFrom\": \"2015-02-12T09:58:20.323+0100\",\n  \"validTo\": \"2016-02-12T09:58:20.323+0100\",\n  \"enabled\": false\n});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"PUT\", \"https://api.infobip.com/settings/1/accounts/D0F64A8194B48B8BB2B86E6385D22792/api-keys/C6DFA0B215B2CF24EF04794F718A3FC8\");\nxhr.setRequestHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\n\nxhr.send(data);"}]},"method":"put","auth":"required","params":[{"_id":"568b907a0b857d1900905f8d","ref":"","in":"path","required":true,"desc":"Account key","default":"","type":"string","name":"accountKey"},{"_id":"5698e8517465970d00650b0b","ref":"","in":"path","required":true,"desc":"Key used to uniquely identify ApiKey","default":"","type":"string","name":"key"},{"_id":"568b907a0b857d1900905f8c","ref":"","in":"body","required":false,"desc":"ApiKey name","default":"","type":"string","name":"name"},{"_id":"568b907a0b857d1900905f8b","ref":"","in":"body","required":false,"desc":"Array of allowed IP addresses for API call origin. If allowedIPs is not included, there will be no IP restrictions for API requests.","default":"","type":"array_string","name":"allowedIPs"},{"_id":"568b907a0b857d1900905f8a","ref":"","in":"body","required":false,"desc":"Date since the ApiKey is valid","default":"","type":"datetime","name":"validFrom"},{"_id":"568b907a0b857d1900905f89","ref":"","in":"body","required":false,"desc":"Date until the ApiKey is valid","default":"","type":"datetime","name":"validTo"},{"_id":"5698e8517465970d00650b0a","ref":"","in":"body","required":false,"desc":"Status of ApiKey (enabled/disabled)","default":"","type":"boolean","name":"enabled"}],"url":"/settings/:version/accounts/:accountKey/api-keys/{key}"},"isReference":true,"order":3,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important!\",\n  \"body\": \"This documentation is deprecated and is replaced with new documentation which can be found [here](/docs/api-key).\"\n}\n[/block]\n# Response format \n\nIf successful, response header HTTP status code will be `200 OK` and the API key will be updated.\n\nIf you try to update the API key without authorization, you will receive an `401 Unauthorized` error.\n\n### Api Key\n\n|Parameter|Type|Description|\n|-|-|-|\n|*name*|String|Api key name.|\n|*key*|String|Key used to uniquely identify API key.|\n|*publicApiKey*|String|Generated API Key for authorization.|\n|*accountKey*|String|Account key that generated API key belongs to.|\n|*allowedIPs*|String[]|Array of allowed IP addresses for API call origin. If allowedIPs is not included, there will be no IP restrictions for API requests.|\n|*validFrom*|Date|Date since the API key is valid.|\n|*validTo*|Date|Date until the API key is valid.|\n|*enabled*|Boolean|Whether API key is enabled for use.|","excerpt":"This method allows you to update an API key.","slug":"apikey-update","type":"endpoint","title":"ApiKey: Update"}

putApiKey: Update

This method allows you to update an API key.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

accountKey:
required
string
Account key
key:
required
string
Key used to uniquely identify ApiKey

Body Params

name:
string
ApiKey name
allowedIPs:
array of strings
Array of allowed IP addresses for API call origin. If allowedIPs is not included, there will be no IP restrictions for API requests.
validFrom:
datetime
Date since the ApiKey is valid
validTo:
datetime
Date until the ApiKey is valid
enabled:
boolean
Status of ApiKey (enabled/disabled)

Examples


Result Format


Documentation

[block:callout] { "type": "warning", "title": "Important!", "body": "This documentation is deprecated and is replaced with new documentation which can be found [here](/docs/api-key)." } [/block] # Response format If successful, response header HTTP status code will be `200 OK` and the API key will be updated. If you try to update the API key without authorization, you will receive an `401 Unauthorized` error. ### Api Key |Parameter|Type|Description| |-|-|-| |*name*|String|Api key name.| |*key*|String|Key used to uniquely identify API key.| |*publicApiKey*|String|Generated API Key for authorization.| |*accountKey*|String|Account key that generated API key belongs to.| |*allowedIPs*|String[]|Array of allowed IP addresses for API call origin. If allowedIPs is not included, there will be no IP restrictions for API requests.| |*validFrom*|Date|Date since the API key is valid.| |*validTo*|Date|Date until the API key is valid.| |*enabled*|Boolean|Whether API key is enabled for use.|

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}