Create Workspace Provider Credential
curl --request POST \
--url https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "<string>",
"value": "<string>",
"name": "default",
"priority": 100
}
'import requests
url = "https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials"
payload = {
"provider": "<string>",
"value": "<string>",
"name": "default",
"priority": 100
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider: '<string>', value: '<string>', name: 'default', priority: 100})
};
fetch('https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials', 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.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => '<string>',
'value' => '<string>',
'name' => 'default',
'priority' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"value\": \"<string>\",\n \"name\": \"default\",\n \"priority\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"value\": \"<string>\",\n \"name\": \"default\",\n \"priority\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"<string>\",\n \"value\": \"<string>\",\n \"name\": \"default\",\n \"priority\": 100\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_name": "<string>",
"name": "<string>",
"priority": 123,
"enabled": true,
"version": 123,
"status": "unknown",
"status_at": "2023-11-07T05:31:56Z",
"fingerprint": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"scope": "platform"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Provider Credentials
Create Workspace Provider Credential
Store a provider API key for one workspace.
Required permission: provider-credentials.manage.
POST
/
api
/
v1
/
organizations
/
{org_id}
/
workspaces
/
{workspace_ref}
/
provider-credentials
Create Workspace Provider Credential
curl --request POST \
--url https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "<string>",
"value": "<string>",
"name": "default",
"priority": 100
}
'import requests
url = "https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials"
payload = {
"provider": "<string>",
"value": "<string>",
"name": "default",
"priority": 100
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider: '<string>', value: '<string>', name: 'default', priority: 100})
};
fetch('https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials', 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.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => '<string>',
'value' => '<string>',
'name' => 'default',
'priority' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"value\": \"<string>\",\n \"name\": \"default\",\n \"priority\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"value\": \"<string>\",\n \"name\": \"default\",\n \"priority\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/organizations/{org_id}/workspaces/{workspace_ref}/provider-credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"<string>\",\n \"value\": \"<string>\",\n \"name\": \"default\",\n \"priority\": 100\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_name": "<string>",
"name": "<string>",
"priority": 123,
"enabled": true,
"version": 123,
"status": "unknown",
"status_at": "2023-11-07T05:31:56Z",
"fingerprint": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"scope": "platform"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
ManagementKeySessionCookie
A control-plane management key using the sk-cp- prefix. Inference keys are not accepted by control-plane endpoints.
Path Parameters
Workspace ID or slug
Organization ID or slug
Body
application/json
A provider API key and the metadata used to select it.
Provider name from the catalog, e.g. openai
Required string length:
1 - 63Pattern:
^[a-z0-9][a-z0-9_-]*$The provider API key; stored securely and never returned
Required string length:
1 - 16384Handle for this key within the provider and scope, e.g. prod or backup
Required string length:
1 - 80Pattern:
^[A-Za-z0-9][A-Za-z0-9_.-]*$Lower is tried first; ties break by name
Required range:
0 <= x <= 1000000Response
Successful Response
Show child attributes
Show child attributes