Skip to main content

Endpoint

GET /v1/vault/credentials/:id

Authentication

Requires a developer API key in the Authorization header.

Request Headers

HeaderValue
AuthorizationBearer <api_key>

Path Parameters

ParameterTypeDescription
idstringThe vault credential ID (e.g. vc_01HXYZ...)

Example Request

curl https://grantex-auth-dd4mtrt2gq-uc.a.run.app/v1/vault/credentials/vc_01HXYZ... \
  -H "Authorization: Bearer gx_..."

Response — 200 OK

{
  "id": "vc_01HXYZ...",
  "principalId": "user_abc123",
  "service": "github",
  "credentialType": "oauth2",
  "tokenExpiresAt": "2026-04-06T12:00:00.000Z",
  "metadata": { "scopes": ["repo", "read:org"] },
  "createdAt": "2026-04-05T12:00:00.000Z",
  "updatedAt": "2026-04-05T12:00:00.000Z"
}

Response Fields

FieldTypeDescription
idstringUnique vault credential ID
principalIdstringThe principal who owns this credential
servicestringService identifier
credentialTypestringCredential type (e.g. "oauth2")
tokenExpiresAtstring | nullISO-8601 token expiry, or null if not set
metadataobjectArbitrary metadata
createdAtstringISO-8601 creation timestamp
updatedAtstringISO-8601 last update timestamp

Error Responses

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing API key
404NOT_FOUNDCredential not found or does not belong to developer

SDK Examples

import Grantex from '@grantex/sdk';

const grantex = new Grantex({ apiKey: 'gx_...' });

const cred = await grantex.vault.get('vc_01HXYZ...');
console.log(cred.service);       // "github"
console.log(cred.tokenExpiresAt); // "2026-04-06T12:00:00.000Z"