---
title: "Create Key"
method: POST
path: "/gateway/keys"
tags: ["gateway"]
---

# Create Key

`POST /gateway/keys`

## Request

- Base URL: `https://api.os3robotics.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.os3robotics.com/gateway/keys`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

A key for your app (shown once, with its setup URL's key), or a judge key on an
upstream. Your app's key reaches every provider: its requests carry your provider key, name
an OS3 model, or go to your one saved provider key of their API; `upstream_id` pins it to
one.

## Request body

- GatewayKeyIn
  - `name` string, required
  - `workspace_id` string, uuid, nullable
  - `upstream_id` string, uuid, nullable
  - `purpose` 'traffic' | 'judge'
  - `trace_policy` 'full' | 'metadata' | 'none', nullable
  - `expires_at` string, date-time, nullable
  - `evaluation_key` boolean

## Response `201`

Successful Response

- GatewayKeyCreated
  - `id` string, uuid, required
  - `name` string, required
  - `prefix` string, required
  - `workspace_id` string, uuid, nullable, required
  - `upstream_id` string, uuid, nullable, required
  - `os3_models` boolean, required
  - `routing_mode` 'legacy' | 'auto', required
  - `scopes` string[], required
  - `trace_policy` string, required
  - `purpose` string, required
  - `vault_secret` string, nullable, required
  - `created_at` string, date-time, required
  - `expires_at` string, date-time, nullable, required
  - `key` string, nullable, required
  - `url_key` string, nullable, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/os3robotics/apis/os3-api.md) - [All operations](https://skmtc.dev/os3robotics/apis/os3-api/llms.txt) - [OpenAPI document](https://skmtc.dev/os3robotics/apis/os3-api/revisions/af32cd4f14bb?raw)
