---
title: "Create an exchange"
method: POST
path: "/v1/exchanges"
tags: ["Exchanges"]
---

# Create an exchange

`POST /v1/exchanges`

## Request

- Base URL: `https://api.capacity.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.capacity.com/v1/exchanges`
- Auth: one of:
  - API key in header `x-capacity-id`
  - HTTP bearer

Create an exchange with at least one input and output.

## Request body

- ExchangePostSchema
  - `directory_id` string, required: ID of the directory to which the new exchange will belong
  - `inputs` string[], required: List of inputs to the exchange
  - `outputs` string[], required: List of outputs from the exchange

## Response `201`

The new exchange

- object
  - `body` object: Json body data in the request
  - `parameters` object: Query parameters in the request
  - `result` ExchangeGetSchema
    - `id` string: ID of the exchange record
    - `directory_id` string: ID of the directory to which the exchange belongs
    - `inputs` InputSchema[]: List of the exchange's inputs
      - `id` string: ID of the input record
      - `input` string: Input text
    - `outputs` OutputSchema[]: List of the exchange's outputs
      - `id` string: ID of the output record
      - `output` string: Output text

## Other responses

- `400`: The request contains malformed data or violates data integrity

---

[API](https://skmtc.dev/capacity/apis/capacity-api-docs.md) - [All operations](https://skmtc.dev/capacity/apis/capacity-api-docs/llms.txt) - [OpenAPI document](https://skmtc.dev/capacity/apis/capacity-api-docs/revisions/74c85bb61004?raw)
