---
title: "Make a mk20 deal"
method: POST
path: "/deal"
---

# Make a mk20 deal

`POST /deal`

## Request

- The document declares no server URL.
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/filecoin-project/apis/curio-market-2-0-api/docs/deal/post.ts> (a function with typed inputs; its response is checked against the schema)

Make a mk20 deal

## Request body

- Mk20Deal
  - `client` string: Client wallet string for the deal
  - `data` Mk20DataSource
    - `format` Mk20PieceDataFormat
      - `aggregate` Mk20FormatAggregate
        - `sub` Mk20DataSource[]: Sub holds a slice of DataSource, representing details of sub pieces aggregated under this format. The order must be same as segment index to avoid incorrect indexing of sub pieces in an aggregate
        - `type` 0 | 1
      - `car` Mk20FormatCar
      - `raw` Mk20FormatBytes
    - `piece_cid` object: PieceCID represents the unique identifier (pieceCID V2) for a piece of data, stored as a CID object.
    - `source_aggregate` Mk20DataSourceAggregate
      - `pieces` Mk20DataSource[]
    - `source_http` Mk20DataSourceHTTP
      - `urls` Mk20HttpUrl[]: URLs lists the HTTP endpoints where the piece data can be fetched.
        - `fallback` boolean: Fallback indicates whether this URL serves as a fallback option when other URLs fail.
        - `headers` HttpHeader
        - `priority` integer: Priority indicates the order preference for using the URL in requests, with lower values having higher priority.
        - `url` string: URL specifies the HTTP endpoint where the piece data can be fetched.
    - `source_http_put` Mk20DataSourceHttpPut
    - `source_offline` Mk20DataSourceOffline
  - `identifier` string, ulid: Identifier represents a unique identifier for the deal in ULID format.
  - `products` Mk20Products
    - `ddo_v1` Mk20DDOV1
      - `allocation_id` 0
      - `duration` integer: Duration represents the deal duration in epochs. It must be at least 518400
      - `market_address` string: MarketAddress specifies the address of the market governing the deal
      - `market_deal_id` integer: MarketDealID specifies the deal ID for the market actor at MarketAddress
      - `notification_address` AddressAddress
      - `notification_payload` integer[]: NotificationPayload holds the notification data, typically in a serialized byte array format.
      - `provider` AddressAddress
      - `start_epoch` integer: StartEpoch optionally specifies the epoch by which a deal should be active on the chain
    - `pdp_v1` Mk20PDPV1
      - `add_piece` boolean: AddPiece indicated that this deal is meant to add Piece to a given DataSet. DataSetID must be defined.
      - `create_data_set` boolean: CreateDataSet indicated that this deal is meant to create a new DataSet for the client by storage provider.
      - `data_set_id` integer: DataSetID is PDP verified contract dataset ID. It must be defined for all deals except when CreateDataSet is true.
      - `delete_data_set` boolean: DeleteDataSet indicated that this deal is meant to delete an existing DataSet created by SP for the client. DataSetID must be defined.
      - `delete_piece` boolean: DeletePiece indicates whether the Piece of the data should be deleted. DataSetID must be defined.
      - `extra_data` integer[]: ExtraData can be used to send additional information to service contract when Verifier action like AddPiece, DeletePiece, etc. are performed.
      - `piece_ids` integer[]: PieceIDs is a list of Piece ids in a proof set.
      - `record_keeper` string: RecordKeeper specifies the record keeper contract address for the new PDP dataset.
    - `retrieval_v1` Mk20RetrievalV1
      - `announce_payload` boolean: AnnouncePayload indicates whether the payload should be announced to IPNI.
      - `announce_piece` boolean: AnnouncePiece indicates whether the piece information should be announced to IPNI.
      - `indexing` boolean: Indexing indicates if the deal is to be indexed in the provider's system to support CIDs based retrieval

## Response `200`

Ok represents a successful operation with an HTTP status code of 200

- 200 | 401 | 400 | 404 | 430 | 422 | 423 | 424 | 425 | 426 | 500 | 503 | 429 | 440 | 441

## Other responses

- `400`: Bad Request - Invalid input or validation error
- `404`: ErrDealNotFound indicates that the specified deal could not be found, corresponding to the HTTP status code 404
- `422`: ErrUnsupportedDataSource indicates the specified data source is not supported or disabled for use in the current context
- `423`: ErrUnsupportedProduct indicates that the requested product is not supported by the provider
- `424`: ErrProductNotEnabled indicates that the requested product is not enabled on the provider
- `425`: ErrProductValidationFailed indicates a failure during product-specific validation due to invalid or missing data
- `426`: ErrDealRejectedByMarket indicates that a proposed deal was rejected by the market for not meeting its acceptance criteria or rules
- `429`: ErrServiceOverloaded indicates that the service is overloaded and cannot process the request at the moment
- `430`: ErrMalformedDataSource indicates that the provided data source is incorrectly formatted or contains invalid data
- `440`: ErrMarketNotEnabled indicates that the market is not enabled for the requested operation
- `441`: ErrDurationTooShort indicates that the provided duration value does not meet the minimum required threshold
- `500`: ErrServerInternalError indicates an internal server error with a corresponding error code of 500
- `503`: ErrServiceMaintenance indicates that the service is temporarily unavailable due to maintenance, corresponding to HTTP status code 503

## Changes

- **2026-04-27** `4406be02a799`: 1 info
  - endpoint added
- **2025-09-20** `cdff0cadbf58`: 1 breaking
  - api path removed without deprecation

[Operation history](https://skmtc.dev/filecoin-project/apis/curio-market-2-0-api/changes/deal/post.md)

---

[API](https://skmtc.dev/filecoin-project/apis/curio-market-2-0-api.md) - [All operations](https://skmtc.dev/filecoin-project/apis/curio-market-2-0-api/llms.txt) - [OpenAPI document](https://skmtc.dev/filecoin-project/apis/curio-market-2-0-api/revisions/afe3a6bedcd3?raw)
