Rotate secret
curl --request POST \
--url https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate', 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.bbrands.io/api/v3/permission/api-key/{document_id}/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"kind": "jwt",
"prefix": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"rate_limit_per_minute": 123,
"last_used_at": "2023-11-07T05:31:56Z",
"rotated_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"revoked_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revoked_reason": "<string>",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_actived": true,
"is_deleted": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"secret": "hzk_live_k7m3q9xa_3q2-7wQ1eW9rT5yU8iO0pA4sD6fG2hJ1kL3zX5cV7bN"
},
"message": "<string>",
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}API Key
Rotate Secret
Generates a new key (new prefix and secret) and returns it once.
There is no overlap window: the old key stops working at once
(within 60 seconds on every instance). Only secret keys rotate;
machine (jwt) keys are re-provisioned. Requires api-key:rotate.
The write only lands while the key still holds the secret and the
unrevoked state the request read. When a concurrent rotation or
revocation wins, the request answers 409 and no secret is
returned: read the key again and retry.
POST
/
permission
/
api-key
/
{document_id}
/
rotate
Rotate secret
curl --request POST \
--url https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate', 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.bbrands.io/api/v3/permission/api-key/{document_id}/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bbrands.io/api/v3/permission/api-key/{document_id}/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"kind": "jwt",
"prefix": "<string>",
"expiration_date": "2023-11-07T05:31:56Z",
"rate_limit_per_minute": 123,
"last_used_at": "2023-11-07T05:31:56Z",
"rotated_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"revoked_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revoked_reason": "<string>",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_actived": true,
"is_deleted": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"secret": "hzk_live_k7m3q9xa_3q2-7wQ1eW9rT5yU8iO0pA4sD6fG2hJ1kL3zX5cV7bN"
},
"message": "<string>",
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}Authorizations
bearerAuthapiKeyAuth
Was this page helpful?