---
title: "Create a publishable key"
method: POST
path: "/auth/publishable-keys"
tags: ["Auth"]
---

# Create a publishable key

`POST /auth/publishable-keys`

## Request

- Base URL: `https://api.companystack.co.uk`
- URL: `https://api.companystack.co.uk/auth/publishable-keys`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-Api-Key`

A live key needs at least one website. Test keys also work from localhost and count at most 100 requests a day.

## Request body

- object
  - `name` string
  - `mode` 'live' | 'test'
  - `allowed_origins` string[]: https://www.example.co.uk, or https://*.example.co.uk for every subdomain
  - `daily_cap` integer, nullable: Most requests the key may count in a UTC day

## Response `201`

The new key

## Other responses

- `400`: Invalid name, website or cap, or the plan's key limit reached
- `401`: API key missing, malformed or revoked
- `403`: The key's plan does not include this endpoint (`code: plan_upgrade_required`, with `upgrade_url`), the key may not call it, or the key is beyond the plan's key limit after a downgrade (`code: key_limit_exceeded`: the newest keys are paused until keys are deleted or the plan upgraded)

---

[API](https://skmtc.dev/companystack/apis/companystack-api.md) · [All operations](https://skmtc.dev/companystack/apis/companystack-api/llms.txt) · [OpenAPI document](https://skmtc.dev/companystack/apis/companystack-api/revisions/8f3234237d2d?raw)
