---
title: "Create contract"
method: POST
path: "/v0/contracts"
tags: ["Contracts"]
---

# Create contract

`POST /v0/contracts`

## Request

- Base URL: `https://api.formo.so`
- URL: `https://api.formo.so/v0/contracts`
- Auth: HTTP bearer

Add a blockchain contract to monitor.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `address` string, required: EVM contract address
  - `chain` integer, required: Chain ID
  - `name` string, required
  - `abi` string, required: JSON-stringified ABI
  - `events` object[], required
    - `anonymous` boolean, required
    - `inputs` object[], required
    - `name` string, required
    - `type` string, required
  - `start_block` integer: Block height recorded on the contract. Note: the events pipeline currently opens every source at the chain head, so this does not backfill historical events. Defaults to 0.
  - `include_in_pipeline` boolean: Whether to include this contract in the project contract-events pipeline. When false the ABI is still cached for transaction decoding, but no events are indexed. Defaults to false (decode-only).

## Response `201`

Contract created

- Contract
  - `name` string, required
  - `chain` integer, required
  - `address` string, required
  - `start_block` integer
  - `abi` string, required
  - `events` object[], required
    - `anonymous` boolean, required
    - `inputs` object[], required
    - `name` string, required
    - `type` string, required
  - `include_in_pipeline` boolean, required: Whether the contract is configured for the project contract-events pipeline. This is the desired membership, not live deployment state: use the `deploy` sidecar on the contract list to see what is currently deployed.

## Other responses

- `400`: The request was rejected. `code` is either `INVALID_VALIDATION_REQUEST` (Zod schema mismatch; `details` carries a `{ fieldPath: message }` map) or `BAD_REQUEST` (semantic validation failure outside Zod, e.g. mismatched IDs, business-rule violations). Branch on `code`, not status, to tell the two apart.
- `409`: The request conflicts with current resource state, or an `Idempotency-Key` request with the same key is currently in flight.

---

[API](https://skmtc.dev/formo/apis/formo-public-api.md) · [All operations](https://skmtc.dev/formo/apis/formo-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/formo/apis/formo-public-api/revisions/67ada57df63c?raw)
