curl --request POST \
--url https://api.bridge.xyz/v0/api_keys \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Customer service key",
"scopes": [
"customer:read",
"customer:create"
]
}
'import requests
url = "https://api.bridge.xyz/v0/api_keys"
payload = {
"name": "Customer service key",
"scopes": ["customer:read", "customer:create"]
}
headers = {
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Customer service key', scopes: ['customer:read', 'customer:create']})
};
fetch('https://api.bridge.xyz/v0/api_keys', 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.bridge.xyz/v0/api_keys",
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([
'name' => 'Customer service key',
'scopes' => [
'customer:read',
'customer:create'
]
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"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.bridge.xyz/v0/api_keys"
payload := strings.NewReader("{\n \"name\": \"Customer service key\",\n \"scopes\": [\n \"customer:read\",\n \"customer:create\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Api-Key", "<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.post("https://api.bridge.xyz/v0/api_keys")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Customer service key\",\n \"scopes\": [\n \"customer:read\",\n \"customer:create\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bridge.xyz/v0/api_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Customer service key\",\n \"scopes\": [\n \"customer:read\",\n \"customer:create\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "5f1f5b3a-8c2b-4e5f-9d88-e0b2a7d3a1e8",
"type": "Private",
"owner_type": "Developer",
"owner_id": "e802b3a4-f453-4da8-8a5b-dd50cede1e4f",
"prefix": "sk-live",
"last_4": "9f2c",
"state": "Active",
"created_at": "2026-04-22T15:04:05Z",
"updated_at": "2026-04-22T15:04:05Z",
"name": "Customer service key",
"scopes": [
"customer:read",
"customer:create"
],
"value": "sk-live-0123456789abcdef0123456789ab9f2c"
}Create a scoped API key
Create a new API key restricted to a subset of scopes. The returned value is the only
opportunity to retrieve the plaintext secret — store it securely. This endpoint does not
accept an Idempotency-Key header; each call creates a new key.
Callers may only grant scopes they themselves hold (scope subsetting). Unrestricted keys
may create scoped keys; scoped keys need the api_key:create scope. Up to 500 scoped
keys may exist per developer.
curl --request POST \
--url https://api.bridge.xyz/v0/api_keys \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Customer service key",
"scopes": [
"customer:read",
"customer:create"
]
}
'import requests
url = "https://api.bridge.xyz/v0/api_keys"
payload = {
"name": "Customer service key",
"scopes": ["customer:read", "customer:create"]
}
headers = {
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Customer service key', scopes: ['customer:read', 'customer:create']})
};
fetch('https://api.bridge.xyz/v0/api_keys', 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.bridge.xyz/v0/api_keys",
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([
'name' => 'Customer service key',
'scopes' => [
'customer:read',
'customer:create'
]
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"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.bridge.xyz/v0/api_keys"
payload := strings.NewReader("{\n \"name\": \"Customer service key\",\n \"scopes\": [\n \"customer:read\",\n \"customer:create\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Api-Key", "<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.post("https://api.bridge.xyz/v0/api_keys")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Customer service key\",\n \"scopes\": [\n \"customer:read\",\n \"customer:create\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bridge.xyz/v0/api_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Customer service key\",\n \"scopes\": [\n \"customer:read\",\n \"customer:create\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "5f1f5b3a-8c2b-4e5f-9d88-e0b2a7d3a1e8",
"type": "Private",
"owner_type": "Developer",
"owner_id": "e802b3a4-f453-4da8-8a5b-dd50cede1e4f",
"prefix": "sk-live",
"last_4": "9f2c",
"state": "Active",
"created_at": "2026-04-22T15:04:05Z",
"updated_at": "2026-04-22T15:04:05Z",
"name": "Customer service key",
"scopes": [
"customer:read",
"customer:create"
],
"value": "sk-live-0123456789abcdef0123456789ab9f2c"
}Body
The scopes to grant the new API key. Must be a non-empty array drawn from ApiKeyScope.
Scopes to grant the new key. Must be a non-empty array. Each scope must be one you yourself hold (scope subsetting).
1A scope that may be granted to a scoped API key. Unrestricted keys are created via the Dashboard and implicitly hold the standard scopes; they cannot be requested here.
api_key:create, api_key:self:read, audit_log:read, batch_settlement:create, batch_settlement:read, card:create, card:delete, card:read, card:update, crypto_return_policy:create, crypto_return_policy:delete, crypto_return_policy:read, crypto_return_policy:update, customer:create, customer:delete, customer:read, customer:update, customer_creation_request:create, customer_creation_request:read, developer_fee:create, developer_fee:read, developer_fee:update, developer_trade_configuration:read, developer_trade_configuration:update, exchange_rate:read, external_account:create, external_account:delete, external_account:read, external_account:update, funds_request:read, inquiry:read, inquiry:resume, liquidation_address:create, liquidation_address:drain:read, liquidation_address:drain:update, liquidation_address:read, liquidation_address:update, prefunded_account:create, prefunded_account:history:read, prefunded_account:read, rewards:read, rfi:read, sandbox:developer:create, sandbox:simulate, spender_contract:approval:create, spender_contract:approval:read, spender_contract:create, spender_contract:read, tos_link:create, tos_link:read, transfer:create, transfer:create:privy_custodial_wallet, transfer:delete, transfer:read, transfer:update, travel_rule_data:create, virtual_account:create, virtual_account:delete, virtual_account:history:read, virtual_account:read, virtual_account:transaction:read, virtual_account:update, wallet:create, wallet:create:privy_custodial_wallet, wallet:customer:read, wallet:delete, wallet:developer:read, wallet:update, webhook:create, webhook:delete, webhook:read, webhook:update Response
The API key was created. value is returned exactly once.
Returned only on key creation. value is the plaintext secret and is shown exactly once.
Was this page helpful?