# Crear tarea

POST `https://api.bydomu.com/v1/tasks`

Esta referência é gerada a partir do código da API, por isso as descrições estão em espanhol. Nomes, parâmetros e exemplos são iguais em qualquer idioma.

Crea una tarea suelta o vinculada a un negocio o a un contacto. Respeta el tope de tareas del plan (`403 PLAN_LIMIT_REACHED`). Responde solo el `id`: pide `GET /tasks/{id}` para el detalle.

Permissão pedida

`tasks:write`

Cabeçalho obrigatório

`X-API-Key` · chave secreta

Nível de acesso

Nível 3 · com revisão do suporte

## Cabeçalhos

1 · todos opcionais

`Idempotency-Key` string · opcional

Clave única de la operación (8-128 caracteres de `[a-zA-Z0-9._:-]`). Un reintento con la misma clave y el mismo cuerpo devuelve la respuesta original sin repetir la operación. Vive 24 horas. 8–128 chars

## Corpo (JSON)

16 · 1 obrigatórios

`title` string · **obrigatório**

2–200 chars

`description` string · opcional

≤ 2000 chars

`type` string · opcional

CALL · EMAIL · WHATSAPP · VISIT · MEETING · SEND_PROPOSAL · SEND_CONTRACT · FOLLOW_UP · SCHEDULE_SHOWING · COLLECT_DOCUMENTS · OTHER · padrão "OTHER"

`priority` string · opcional

LOW · MEDIUM · HIGH · URGENT · padrão "MEDIUM"

`dueDate` string · opcional

nullable

`dueAt` string · opcional

nullable

**Ver os outros 10 parâmetros**

`dueOn` string · opcional

nullable

`hasDueTime` boolean · opcional

`remindMinutesBefore` integer · opcional

0–10080 · nullable

`assigneeId` string · opcional

nullable

`dealId` string · opcional

nullable

`contactId` string · opcional

nullable

`propertyId` string · opcional

nullable

`recurrence` string · opcional

DAILY · WEEKLY · MONTHLY · WEEKDAYS · nullable

`recurrenceUntil` string · opcional

nullable

`attachments` object[] · opcional

## Resposta 201

`object` · 1 campos

**`data` id**

`id` string

## Erros possíveis

com a forma `{ "error": { "code", "message" } }`

- **400** Datos inválidos: el cuerpo o la query no cumplen el esquema, o `Idempotency-Key` está mal formada.
- **401** UNAUTHORIZED
- **402** PAYMENT_REQUIRED
- **403** FORBIDDEN
- **404** NOT_FOUND
- **409** DUPLICATE
- **429** RATE_LIMITED
- **500** INTERNAL_ERROR

cURL:

```bash
curl -X POST "https://api.bydomu.com/v1/tasks" \
  -H "X-API-Key: $BYDOMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Llamar a María para confirmar la visita",
  "type": "CALL",
  "priority": "HIGH",
  "dueDate": "2026-10-01T15:00:00.000Z",
  "assigneeId": "clx1usr001",
  "contactId": "clx1con001"
}'
```

JavaScript:

```js
import { ByDomu } from "@bydomu/sdk";

const bydomu = new ByDomu({
  apiKey: process.env.BYDOMU_API_KEY,
});

const { data } = await bydomu.tasks.create({
  "title": "Llamar a María para confirmar la visita",
  "type": "CALL",
  "priority": "HIGH",
  "dueDate": "2026-10-01T15:00:00.000Z",
  "assigneeId": "clx1usr001",
  "contactId": "clx1con001"
});
```

Python:

```python
import os, requests

r = requests.post(
    "https://api.bydomu.com/v1/tasks",
    headers={"X-API-Key": os.environ["BYDOMU_API_KEY"]},
    json={
        "title": "Llamar a María para confirmar la visita",
        "type": "CALL",
        "priority": "HIGH",
        "dueDate": "2026-10-01T15:00:00.000Z",
        "assigneeId": "clx1usr001",
        "contactId": "clx1con001"
    }
)
data = r.json()
```

**Resposta · 201 · exemplo**

```json
{
  "data": {
    "id": "clx1tsk001"
  }
}
```
