Update project API key permissions
Update project API key permissions: updateProjectApiKey in the TypeScript, Python, Rust and Go clients.
PATCH /v1/projects/{projectId}/api-keys/{apiKeyId}
Replaces the identified project key's permission list with the supplied permissions and returns the updated metadata. Sending the permission list the key already has leaves it unchanged. This request does not create a new secret or change the key's project binding. Supply the required Idempotency-Key header.
photon.projects.updateProjectApiKey(input: UpdateProjectApiKeyInput, options?: RequestOptions): Promise<UpdateProjectApiKeyOutput>photon.projects.update_project_api_key(input: UpdateProjectApiKeyInput, *, options: RequestOptions | None = None) -> models.ProjectApiKeyResponseclient.update_project_api_key(idempotency_key: String, api_key_id: String, project_id: String, body: &types::UpdateProjectApiKeyRequest).await -> Result<ResponseValue<types::ProjectApiKeyResponse>, Error<UpdateProjectApiKeyError>>client.Projects.UpdateProjectApiKey(ctx context.Context, params *UpdateProjectApiKeyParams, opts ...RequestOption) (*ProjectApiKeyResponse, error)import { Photon } from "@photon-ai/api";
const photon = new Photon({
headers: { Authorization: `Bearer ${process.env.PHOTON_API_TOKEN}` },
});
const result = await photon.projects.updateProjectApiKey({
path: {
apiKeyId: "apiKeyId",
projectId: "projectId",
},
headers: {
idempotencyKey: "idempotencyKey",
},
body: {
permissions: [
"calls:read",
],
},
});import os
from photon_api import Photon
from photon_api.rpc_generated import UpdateProjectApiKeyInput
photon = Photon(headers={"Authorization": f"Bearer {os.environ['PHOTON_API_TOKEN']}"})
result = photon.projects.update_project_api_key(
UpdateProjectApiKeyInput.model_validate({
"path": {
"apiKeyId": "apiKeyId",
"projectId": "projectId",
},
"headers": {
"Idempotency-Key": "idempotencyKey",
},
"body": {
"permissions": [
"calls:read",
],
},
})
)use photon_ai_api::{Credential, PhotonClientBuilder, SecretString};
let token = std::env::var("PHOTON_API_TOKEN")?;
let client = PhotonClientBuilder::new()
.credential("accountServiceKey", Credential::Bearer(SecretString::from(token)))
.build()?;
let result = client
.update_project_api_key(
"idempotencyKey".to_owned(),
"apiKeyId".to_owned(),
"projectId".to_owned(),
&serde_json::from_value(serde_json::json!({
"permissions": [
"calls:read",
],
}))?,
)
.await
.map_err(|error| format!("{error:?}"))?
.into_inner();import (
"context"
"encoding/json"
"os"
photonapi "github.com/photon-hq/api/packages/go"
)
ctx := context.Background()
client := photonapi.NewClient(photonapi.WithAPIKey(os.Getenv("PHOTON_API_TOKEN")))
var body photonapi.UpdateProjectApiKeyRequest
if err := json.Unmarshal([]byte(`{
"permissions": [
"calls:read"
]
}`), &body); err != nil {
return err
}
result, err := client.Projects.UpdateProjectApiKey(ctx, &photonapi.UpdateProjectApiKeyParams{
IdempotencyKey: "idempotencyKey",
APIKeyID: "apiKeyId",
ProjectID: "projectId",
Body: body,
})
if err != nil {
return err
}
_ = result{
"apiKey": {
"apiKeyId": "string",
"createdAt": "2026-01-01T00:00:00.000Z",
"createdByAccountId": "string",
"expiresAt": null,
"name": "string",
"permissions": [
"string"
],
"permissionsUpdatedAt": null,
"projectId": "string",
"revokedAt": null
}
}Parameters
Selects the API contract date. Without it, the request is served as 2026-07-01.
Identifies one logical mutation across retries.
Body
Returns
200 The key with its new permission list. Sending the list it already holds returns it unchanged and never returns a secret. ProjectApiKeyResponse
Headers: Photon-Version. The raw response carries these headers; see Raw responses.