Skip to content

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>
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",
    ],
  },
});
{
  "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

Photon-VersionPhotonVersion

Selects the API contract date. Without it, the request is served as 2026-07-01.

Idempotency-Keystringrequired

Identifies one logical mutation across retries.

apiKeyIdstringrequired
projectIdstringrequired

Body

permissionsarray of ApiKeyPermissionrequired

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.

apiKeyApiKeyrequired