Create a service account
Create a service account with optional initial role bindings; the client secret is returned only once.
/admin/service-accountsCreate a service account
1 parameter
- X-Pinecone-Api-Versionstringheaderrequired
Required date-based version header
curl --request POST \
--url https://api.pinecone.io/admin/service-accounts \
--header 'Authorization: Bearer <token>' \
--header 'X-Pinecone-Api-Version: <x-pinecone-api-version>' \
--header 'Content-Type: application/json' \
--data '{
"name": "ci-prod",
"role_bindings": [
{
"resource_id": "a2f7dddb-1597-4eff-9f71-535fde243f58",
"resource_type": "project",
"role": "DataPlaneEditor"
}
]
}'import requests
url = "https://api.pinecone.io/admin/service-accounts"
payload = {
"name": "ci-prod",
"role_bindings": [
{
"resource_id": "a2f7dddb-1597-4eff-9f71-535fde243f58",
"resource_type": "project",
"role": "DataPlaneEditor"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"X-Pinecone-Api-Version": "<x-pinecone-api-version>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {method: "POST", headers: {"Authorization": "Bearer <token>", "X-Pinecone-Api-Version": "<x-pinecone-api-version>", "Content-Type": "application/json"}, body: JSON.stringify({
"name": "ci-prod",
"role_bindings": [
{
"resource_id": "a2f7dddb-1597-4eff-9f71-535fde243f58",
"resource_type": "project",
"role": "DataPlaneEditor"
}
]
})};
fetch("https://api.pinecone.io/admin/service-accounts", 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.pinecone.io/admin/service-accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"name\":\"ci-prod\",\"role_bindings\":[{\"resource_id\":\"a2f7dddb-1597-4eff-9f71-535fde243f58\",\"resource_type\":\"project\",\"role\":\"DataPlaneEditor\"}]}",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"X-Pinecone-Api-Version: <x-pinecone-api-version>",
"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.pinecone.io/admin/service-accounts"
payload := strings.NewReader("{\"name\":\"ci-prod\",\"role_bindings\":[{\"resource_id\":\"a2f7dddb-1597-4eff-9f71-535fde243f58\",\"resource_type\":\"project\",\"role\":\"DataPlaneEditor\"}]}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
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.pinecone.io/admin/service-accounts")
.header("Authorization", "Bearer <token>")
.header("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
.header("Content-Type", "application/json")
.body("{\"name\":\"ci-prod\",\"role_bindings\":[{\"resource_id\":\"a2f7dddb-1597-4eff-9f71-535fde243f58\",\"resource_type\":\"project\",\"role\":\"DataPlaneEditor\"}]}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pinecone.io/admin/service-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-Pinecone-Api-Version"] = '<x-pinecone-api-version>'
request["Content-Type"] = 'application/json'
request.body = "{\"name\":\"ci-prod\",\"role_bindings\":[{\"resource_id\":\"a2f7dddb-1597-4eff-9f71-535fde243f58\",\"resource_type\":\"project\",\"role\":\"DataPlaneEditor\"}]}"
response = http.request(request)
puts response.read_body{
"client_secret": "8p-kkC23XOWvkCosKq-BOn3G74qp__rBcDMxc82iB4gfzRvuhSCRBKM7C5Q7TAzj",
"service_account": {
"client_id": "l3Ow0CmFyc4jOONcwiKUCRqQKN0tiCAn",
"created_at": "2026-04-10T15:23:00.000Z",
"id": "f8a3b2c1-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
"name": "My Service Account",
"updated_at": "2026-04-10T15:23:00.000Z"
}
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Bad request. The request body included invalid request parameters."
},
"status": 400
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Invalid API key."
},
"status": 401
}{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "The index exceeds the project quota of 5 pods by 2 pods. Upgrade your account or change the project settings to increase the quota."
},
"status": 429
}{
"error": {
"code": "UNKNOWN",
"message": "Internal server error"
},
"status": 500
}{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "The index exceeds the project quota of 5 pods by 2 pods. Upgrade your account or change the project settings to increase the quota."
},
"status": 429
}Authorizations
Section titled “Authorizations”AuthorizationstringrequiredAn access token must be provided in the Authorization header using the Bearer scheme.
Headers
Section titled “Headers”X-Pinecone-Api-VersionstringrequiredRequired date-based version header
The service account to create. Repeating this request may create duplicate service accounts.
namestringrequiredThe human-readable name of the service account.
Required string length: 1 - 80. Example: ci-prod
role_bindings?object[]Optional initial role bindings. Omitting the field or passing an empty array creates the service account with no role bindings; roles can be added later via the role binding endpoints. A service account may be granted any organization- or project-scoped role. Not returned in the response.
Show child attributes
resource_typestringrequiredThe kind of resource scope a role binding applies to. Possible values: organization, project.
Example: project
resource_id?stringProject UUID. Required when resource_type is project; omit for organization scope.
rolestringrequiredA role assigned to a principal at a resource scope.
Example: ProjectOwner
Response
Section titled “Response”201 — Service account created. Role bindings are not returned here; use GET /admin/role-bindings to list them.
A service account with a newly issued OAuth client_secret. The secret is returned only once and cannot be retrieved later.
service_accountobjectrequiredA service account. The OAuth client_secret is not included.
Show child attributes
idstringrequiredThe unique identifier for the service account. Use this as the path parameter on /admin/service-accounts/service_account_id endpoints and as the principal_id when querying or creating role bindings.
namestringrequiredA short human-readable label, set by the caller at creation time.
Required string length: 1 - 80
client_idstringrequiredThe OAuth client ID used by the service account to obtain access tokens. Used only for OAuth token exchange.
created_atstringrequiredThe date and time the service account was created.
updated_atstringrequiredThe date and time of the service account's most recent metadata update.
client_secretstringrequiredThe OAuth client secret. Returned exactly once. Treat this value as a credential — store it securely and never log it.