# pipelines.opportunity_attachment_upload

Anexar arquivo à oportunidade. Guarda um arquivo (até 10 MB; PDF, imagem, TXT, CSV, ZIP ou documento do Office) no card. `content` é o arquivo em base64.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/pipelines.opportunity_attachment_upload` (corpo JSON)
- Quem pode chamar: membro da conta
- Escopo da chave: `crm:write`
- Grava dados: sim
- Pela chave de API: sim
- Ferramenta MCP: `pipelines_opportunity_attachment_upload`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `pipelines.opportunity_attachment_upload`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `id` | string (uuid) | sim |  |
| `name` | string | sim |  |
| `mimeType` | string | sim |  |
| `content` | string | sim |  |

<details><summary>JSON Schema</summary>

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "mimeType": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "content": {
      "type": "string",
      "minLength": 1,
      "maxLength": 14000000
    }
  },
  "required": [
    "id",
    "name",
    "mimeType",
    "content"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/pipelines.opportunity_attachment_upload \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"00000000-0000-0000-0000-000000000000","name":"proposta.pdf","mimeType":"application/pdf","content":"JVBERi0xLjQK"}'
```

CLI:

```bash
node cli/atomiks.mjs pipelines.opportunity_attachment_upload --json '{"id":"00000000-0000-0000-0000-000000000000","name":"proposta.pdf","mimeType":"application/pdf","content":"JVBERi0xLjQK"}'
```

MCP: ferramenta `pipelines_opportunity_attachment_upload` com a mesma entrada.

## Saída

Sucesso: `{"data": ...}` com o formato abaixo.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "mimeType": {
      "type": "string"
    },
    "size": {
      "type": "number"
    },
    "url": {
      "type": "string"
    },
    "createdAt": {
      "type": "string"
    },
    "source": {
      "type": "string",
      "const": "opportunity"
    }
  },
  "required": [
    "id",
    "name",
    "mimeType",
    "size",
    "url",
    "createdAt",
    "source"
  ],
  "additionalProperties": false
}
```

## Erros

`{"error": {"code", "message", "requestId"}}`. Códigos: `invalid_input` (400), `unauthorized` (401), `forbidden` / `account_pending` / `scope_missing` (403), `not_found` (404), `limit_reached` (409), `internal` (500).
