Skip to main content
Pinecone Docs
current

Search documentation

Type to search this documentation.

Create a role binding

Grant a role to a principal at an organization or project scope.

POST/admin/role-bindings

Create a role binding

1 parameter
  • X-Pinecone-Api-Versionstringheaderrequired

    Required date-based version header

cURL
curl --request POST \
  --url https://api.pinecone.io/admin/role-bindings \
  --header 'Authorization: Bearer <token>' \
  --header 'X-Pinecone-Api-Version: <x-pinecone-api-version>' \
  --header 'Content-Type: application/json' \
  --data '{
  "principal_id": "e2e92523-85dc-4142-b8c2-e681be8b78df",
  "principal_type": "user",
  "resource_type": "organization",
  "role": "OrgMember"
}'
Python
import requests

url = "https://api.pinecone.io/admin/role-bindings"

payload = {
  "principal_id": "e2e92523-85dc-4142-b8c2-e681be8b78df",
  "principal_type": "user",
  "resource_type": "organization",
  "role": "OrgMember"
}
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)
JavaScript
const options = {method: "POST", headers: {"Authorization": "Bearer <token>", "X-Pinecone-Api-Version": "<x-pinecone-api-version>", "Content-Type": "application/json"}, body: JSON.stringify({
  "principal_id": "e2e92523-85dc-4142-b8c2-e681be8b78df",
  "principal_type": "user",
  "resource_type": "organization",
  "role": "OrgMember"
})};

fetch("https://api.pinecone.io/admin/role-bindings", options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.pinecone.io/admin/role-bindings",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"principal_id\":\"e2e92523-85dc-4142-b8c2-e681be8b78df\",\"principal_type\":\"user\",\"resource_type\":\"organization\",\"role\":\"OrgMember\"}",
  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;
}
Go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.pinecone.io/admin/role-bindings"

	payload := strings.NewReader("{\"principal_id\":\"e2e92523-85dc-4142-b8c2-e681be8b78df\",\"principal_type\":\"user\",\"resource_type\":\"organization\",\"role\":\"OrgMember\"}")

	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))

}
Java
HttpResponse<String> response = Unirest.post("https://api.pinecone.io/admin/role-bindings")
  .header("Authorization", "Bearer <token>")
  .header("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
  .header("Content-Type", "application/json")
  .body("{\"principal_id\":\"e2e92523-85dc-4142-b8c2-e681be8b78df\",\"principal_type\":\"user\",\"resource_type\":\"organization\",\"role\":\"OrgMember\"}")
  .asString();
Ruby
require 'uri'
require 'net/http'

url = URI("https://api.pinecone.io/admin/role-bindings")

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 = "{\"principal_id\":\"e2e92523-85dc-4142-b8c2-e681be8b78df\",\"principal_type\":\"user\",\"resource_type\":\"organization\",\"role\":\"OrgMember\"}"

response = http.request(request)
puts response.read_body
200
{
  "created_at": "2026-04-10T15:23:00.000Z",
  "id": "9a8e3528-b9c0-4358-84ce-84c28e91b566",
  "principal_id": "f8a3b2c1-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
  "principal_type": "service_account",
  "resource_id": "a2f7dddb-1597-4eff-9f71-535fde243f58",
  "resource_type": "project",
  "role": "DataPlaneEditor"
}
400
{
  "error": {
    "code": "INVALID_ARGUMENT",
    "message": "Bad request. The request body included invalid request parameters."
  },
  "status": 400
}
401
{
  "error": {
    "code": "UNAUTHENTICATED",
    "message": "Invalid API key."
  },
  "status": 401
}
403
{
  "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
}
404
{
  "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
}
409
{
  "error": {
    "code": "ABORTED",
    "message": "Cannot delete the last OrgOwner role binding for this organization."
  },
  "status": 409
}
500
{
  "error": {
    "code": "UNKNOWN",
    "message": "Internal server error"
  },
  "status": 500
}
4XX
{
  "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
}
Authorizationstringrequired

An access token must be provided in the Authorization header using the Bearer scheme.

X-Pinecone-Api-Versionstringrequired

Required date-based version header

Typestring
Default2026-07

Principal, resource scope, and role to bind.

principal_typestringrequired

The kind of principal that receives permissions from a role binding. Possible values: user, service_account, api_key, invite.

Example: service_account

Typestring
principal_idstringrequired

Principal ID. Format depends on principal_type.

Example: e2e92523-85dc-4142-b8c2-e681be8b78df

Typestring
resource_typestringrequired

The kind of resource scope a role binding applies to. Possible values: organization, project.

Example: project

Typestring
resource_id?string

Project UUID. Required when resource_type is project; omit for organization scope.

Example: a2f7dddb-1597-4eff-9f71-535fde243f58

Typestring
rolestringrequired

A role assigned to a principal at a resource scope.

Example: ProjectOwner

Typestring

200 — Role binding created.

Grants a role to a principal at a resource scope.

idstringrequired

The unique ID of the role binding.

Typestring
principal_typestringrequired

The kind of principal that receives permissions from a role binding. Possible values: user, service_account, api_key, invite.

Example: service_account

Typestring
principal_idstringrequired

The principal's ID. A UUID for all principal types (user, service_account, api_key, invite).

Example: e2e92523-85dc-4142-b8c2-e681be8b78df

Typestring
resource_typestringrequired

The kind of resource scope a role binding applies to. Possible values: organization, project.

Example: project

Typestring
resource_idstringrequired

The organization or project that the binding is scoped to.

Typestring
rolestringrequired

A role assigned to a principal at a resource scope.

Example: ProjectOwner

Typestring
created_atstringrequired

When the role binding was created.

Typestring
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu