/organization/projects/{projectId}/keys/{keyId}Scope organization.projects.keys.writeSDK: @owbase/node only
Update a project key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.
Parameters
Section titled “Parameters”projectId string required
Project unique ID.
keyId string required
Key ID.
name string required
Key name. Max length: 128 chars.
scopes ProjectKeyScopes[] required
Key scopes list. Maximum of 200 scopes are allowed. Values: project.read, project.write, usage.read, keys.read, keys.write, platforms.read, platforms.write, mocks.read, mocks.write, policies.read, policies.write, project.policies.read, project.policies.write, project.oauth2.read, project.oauth2.write, templates.read, templates.write, stages.read, stages.write, users.read, users.write, sessions.read, sessions.write, teams.read, teams.write, databases.read, databases.write, tables.read, tables.write, columns.read, columns.write, indexes.read, indexes.write, rows.read, rows.write, embeddings.write, collections.read, collections.write, attributes.read, attributes.write, documents.read, documents.write, documentsdb.read, documentsdb.write, documentsdb.collections.read, documentsdb.collections.write, documentsdb.documents.read, documentsdb.documents.write, documentsdb.indexes.read, documentsdb.indexes.write, vectorsdb.read, vectorsdb.write, vectorsdb.collections.read, vectorsdb.collections.write, vectorsdb.documents.read, vectorsdb.documents.write, vectorsdb.indexes.read, vectorsdb.indexes.write, buckets.read, buckets.write, files.read, files.write, tokens.read, tokens.write, functions.read, functions.write, executions.read, executions.write, execution.read, execution.write, sites.read, sites.write, log.read, log.write, providers.read, providers.write, topics.read, topics.write, subscribers.read, subscribers.write, targets.read, targets.write, messages.read, messages.write, rules.read, rules.write, webhooks.read, webhooks.write, monitors.read, monitors.write, alerts.read, locale.read, avatars.read, avatars.write, health.read, assistant.read, migrations.read, migrations.write, schedules.read, schedules.write, vcs.read, vcs.write, insights.read, insights.write, reports.read, reports.write, reviews.read, reviews.write, presences.read, presences.write.
expire string
Expiration time in ISO 8601 format. Use null for unlimited expiration.
description string
Optional description for the key.
Access: organization API key with the organization.projects.keys.write scope (also accepts keys.write).
Responses
Section titled “Responses”200Success400Invalid or missing parameter401No session, no permission on the resource or key without the scope404Resource in the path not found429Rate limitEvery error comes as JSON with code, type and message: see Errors.
import { Client, Organization, ProjectKeyScopes } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const organization = new Organization(client);
const result = await organization.updateProjectKey({ projectId: '<PROJECT_ID>', keyId: '<KEY_ID>', name: '<NAME>', scopes: [ProjectKeyScopes.UsersRead], expire: '2020-10-15T06:38:00.000+00:00', // optional description: '<DESCRIPTION>', // optional});curl -X PUT "https://cloud.owbase.dev/v1/organization/projects/<PROJECT_ID>/keys/<KEY_ID>" \ -H "X-Owbase-Project: <PROJECT_ID>" \ -H "X-Owbase-Key: $OWBASE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"<NAME>","scopes":"project.read"}'{ "$id": "5e5ea5c16897e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "My API Key", "description": "Used by the nightly backup job.", "expire": "2020-10-15T06:38:00.000+00:00", "scopes": [ "users.read" ], "secret": "919c2d18fb5d4...a2ae413da83346ad2", "accessedAt": "2020-10-15T06:38:00.000+00:00", "sdks": [ "owbase:flutter" ]}The descriptions on this page come from the server API specification (BSD-3-Clause license), and the examples come from the SDK generator (MIT license). The full notices are in the NOTICE file of the @owbase/web and @owbase/node packages.