> This page is for BaaS.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://en.docs.api.corpx.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://en.docs.api.corpx.com/_mcp/server.

# P2P Crypto — contract signature

With signing enabled in the market, each order generates a purchase and sale contract that both parties sign electronically before any crypto leaves. With signing disabled, the order goes from `funded` straight to `signed`.

## Signing order

```mermaid
sequenceDiagram
    autonumber
    participant API as CorpX
    participant C as Buyer
    participant V as Seller
    API->>API: generates the contract and both copies
    API-->>C: p2p.order.signature.requested (signatureUrl)
    C->>API: signs (OTP by e-mail)
    API-->>V: p2p.order.signature.requested (signatureUrl)
    V->>API: signs (OTP by e-mail)
    API-->>C: p2p.order.updated (signed)
    API-->>V: p2p.order.updated (signed)
```

* The buyer signs first, within `signingDeadlineAt`.
* Then the seller signs and sends the crypto, within `sellerDeadlineAt`.
* Each copy is confirmed by an **OTP sent to the e-mail** of the account's credentialed person. An account without a person with an e-mail cannot sign, and the order is cancelled when the contract opens (`cancelReason: signer_contact_missing`).

## Where the link is

* In the `p2p.order.signature.requested` webhook: `signatureUrl` and `deadlineAt`.
* In `GET .../p2p/orders/{orderId}`: `signatureUrl` appears for the party whose copy is pending while the order is in `signing`.
* `signatures[]` carries the state of both copies: `pending`, `sent`, `signed`, `rejected`, `expired` or `cancelled`.

## Refusal and deadline

| Situation                                     | Result                                                                           |
| --------------------------------------------- | -------------------------------------------------------------------------------- |
| A party refuses their copy                    | Order `cancelled`, `cancelReason: signature_rejected`, fault on whoever refused. |
| Signing deadline expired                      | Order `cancelled`, fault on whoever did not sign.                                |
| A party cancels before signing their own copy | Order `cancelled`, fault on whoever cancelled.                                   |
| Signature provider unavailable                | Order `cancelled`, `cancelReason: signing_unavailable`, no fault.                |

In every case the held amount returns to the buyer and the stock returns to the ad.

## Signed copy

Each party signs their own copy. The template varies with the role, the person type (individual or company) and whether the party is the advertiser. A company copy names the company. No copy carries the other party's name, document or company. The counterparty is identified by username.

Every copy carries the quote that locked the price: the Binance spot at opening (`cotacao_binance`), the time of the read in Brasília (`cotacao_horario`) and the hash of the full record (`cotacao_evidencia_sha256`), the same one `GET .../p2p/orders/{orderId}/price-evidence` returns.

After release, `GET .../p2p/orders/{orderId}/contract` returns a temporary link to download the party's copy. Before that, `409 contract_not_available`. The order receipt carries the `sha256` of each signed copy.

## Consolidation term

When the trade concludes (released or decided for the seller, both copies signed, the seller paid and the fee charged), CorpX issues a PDF term. It brings both parties together, with a masked document, the order data and the SHA-256 of each copy. It is a CorpX record, not a new signature. The same file serves both parties.

`GET .../p2p/orders/{orderId}/term` returns a temporary link. Before the term exists, `409 term_not_available`. The receipt carries `term.sha256`, `term.generatedAt` and `term.downloadPath`.