---
title: "Create domain"
method: POST
path: "/domains"
---

# Create domain

`POST /domains`

## Request

- Base URL: `https://app.aikido.dev/api/public/v1`
- URL: `https://app.aikido.dev/api/public/v1/domains`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://app.aikido.io/api/oauth/token` scopes: `domains:write`

Create a new domain

## Request body

- object
  - `domain` string, required: The domain name.
  - `kind` 'front_end' | 'rest_api' | 'graphql_api' | 'attack_surface', required: The kind of domain you want to add.
  - `zen_service_id` integer: The Zen service ID which shoud generate the OpenAPI spec. This, 'openapi_spec_base64' or 'openapi_spec_url' must be provided when using kind 'rest_api' or 'graphql_api'
  - `openapi_spec_base64` string: The base64 encoded JSON or YAML OpenAPI spec you want to use for this domain. This, 'zen_service_id' or 'openapi_spec_url' must be provided when using kind 'rest_api' or 'graphql_api'
  - `openapi_spec_url` string: The URL to the JSON or YAML OpenAPI spec you want to use for this domain. This, 'zen_service_id' or 'openapi_spec_base64' must be provided when using kind 'rest_api' or 'graphql_api'

## Response `201`

The domain has been successfully created

- object
  - `id` integer: The ID of the newly created domain in Aikido.

## Other responses

- `422`: One or more of the provided fields are invalid.

---

[API](https://skmtc.dev/aikido/apis/aikido-security-api-documentation.md) - [All operations](https://skmtc.dev/aikido/apis/aikido-security-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/aikido/apis/aikido-security-api-documentation/revisions/da8691338133?raw)
