Skip to main content
POST
/
v1beta
/
api-keys
TypeScript
import { Factify } from "@factify/sdk";

const factify = new Factify({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await factify.apiKeys.create({
    name: "<value>",
    organizationId: "<id>",
  });

  console.log(result);
}

run();
{
  "api_key": {
    "created_at": "2023-11-07T05:31:56Z",
    "id": "key_01jd4h5mck9gq6zrp8bn2t4w3x",
    "is_active": true,
    "key_prefix": "ffy_prod_01jd4h5...",
    "name": "Production",
    "organization_id": "org_01h2xcejqtf2nbrexx3vqjhp41",
    "expires_at": "2023-11-07T05:31:56Z",
    "revoked_at": "2023-11-07T05:31:56Z"
  },
  "secret": "ffy_prod_01h2xcejqtf2nbrexx3vqjhp41KJ8f3mNpQrStUvWxYz0123456789ABCDEFGHIJKLmNo"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer , where is your auth token.

Body

application/json

CreateApiKeyRequest contains the data needed to create a new API key.

name
string
required

Human-readable name for the key (e.g., "Production", "Staging").

Required string length: 1 - 63
organization_id
string
required

Organization ID to create the key for. Pattern: org_[0-9a-hjkmnp-tv-z]{26}

Pattern: ^org_[0-9a-hjkmnp-tv-z]{26}$
expires_at
string<date-time>

Expiration timestamp. If not set, the key does not expire. When set, must be in the future and within 1 year. Security note: Keys without expiration should be rotated periodically. timestamp.gt_now = true timestamp.within = 8760h0m0s

Response

Success

CreateApiKeyResponse contains the newly created API key and its secret.

api_key
api_key · object
required

The created API key metadata.

secret
string
required

The API key secret. This is only returned once and cannot be retrieved later. Format: ffy_{env}_{base32_uuid7}{base62_random}

  • env: "prod" or "test"
  • base32_uuid7: 26 chars (TypeID base32 alphabet: 0-9a-hjkmnp-tv-z)
  • base62_random: 43 chars (0-9A-Za-z) Store this value securely - it will not be shown again. SECURITY WARNING: This field must NEVER be logged. Handlers must redact secrets from all logs.
Minimum string length: 78
Pattern: ^ffy_(prod|test)_[A-Za-z0-9]+$
Example:

"ffy_prod_01h2xcejqtf2nbrexx3vqjhp41KJ8f3mNpQrStUvWxYz0123456789ABCDEFGHIJKLmNo"