---
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.

---

[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)
