---
title: "Create a restricted API key."
method: POST
path: "/v1/restricted_keys"
tags: ["restricted_keys"]
---

# Create a restricted API key.

`POST /v1/restricted_keys`

Create a restricted API key with specific resource scopes. Use a standard API key (ak_) or a restricted key (rk_) with RESOURCE_TYPE_ACCOUNT write scope.

## Request body

- RestrictedKeyCreateParameters
  - `name` string
  - `scopes` ScopeEntryView[]
    - `resource_type` 'RESOURCE_TYPE_DEVBOXES' | 'RESOURCE_TYPE_BLUEPRINTS' | 'RESOURCE_TYPE_SNAPSHOTS' | 'RESOURCE_TYPE_BENCHMARKS' | 'RESOURCE_TYPE_SCENARIOS' | 'RESOURCE_TYPE_AGENTS' | 'RESOURCE_TYPE_OBJECTS' | 'RESOURCE_TYPE_ACCOUNT'
    - `access_level` 'ACCESS_LEVEL_NONE' | 'ACCESS_LEVEL_READ' | 'ACCESS_LEVEL_WRITE'
  - `expires_at_ms` integer, nullable

## Response `200`

OK

- RestrictedKeyCreatedView
  - `id` string
  - `name` string
  - `key_secret` string
  - `scopes` ScopeEntryView[]
    - `resource_type` 'RESOURCE_TYPE_DEVBOXES' | 'RESOURCE_TYPE_BLUEPRINTS' | 'RESOURCE_TYPE_SNAPSHOTS' | 'RESOURCE_TYPE_BENCHMARKS' | 'RESOURCE_TYPE_SCENARIOS' | 'RESOURCE_TYPE_AGENTS' | 'RESOURCE_TYPE_OBJECTS' | 'RESOURCE_TYPE_ACCOUNT'
    - `access_level` 'ACCESS_LEVEL_NONE' | 'ACCESS_LEVEL_READ' | 'ACCESS_LEVEL_WRITE'
  - `expires_at_ms` integer, nullable

## Other responses

- `400` — Invalid scopes.

## Changes

- **2026-07-10** `7715c368e070` — 1 breaking, 1 info
  - removed the enum value `RESOURCE_TYPE_REPO_CONNECTIONS` of the request property `scopes/items/resource_type`
  - removed the `RESOURCE_TYPE_REPO_CONNECTIONS` enum value from the `scopes/items/resource_type` response property for the response status `200`
- **2026-05-27** `d3ddb452754c` — 1 breaking
  - the request property `expires_at_ms` became not nullable
- **2026-04-13** `5b536a11a713` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/runloopai/apis/runloop-api/changes/v1/restricted_keys/post.md)

---

[API](https://skmtc.dev/runloopai/apis/runloop-api.md) · [All operations](https://skmtc.dev/runloopai/apis/runloop-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/runloopai/runloop-api/revisions/e9dc776053e4/schema)
