# Message the other side of a deal

> Send a message in a deal's chat. The other side gets it in the app (and by email if they allow it). Contact details and off-platform payment talk are blocked. Feedback on a draft goes through request_revision, which gives the creator the notes to work from. For use once the person has agreed the words.

```http
POST https://yapfactory.com/api/v1/deals/{dealId}/messages
```

|   |   |
| --- | --- |
| Who can use it | Everyone: brands and creators |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `deals:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`send_deal_message`](https://yapfactory.com/developers/tools.md#send_deal_message) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `dealId` | path | `uuid` | yes | The deal's id. |
| `body` | body | `string` | yes | The message, in plain words. No contact details or payment talk. 1 to 2000 characters. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/deals/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/messages" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "body": "Hi Maya, the login for the app is in the brief. Shout if anything is unclear."
  }'
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "sent": true,
    "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
    "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
  }
}
```

An example: fields that don't apply are `null`, and new fields can be added at any time, so ignore ones you don't know. Every response carries `Request-Id` and the `RateLimit-*` headers.

## Errors

| Code | Status | When |
| --- | --- | --- |
| `invalid_request` | 400 | A field failed validation (see `meta.issues`), an unknown query parameter, or no `Idempotency-Key`. |
| `unauthorized` | 401 | No token, or it's wrong, expired, revoked or from the other environment. |
| `insufficient_scope` | 403 | The token doesn't have `deals:write` (or `write`). |
| `forbidden` | 403 | Not allowed for this account, for example while it's paused. |
| `not_found` | 404 | No such deal, or it isn't yours. |
| `conflict` | 409 | Its current state doesn't allow this. `message` says why, in words you can show. |
| `idempotency_conflict` | 409 | The same `Idempotency-Key` came with a different body. |
| `rate_limited` | 429 | Over the limit. Wait for `Retry-After` seconds. |
| `internal` | 500 | Our fault. Retry later, and send us the `requestId` if it keeps happening. |

Every error has the same shape. See [Errors](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/send_deal_message
