Credentials

Credentials represent OAuth client credentials or API keys used to authenticate your applications against the cPod platform. Each credential is scoped to an organization and optionally to a specific workspace, and can carry one or more permission scopes.

⚠️

Secret shown once. The plaintext secret is returned only in the create() response. The platform does not store it. Save it immediately to a secrets manager or CI/CD secret store — it cannot be retrieved again. To rotate a secret, revoke the existing credential and create a new one.


Credential Schema

FieldTypeRequiredDescription
idstringautoUUID
namestringyesHuman-readable label (e.g. "GitHub Actions Deploy Key")
typeenumyesapi_key | oauth_client
clientIdstringautoPublic identifier used in OAuth flows
secretstringcreate onlyPlaintext secret — returned once at creation only
keyPrefixstringautoFirst 8 chars of the secret for display (e.g. cpod_abc1…)
scopesstring[]noPermission scopes (e.g. ["pods:read", "pods:write"])
statusenumautoactive | revoked | expired
expiresAtstringnoISO 8601 UTC — omit for non-expiring keys
organizationIdstringyesOrganization this credential belongs to
workspaceIdstringnoRestrict credential to a single workspace
createdAtstringautoISO 8601 UTC
updatedAtstringautoISO 8601 UTC

List Credentials

import { CpodClient } from '@cpod/sdk'
const sdk = CpodClient.fromEnv()
 
const result = await sdk.credentials.list({
  organizationId: 'b2c3d4e5-...',
  status: 'active',
  limit: 50,
})
 
for (const cred of result.data) {
  console.log(cred.id, cred.name, cred.keyPrefix, cred.status)
}

Create a Credential

Store the secret field from the response immediately. It will not appear in any subsequent API call.

const { secret, ...credential } = await sdk.credentials.create({
  organizationId: 'b2c3d4e5-...',
  workspaceId: 'c3d4e5f6-...',
  name: 'GitHub Actions Deploy Key',
  type: 'api_key',
  scopes: ['pods:read', 'pods:write'],
  expiresAt: '2027-01-01T00:00:00Z',
})
 
// Save secret NOW — it will not be shown again
await secretsManager.put('cpod/deploy-key', secret)
 
console.log(credential.id, credential.keyPrefix) // → cpod_abc1…

Get a Credential

Fetches metadata for a credential. The secret is never returned — only the keyPrefix is shown.

const cred = await sdk.credentials.get('cred-uuid')
console.log(cred.name, cred.scopes, cred.status)

Revoke a Credential

Permanently deactivates a credential. Revoked credentials cannot be reactivated. Create a new credential to replace it.

🚫

Revocation is immediate and irreversible. Any service using the credential will start receiving 401 Unauthorized responses.

const revoked = await sdk.credentials.revoke('cred-uuid')
console.log(revoked.status) // → "revoked"