---
title: "Uploads a document to a draft contract"
method: POST
path: "/draft-contracts/{draft_contract_id}/documents"
tags: ["Draft Contract Documents"]
---

# Uploads a document to a draft contract

`POST /draft-contracts/{draft_contract_id}/documents`

## Request

- Base URL: `https://api.rillet.com`
- URL: `https://api.rillet.com/draft-contracts/{draft_contract_id}/documents`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/rillet/apis/rillet-accounting-api/docs/draft-contracts/:draft_contract_id/documents/post.ts> (a function with typed inputs; its response is checked against the schema)

Attaches one PDF, JPEG, PNG, or XLSX file to an existing draft contract.
Existing attachments are preserved, including files uploaded through the Rillet application
or imported from Salesforce.
Repeating an upload creates another attachment.
A file may be at most 9 MiB. The upload is refused when the draft contract already has 20 attachments,
or when it would take the draft contract's attachments past 100 MiB in total; files uploaded through
the Rillet application or imported from Salesforce count toward both limits.
A file name may have at most 255 characters and must not contain a path.
When the draft contract is confirmed, its attachments move to the contract.
Re-creating the draft contract with POST /draft-contracts and the same external reference discards
its attachments; use PUT to change a draft contract.

## Request body `multipart/form-data`

- object
  - `file` string, binary, required

## Response `200`

Document attached

- ContractDocument
  - `id` string, uuid, required: Identifier of the attachment.
  - `file_name` string, required
  - `size` integer, required: Size in bytes.
  - `url` string, uri, required: Temporary download URL valid for up to 1 hour.

## Other responses

- `400`: Empty file, missing filename, unsupported file content, or attachment limit reached
- `404`: Draft contract not found or not accessible
- `409`: Other uploads kept changing the draft contract's attachments; retry the upload. Or the size of an existing attachment cannot be read; the error names it so it can be removed or re-uploaded.
- `413`: The file is over 9 MiB, or the draft contract's attachments would exceed 100 MiB in total
- `default`: Error

## Changes

- **2026-11-03** `c393d0102005`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/rillet/apis/rillet-accounting-api/changes/draft-contracts/:draft_contract_id/documents/post.md)

---

[API](https://skmtc.dev/rillet/apis/rillet-accounting-api.md) - [All operations](https://skmtc.dev/rillet/apis/rillet-accounting-api/llms.txt) - [OpenAPI document](https://skmtc.dev/rillet/apis/rillet-accounting-api/revisions/c393d0102005?raw)
