Clients
Replace a client’s key
A new key for the client. Every earlier one stops working.
POST
/
v1
/
accounts
/
{id}
/
key
Replace a client’s key
curl --request POST \
--url https://www.orgo.ai/api/v1/accounts/{id}/key \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.orgo.ai/api/v1/accounts/{id}/key"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.orgo.ai/api/v1/accounts/{id}/key', 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://www.orgo.ai/api/v1/accounts/{id}/key",
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://www.orgo.ai/api/v1/accounts/{id}/key"
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://www.orgo.ai/api/v1/accounts/{id}/key")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/v1/accounts/{id}/key")
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{
"api_key": "sk_live_…"
}A new key for the client. Every earlier one stops working.
Use your account-wide API key. A client’s own key gets
403 here. See Invoicing.
Path parameters
string
required
The client’s
id.Response
string
The new key. Shown once.
Example
curl -X POST https://www.orgo.ai/api/v1/accounts/$CLIENT_ID/key \
-H "Authorization: Bearer $ORGO_API_KEY"
import os
import requests
client_id = os.environ["CLIENT_ID"]
res = requests.post(
f"https://www.orgo.ai/api/v1/accounts/{client_id}/key",
headers={"Authorization": f"Bearer {os.environ['ORGO_API_KEY']}"},
)
print(res.json())
const clientId = process.env.CLIENT_ID;
const res = await fetch(`https://www.orgo.ai/api/v1/accounts/${clientId}/key`, {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.ORGO_API_KEY}` },
});
console.log(await res.json());
Response
{
"api_key": "sk_live_…"
}
Errors
| Status | Body | Meaning |
|---|---|---|
401 | { "error": "Invalid API key" } | No key, or not one of yours. |
403 | { "error": "Use your account-wide API key to manage accounts. Workspace keys can’t." } | A client’s own key, or any key scoped to one workspace. |
403 | { "error": "Invoicing is on every paid plan. Upgrade to use it." } | You’re on the Free plan. code is UPGRADE_REQUIRED. |
404 | { "error": "Account not found." } | No client with this id is yours. |
409 | { "error": "This account is closed." } | The client is closed. code is ACCOUNT_CLOSED. |
409 | { "error": "This account was transferred to your client." } | The client accepted a transfer and owns it now. code is ACCOUNT_TRANSFERRED. |
⌘I
Replace a client’s key
curl --request POST \
--url https://www.orgo.ai/api/v1/accounts/{id}/key \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.orgo.ai/api/v1/accounts/{id}/key"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.orgo.ai/api/v1/accounts/{id}/key', 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://www.orgo.ai/api/v1/accounts/{id}/key",
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://www.orgo.ai/api/v1/accounts/{id}/key"
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://www.orgo.ai/api/v1/accounts/{id}/key")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/v1/accounts/{id}/key")
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{
"api_key": "sk_live_…"
}