> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magna.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Contract

> Register a new distribution contract record for a token.

Register a new distribution contract record for a token. This creates the
contract record in Magna only — no on-chain transaction is created. Use
[Token Contracts](/apis/admin/tokens/token-contracts) first to check whether a
contract already exists.

**Route:** `POST /api/external/v1/contracts/create`

## Headers

| Header              | Required | Description                |
| ------------------- | -------- | -------------------------- |
| `Content-Type`      | Yes      | Must be `application/json` |
| `x-magna-api-token` | Yes      | Your Magna API token       |

## Body parameters

| Field          | Type          | Required | Description                                   |
| -------------- | ------------- | -------- | --------------------------------------------- |
| `tokenId`      | string (uuid) | Yes      | The token this contract belongs to            |
| `contractType` | enum          | Yes      | Type of distribution contract (see below)     |
| `name`         | string        | No       | Display name (e.g. `"Main Vesting Contract"`) |

**`contractType`** is commonly one of:

| Value                   | Description                                       |
| ----------------------- | ------------------------------------------------- |
| `AIRLOCK`               | Standard linear unlock + vesting contract         |
| `AIRLOCK_MERKLE_VESTER` | Merkle-tree based vesting (large recipient lists) |
| `AIRDROP`               | Simple airdrop contract                           |
| `CUSTODY`               | Custody / escrow contract                         |
| `STAKING`               | Staking contract                                  |

## Request example

```sh theme={null}
curl -X POST https://app.magna.so/api/external/v1/contracts/create \
-H 'Content-Type: application/json' \
-H 'x-magna-api-token: YOUR_API_KEY' \
-d '{
  "tokenId": "tok...uuid",
  "contractType": "AIRLOCK",
  "name": "Main Vesting Contract"
}'
```

## Response example

```json theme={null}
{
  "id": "c1...uuid",
  "name": "Main Vesting Contract",
  "type": "AIRLOCK",
  "tokenId": "tok...uuid",
  "address": null,
  "createdAt": "2024-04-15T21:26:21.000Z"
}
```
