> ## Documentation Index
> Fetch the complete documentation index at: https://docs.synax.app.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Negócios

> Como gerenciar deals no pipeline de vendas via API

# Negócios (Deals)

O recurso `deals` permite gerenciar os negócios no pipeline de vendas.

## Listar negócios

```bash theme={null}
curl "https://api.synax.app.br/functions/v1/api-proxy/deals?order=created_at.desc&limit=20" \
  -H "Authorization: Bearer sk_live_SuaChaveAqui"
```

### Filtros

| Parâmetro     | Exemplo    | Descrição             |
| ------------- | ---------- | --------------------- |
| `status=open` | Por status | `open`, `won`, `lost` |

## Criar negócio

<Note>
  Requer chave com permissão de **escrita**.
</Note>

```bash theme={null}
curl -X POST "https://api.synax.app.br/functions/v1/api-proxy/deals" \
  -H "Authorization: Bearer sk_live_SuaChaveAqui" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Proposta Growth - João Silva",
    "value": 15000,
    "contact_id": "{contact_id}",
    "stage_id": "{stage_id}"
  }'
```

## Mover para outro estágio

```bash theme={null}
curl -X PATCH "https://api.synax.app.br/functions/v1/api-proxy/deals/{id}" \
  -H "Authorization: Bearer sk_live_SuaChaveAqui" \
  -H "Content-Type: application/json" \
  -d '{
    "stage_id": "{new_stage_id}"
  }'
```

## Marcar como ganho/perdido

```bash theme={null}
curl -X PATCH "https://api.synax.app.br/functions/v1/api-proxy/deals/{id}" \
  -H "Authorization: Bearer sk_live_SuaChaveAqui" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "won"
  }'
```

## Listar pipelines e estágios

```bash theme={null}
# Pipelines
curl "https://api.synax.app.br/functions/v1/api-proxy/pipelines" \
  -H "Authorization: Bearer sk_live_SuaChaveAqui"

# Estágios de um pipeline
curl "https://api.synax.app.br/functions/v1/api-proxy/stages?order=position.asc" \
  -H "Authorization: Bearer sk_live_SuaChaveAqui"
```
