---
title: "Form a new contract"
method: POST
path: "/contracts/form"
---

# Form a new contract

`POST /contracts/form`

## Request body

- object — The request body for the POST /contracts endpoint.
  - `endHeight` integer — The block height at which the contract will end.
  - `hostCollateral` string — The amount of collateral the host is committing.
  - `hostKey` string — The public key of the host.
  - `renterFunds` string — The funds the renter is committing.
  - `renterAddress` string — The renter's address

## Response `200`

Contract formed successfully

- ContractMetadata
  - `id` string — The unique identifier for the file contract.
  - `hostKey` string — The public key of the host.
  - `v2` boolean — Indicates if the contract is a V2 contract.
  - `proofHeight` integer — The height at which the storage proof needs to be submitted
  - `renewedFrom` string — The ID of the contract this one was renewed from
  - `revisionHeight` integer — The block height of the latest revision
  - `revisionNumber` integer — The current revision number of the contract
  - `size` integer — The size of the contract in bytes
  - `startHeight` integer — The block height at which the contract created
  - `state` 'pending' | 'active' | 'complete' | 'failed' — The state of the contract
  - `usability` 'good' | 'bad' — The usability status of the contract
  - `windowStart` integer — The block height when the contract's proof window starts.
  - `windowEnd` integer — The block height when the contract's proof window ends.
  - `contractPrice` string — The price of forming the contract.
  - `initialRenterFunds` string — The initial funds provided by the renter.
  - `spending` object — Costs and spending details of the contract.
    - `deletions` string — Total amount spent on sector deletions
    - `fundAccount` string — Total amount spent on funding ephemeral accounts
    - `sectorRoots` string — Total amount spent on listing sector roots
    - `uploads` string — Total amount spent on storing sectors
  - `archivalReason` 'renewed' | 'removed' | 'hostpruned' — The reason for archiving the contract, if applicable.
  - `renewedTo` string — The ID of the contract this one was renewed to, if applicable.

## Other responses

- `400` — Invalid request parameters
- `404` — Host not found
- `500` — Internal server error

## Changes

- **2024-12-16** `0b3014765a94` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/siafoundation/apis/renterd-api/changes/contracts/form/post.md)

---

[API](https://skmtc.dev/siafoundation/apis/renterd-api.md) · [All operations](https://skmtc.dev/siafoundation/apis/renterd-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/siafoundation/renterd-api/revisions/ce856efcdea2/schema)
