Assignment rules
Ordered, first-match-wins routing to a team or an explicit agent pool.
Download the full API pública projection: openapi.json.
Automate replies and assignment explains this resource in prose, with runnable examples.
| Method | Path | What it does |
|---|---|---|
GET | /assignment-rules | List assignment rules |
POST | /assignment-rules | Create an assignment rule |
DELETE | /assignment-rules/{id} | Delete an assignment rule |
GET | /assignment-rules/{id} | Get an assignment rule |
PATCH | /assignment-rules/{id} | Update an assignment rule |
PUT | /assignment-rules/order | Reorder the assignment rules |
GET | /assignment-rules/portal-defaults | List portal defaults |
PUT | /assignment-rules/portal-defaults/{source} | Set a portal default |
GET /assignment-rules
List assignment rules
Every rule in the workspace, ordered by priority ascending — the exact order the router evaluates them in. Unpaginated: routing tables hold a handful of rules, not thousands.
curl https://api.vitrinadev.com/api/v1/assignment-rules \
-H "Authorization: Bearer $VITRINA_KEY"Example response (200)
{
"data": [
{
"id": "5c6f2a10-9b2e-4f7a-8b8b-1a2b3c4d5e6f",
"tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
"name": "Responsable del auto",
"enabled": true,
"priority": 0,
"match_sources": [],
"match_channels": [],
"match_lead_intents": [],
"team_id": null,
"assignee_user_ids": null,
"assignee_weights": {},
"target_vehicle_owner": true,
"assignment_mode": "auto_round_robin",
"is_portal_default": false,
"created_at": "2026-01-10T13:00:00.000Z",
"updated_at": "2026-09-10T13:00:00.000Z"
},
{
"id": "6d7f3b21-0c3f-4a8b-9c9c-2b3c4d5e6f7a",
"tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
"name": "Consignación → equipo Consignaciones",
"enabled": true,
"priority": 1,
"match_sources": [],
"match_channels": [],
"match_lead_intents": [
"sell",
"trade_in"
],
"team_id": "cccccccc-0000-4000-8000-000000000001",
"assignee_user_ids": null,
"assignee_weights": {},
"target_vehicle_owner": false,
"assignment_mode": "auto_round_robin",
"is_portal_default": false,
"created_at": "2026-01-10T13:00:00.000Z",
"updated_at": "2026-09-10T13:00:00.000Z"
},
{
"id": "d5d5d5d5-0000-4000-8000-000000000001",
"tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
"name": "Mercado Libre → equipo Providencia",
"enabled": true,
"priority": 2,
"match_sources": [
"mercadolibre"
],
"match_channels": [],
"match_lead_intents": [],
"team_id": "cccccccc-0000-4000-8000-000000000001",
"assignee_user_ids": null,
"assignee_weights": {},
"target_vehicle_owner": false,
"assignment_mode": "auto_round_robin",
"is_portal_default": false,
"created_at": "2026-01-10T13:00:00.000Z",
"updated_at": "2026-09-10T13:00:00.000Z"
}
],
"meta": {
"total": 3
}
}Answers: 200 · 400 · 401 · 403 · 404 · 409 · 429
POST /assignment-rules
Create an assignment rule
Exactly one destination: team_id, a non-empty assignee_user_ids, OR target_vehicle_owner: true (combining it with either of the other two is a 400 — a rule has exactly one destination kind). Empty/absent match_sources / match_channels / match_lead_intents are wildcards (match_lead_intents ∈ buy | sell | financing | trade_in, the linked lead's intent). A client-supplied priority is rejected — new rules append LAST; move them with PUT /assignment-rules/order. assignment_mode: "manual" is a 400 (channel-only mode); auto_round_robin_online on a target_vehicle_owner rule falls through to the next rule when the named person is offline, rather than leaving the thread unassigned.
Body
| Field | Type | Required | Constraints |
|---|---|---|---|
name | string | yes | mín. 1, máx. 200 |
enabled | boolean | — | |
match_sources | array | null | — | |
match_channels | array | null | — | |
match_lead_intents | array | null | — | |
team_id | string | null | — | |
assignee_user_ids | array | null | — | |
assignee_weights | object | — | |
target_vehicle_owner | boolean | — | |
assignment_mode | auto_round_robin \ | auto_round_robin_online \ | auto_least_busy |
curl -X POST https://api.vitrinadev.com/api/v1/assignment-rules \
-H "Authorization: Bearer $VITRINA_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Mercado Libre → equipo Providencia",
"match_sources": [
"mercadolibre"
],
"team_id": "cccccccc-0000-4000-8000-000000000001"
}'Example response (201)
{
"data": {
"id": "d5d5d5d5-0000-4000-8000-000000000001",
"tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
"name": "Mercado Libre → equipo Providencia",
"enabled": true,
"priority": 0,
"match_sources": [
"mercadolibre"
],
"match_channels": [],
"match_lead_intents": [],
"team_id": "cccccccc-0000-4000-8000-000000000001",
"assignee_user_ids": null,
"assignee_weights": {},
"target_vehicle_owner": false,
"assignment_mode": "auto_round_robin",
"is_portal_default": false,
"created_at": "2026-01-10T13:00:00.000Z",
"updated_at": "2026-09-10T13:00:00.000Z"
}
}Answers: 201 · 400 · 401 · 403 · 404 · 409 · 429
DELETE /assignment-rules/{id}
Delete an assignment rule
Removes the rule. Every OTHER rule keeps its own priority — deleting does not compact the sequence, so the remaining order is unchanged.
| Parameter | In | Type | Required | Constraints |
|---|---|---|---|---|
id | path | uuid | yes |
curl -X DELETE https://api.vitrinadev.com/api/v1/assignment-rules/<id> \
-H "Authorization: Bearer $VITRINA_KEY"Answers: 204 · 400 · 401 · 403 · 404 · 409 · 429
GET /assignment-rules/{id}
Get an assignment rule
The rule, including its destination and its evaluation priority.
| Parameter | In | Type | Required | Constraints |
|---|---|---|---|---|
id | path | uuid | yes |
curl https://api.vitrinadev.com/api/v1/assignment-rules/<id> \
-H "Authorization: Bearer $VITRINA_KEY"Example response (200)
{
"data": {
"id": "d5d5d5d5-0000-4000-8000-000000000001",
"tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
"name": "Mercado Libre → equipo Providencia",
"enabled": true,
"priority": 0,
"match_sources": [
"mercadolibre"
],
"match_channels": [],
"match_lead_intents": [],
"team_id": "cccccccc-0000-4000-8000-000000000001",
"assignee_user_ids": null,
"assignee_weights": {},
"target_vehicle_owner": false,
"assignment_mode": "auto_round_robin",
"is_portal_default": false,
"created_at": "2026-01-10T13:00:00.000Z",
"updated_at": "2026-09-10T13:00:00.000Z"
}
}Answers: 200 · 400 · 401 · 403 · 404 · 409 · 429
PATCH /assignment-rules/{id}
Update an assignment rule
Partial update. Setting team_id nulls assignee_user_ids (and vice versa), and setting target_vehicle_owner: true nulls BOTH — the destination stays exactly one thing across the three kinds. priority is not writable here; use PUT /assignment-rules/order.
| Parameter | In | Type | Required | Constraints |
|---|---|---|---|---|
id | path | uuid | yes |
Body
| Field | Type | Required | Constraints |
|---|---|---|---|
name | string | — | mín. 1, máx. 200 |
enabled | boolean | — | |
match_sources | array | null | — | |
match_channels | array | null | — | |
match_lead_intents | array | null | — | |
team_id | string | null | — | |
assignee_user_ids | array | null | — | |
assignee_weights | object | — | |
target_vehicle_owner | boolean | — | |
assignment_mode | auto_round_robin \ | auto_round_robin_online \ | auto_least_busy |
curl -X PATCH https://api.vitrinadev.com/api/v1/assignment-rules/<id> \
-H "Authorization: Bearer $VITRINA_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": false
}'Example response (200)
{
"data": {
"id": "d5d5d5d5-0000-4000-8000-000000000001",
"tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
"name": "Mercado Libre → equipo Providencia",
"enabled": false,
"priority": 0,
"match_sources": [
"mercadolibre"
],
"match_channels": [],
"match_lead_intents": [],
"team_id": "cccccccc-0000-4000-8000-000000000001",
"assignee_user_ids": null,
"assignee_weights": {},
"target_vehicle_owner": false,
"assignment_mode": "auto_round_robin",
"is_portal_default": false,
"created_at": "2026-01-10T13:00:00.000Z",
"updated_at": "2026-09-10T13:00:00.000Z"
}
}Answers: 200 · 400 · 401 · 403 · 404 · 409 · 429
PUT /assignment-rules/order
Reorder the assignment rules
Atomic, all-or-nothing rewrite of every rule’s priority from the given id order. ids must be the COMPLETE set of the workspace’s rules, each exactly once — a partial list is a 400, never a partial apply.
Body
| Field | Type | Required | Constraints |
|---|---|---|---|
ids | uuid[] | yes |
curl -X PUT https://api.vitrinadev.com/api/v1/assignment-rules/order \
-H "Authorization: Bearer $VITRINA_KEY" \
-H "Content-Type: application/json" \
-d '{
"ids": [
"d5d5d5d5-0000-4000-8000-000000000001"
]
}'Example response (200)
{
"data": [
{
"id": "d5d5d5d5-0000-4000-8000-000000000001",
"tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
"name": "Mercado Libre → equipo Providencia",
"enabled": true,
"priority": 0,
"match_sources": [
"mercadolibre"
],
"match_channels": [],
"match_lead_intents": [],
"team_id": "cccccccc-0000-4000-8000-000000000001",
"assignee_user_ids": null,
"assignee_weights": {},
"target_vehicle_owner": false,
"assignment_mode": "auto_round_robin",
"is_portal_default": false,
"created_at": "2026-01-10T13:00:00.000Z",
"updated_at": "2026-09-10T13:00:00.000Z"
}
]
}Answers: 200 · 400 · 401 · 403 · 404 · 409 · 429
GET /assignment-rules/portal-defaults
List portal defaults
The "Predeterminado por marketplace" cards (ADR 0084): one per portal source (mercadolibre / yapo / chileautos) the workspace has configured. Each is an assignment rule flagged is_portal_default, evaluated AFTER every custom rule.
curl https://api.vitrinadev.com/api/v1/assignment-rules/portal-defaults \
-H "Authorization: Bearer $VITRINA_KEY"Example response (200)
{
"data": [
{
"source": "mercadolibre",
"team_id": "cccccccc-0000-4000-8000-000000000001",
"assignee_user_ids": null,
"assignment_mode": "auto_round_robin"
}
]
}Answers: 200 · 400 · 401 · 403 · 404 · 409 · 429
PUT /assignment-rules/portal-defaults/{source}
Set a portal default
Upserts the card’s WHOLE config for one portal source. Exactly one destination (team_id or assignee_user_ids); assignment_mode: "manual" is legal here (the thread queues for manual pickup and the chain STOPS). A body with no destination and a non-manual mode CLEARS the default (204).
| Parameter | In | Type | Required | Constraints |
|---|---|---|---|---|
source | path | mercadolibre \ | yapo \ | chileautos |
Body
| Field | Type | Required | Constraints |
|---|---|---|---|
assignment_mode | auto_round_robin \ | auto_round_robin_online \ | auto_least_busy \ |
team_id | string | null | — | |
assignee_user_ids | array | null | — | |
assignee_weights | object | — |
curl -X PUT https://api.vitrinadev.com/api/v1/assignment-rules/portal-defaults/<id> \
-H "Authorization: Bearer $VITRINA_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "cccccccc-0000-4000-8000-000000000001",
"assignment_mode": "auto_round_robin"
}'Example response (200)
{
"data": {
"source": "mercadolibre",
"team_id": "cccccccc-0000-4000-8000-000000000001",
"assignee_user_ids": null,
"assignment_mode": "auto_round_robin"
}
}Answers: 200 · 204 · 400 · 401 · 403 · 404 · 409 · 429