Update API key
curl --request PUT \
--url https://api.partoo.co/v2/api_keys/{key_id} \
--header 'Content-Type: application/json' \
--header 'x-APIKey: <api-key>' \
--data '
{
"label": "API key name",
"description": "API key for updating business name, and categories.",
"expiration_date": "2022-06-05",
"ip_whitelist": [
"172.16.0.0/12",
"127.0.0.1"
],
"has_restricted_permissions": true,
"permissions": [
"business_edit",
"business_edit_name",
"business_edit_categories"
]
}
'import requests
url = "https://api.partoo.co/v2/api_keys/{key_id}"
payload = {
"label": "API key name",
"description": "API key for updating business name, and categories.",
"expiration_date": "2022-06-05",
"ip_whitelist": ["172.16.0.0/12", "127.0.0.1"],
"has_restricted_permissions": True,
"permissions": ["business_edit", "business_edit_name", "business_edit_categories"]
}
headers = {
"x-APIKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-APIKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
label: 'API key name',
description: 'API key for updating business name, and categories.',
expiration_date: '2022-06-05',
ip_whitelist: ['172.16.0.0/12', '127.0.0.1'],
has_restricted_permissions: true,
permissions: ['business_edit', 'business_edit_name', 'business_edit_categories']
})
};
fetch('https://api.partoo.co/v2/api_keys/{key_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.partoo.co/v2/api_keys/{key_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'label' => 'API key name',
'description' => 'API key for updating business name, and categories.',
'expiration_date' => '2022-06-05',
'ip_whitelist' => [
'172.16.0.0/12',
'127.0.0.1'
],
'has_restricted_permissions' => true,
'permissions' => [
'business_edit',
'business_edit_name',
'business_edit_categories'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-APIKey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.partoo.co/v2/api_keys/{key_id}"
payload := strings.NewReader("{\n \"label\": \"API key name\",\n \"description\": \"API key for updating business name, and categories.\",\n \"expiration_date\": \"2022-06-05\",\n \"ip_whitelist\": [\n \"172.16.0.0/12\",\n \"127.0.0.1\"\n ],\n \"has_restricted_permissions\": true,\n \"permissions\": [\n \"business_edit\",\n \"business_edit_name\",\n \"business_edit_categories\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-APIKey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.partoo.co/v2/api_keys/{key_id}")
.header("x-APIKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"API key name\",\n \"description\": \"API key for updating business name, and categories.\",\n \"expiration_date\": \"2022-06-05\",\n \"ip_whitelist\": [\n \"172.16.0.0/12\",\n \"127.0.0.1\"\n ],\n \"has_restricted_permissions\": true,\n \"permissions\": [\n \"business_edit\",\n \"business_edit_name\",\n \"business_edit_categories\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.partoo.co/v2/api_keys/{key_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-APIKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"API key name\",\n \"description\": \"API key for updating business name, and categories.\",\n \"expiration_date\": \"2022-06-05\",\n \"ip_whitelist\": [\n \"172.16.0.0/12\",\n \"127.0.0.1\"\n ],\n \"has_restricted_permissions\": true,\n \"permissions\": [\n \"business_edit\",\n \"business_edit_name\",\n \"business_edit_categories\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 3245,
"label": "API key name",
"description": "API key for updating business name, and categories.",
"user_id": "5309c3a237bbc544d8e26737",
"user_name": "Perceval de Galles",
"user_role": "BUSINESS_MANAGER",
"user_type": "user",
"disabled": false,
"expiration_date": "2022-06-05",
"last_used_at": "2019-08-22 11:46:38.914467+00",
"created_by": "5309c3a237bbc544d8e26737",
"created_by_name": "John Smith",
"created_at": "2018-03-12 11:49:03.399475+00",
"revoked_by": "5309c3a237bbc544d8e26737",
"revoked_by_name": "John Smith",
"revoked_at": "2020-10-20 11:46:38.914467+00",
"ip_whitelist": [
"172.16.0.0/12",
"127.0.0.1"
],
"has_restricted_permissions": true,
"permissions": [
"business_edit",
"business_edit_name",
"business_edit_categories"
]
}{
"errors": {
"json": {}
}
}{
"errors": {
"authentication": "User not authenticated"
}
}{
"errors": {
"authorization": "Operation not allowed"
}
}{
"errors": {
"json": "Resource not found"
}
}ApiKeys
Update API key
This endpoint lets you update an API key you have access to.
For more details on how API keys work, and how to handle them securely, see the Security and API Key Usage guide.
PUT
/
api_keys
/
{key_id}
Update API key
curl --request PUT \
--url https://api.partoo.co/v2/api_keys/{key_id} \
--header 'Content-Type: application/json' \
--header 'x-APIKey: <api-key>' \
--data '
{
"label": "API key name",
"description": "API key for updating business name, and categories.",
"expiration_date": "2022-06-05",
"ip_whitelist": [
"172.16.0.0/12",
"127.0.0.1"
],
"has_restricted_permissions": true,
"permissions": [
"business_edit",
"business_edit_name",
"business_edit_categories"
]
}
'import requests
url = "https://api.partoo.co/v2/api_keys/{key_id}"
payload = {
"label": "API key name",
"description": "API key for updating business name, and categories.",
"expiration_date": "2022-06-05",
"ip_whitelist": ["172.16.0.0/12", "127.0.0.1"],
"has_restricted_permissions": True,
"permissions": ["business_edit", "business_edit_name", "business_edit_categories"]
}
headers = {
"x-APIKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-APIKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
label: 'API key name',
description: 'API key for updating business name, and categories.',
expiration_date: '2022-06-05',
ip_whitelist: ['172.16.0.0/12', '127.0.0.1'],
has_restricted_permissions: true,
permissions: ['business_edit', 'business_edit_name', 'business_edit_categories']
})
};
fetch('https://api.partoo.co/v2/api_keys/{key_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.partoo.co/v2/api_keys/{key_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'label' => 'API key name',
'description' => 'API key for updating business name, and categories.',
'expiration_date' => '2022-06-05',
'ip_whitelist' => [
'172.16.0.0/12',
'127.0.0.1'
],
'has_restricted_permissions' => true,
'permissions' => [
'business_edit',
'business_edit_name',
'business_edit_categories'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-APIKey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.partoo.co/v2/api_keys/{key_id}"
payload := strings.NewReader("{\n \"label\": \"API key name\",\n \"description\": \"API key for updating business name, and categories.\",\n \"expiration_date\": \"2022-06-05\",\n \"ip_whitelist\": [\n \"172.16.0.0/12\",\n \"127.0.0.1\"\n ],\n \"has_restricted_permissions\": true,\n \"permissions\": [\n \"business_edit\",\n \"business_edit_name\",\n \"business_edit_categories\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-APIKey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.partoo.co/v2/api_keys/{key_id}")
.header("x-APIKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"API key name\",\n \"description\": \"API key for updating business name, and categories.\",\n \"expiration_date\": \"2022-06-05\",\n \"ip_whitelist\": [\n \"172.16.0.0/12\",\n \"127.0.0.1\"\n ],\n \"has_restricted_permissions\": true,\n \"permissions\": [\n \"business_edit\",\n \"business_edit_name\",\n \"business_edit_categories\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.partoo.co/v2/api_keys/{key_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-APIKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"API key name\",\n \"description\": \"API key for updating business name, and categories.\",\n \"expiration_date\": \"2022-06-05\",\n \"ip_whitelist\": [\n \"172.16.0.0/12\",\n \"127.0.0.1\"\n ],\n \"has_restricted_permissions\": true,\n \"permissions\": [\n \"business_edit\",\n \"business_edit_name\",\n \"business_edit_categories\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 3245,
"label": "API key name",
"description": "API key for updating business name, and categories.",
"user_id": "5309c3a237bbc544d8e26737",
"user_name": "Perceval de Galles",
"user_role": "BUSINESS_MANAGER",
"user_type": "user",
"disabled": false,
"expiration_date": "2022-06-05",
"last_used_at": "2019-08-22 11:46:38.914467+00",
"created_by": "5309c3a237bbc544d8e26737",
"created_by_name": "John Smith",
"created_at": "2018-03-12 11:49:03.399475+00",
"revoked_by": "5309c3a237bbc544d8e26737",
"revoked_by_name": "John Smith",
"revoked_at": "2020-10-20 11:46:38.914467+00",
"ip_whitelist": [
"172.16.0.0/12",
"127.0.0.1"
],
"has_restricted_permissions": true,
"permissions": [
"business_edit",
"business_edit_name",
"business_edit_categories"
]
}{
"errors": {
"json": {}
}
}{
"errors": {
"authentication": "User not authenticated"
}
}{
"errors": {
"authorization": "Operation not allowed"
}
}{
"errors": {
"json": "Resource not found"
}
}Authorizations
Body
application/json
Request body schema for creating or updating an API key
Response
OK
Base API Key object with common properties
Was this page helpful?