VitrinaAPI

Reglas de asignación

Enrutamiento ordenado, primera coincidencia gana, hacia un equipo o un pool de agentes.

Beta
Puede cambiar en cualquier momento, con una entrada en el changelog y aviso a quienes la llamaron recientemente — ver versionado.

Descarga la proyección completa de la API pública: openapi.json.

Automatizar respuestas y asignaciones explica este recurso en prosa, con ejemplos ejecutables.

MétodoRutaQué hace
GET/assignment-rulesList assignment rules
POST/assignment-rulesCreate 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/orderReorder the assignment rules
GET/assignment-rules/portal-defaultsList 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"

Ejemplo de respuesta (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": [],
      "team_id": "cccccccc-0000-4000-8000-000000000001",
      "assignee_user_ids": null,
      "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": 1
  }
}

Responde: 200 · 400 · 401 · 403 · 404 · 409 · 429

POST /assignment-rules

Create an assignment rule

Exactly one destination: team_id OR a non-empty assignee_user_ids. Empty/absent match_sources / match_channels are wildcards. 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).

Cuerpo

CampoTipoObligatorioRestricciones
namestringmín. 1, máx. 200
enabledboolean
match_sourcesarray | null
match_channelsarray | null
team_idstring | null
assignee_user_idsarray | null
assignment_modeauto_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"
  }'

Ejemplo de respuesta (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": [],
    "team_id": "cccccccc-0000-4000-8000-000000000001",
    "assignee_user_ids": null,
    "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"
  }
}

Responde: 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.

ParámetroEnTipoObligatorioRestricciones
idpathuuid
curl -X DELETE https://api.vitrinadev.com/api/v1/assignment-rules/<id> \
  -H "Authorization: Bearer $VITRINA_KEY"

Responde: 204 · 400 · 401 · 403 · 404 · 409 · 429

GET /assignment-rules/{id}

Get an assignment rule

The rule, including its destination and its evaluation priority.

ParámetroEnTipoObligatorioRestricciones
idpathuuid
curl https://api.vitrinadev.com/api/v1/assignment-rules/<id> \
  -H "Authorization: Bearer $VITRINA_KEY"

Ejemplo de respuesta (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": [],
    "team_id": "cccccccc-0000-4000-8000-000000000001",
    "assignee_user_ids": null,
    "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"
  }
}

Responde: 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 — the destination stays exactly one thing. priority is not writable here; use PUT /assignment-rules/order.

ParámetroEnTipoObligatorioRestricciones
idpathuuid

Cuerpo

CampoTipoObligatorioRestricciones
namestringmín. 1, máx. 200
enabledboolean
match_sourcesarray | null
match_channelsarray | null
team_idstring | null
assignee_user_idsarray | null
assignment_modeauto_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
  }'

Ejemplo de respuesta (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": [],
    "team_id": "cccccccc-0000-4000-8000-000000000001",
    "assignee_user_ids": null,
    "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"
  }
}

Responde: 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.

Cuerpo

CampoTipoObligatorioRestricciones
idsuuid[]
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"
    ]
  }'

Ejemplo de respuesta (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": [],
      "team_id": "cccccccc-0000-4000-8000-000000000001",
      "assignee_user_ids": null,
      "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"
    }
  ]
}

Responde: 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"

Ejemplo de respuesta (200)

{
  "data": [
    {
      "source": "mercadolibre",
      "team_id": "cccccccc-0000-4000-8000-000000000001",
      "assignee_user_ids": null,
      "assignment_mode": "auto_round_robin"
    }
  ]
}

Responde: 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).

ParámetroEnTipoObligatorioRestricciones
sourcepathmercadolibre \yapo \chileautos

Cuerpo

CampoTipoObligatorioRestricciones
assignment_modeauto_round_robin \auto_round_robin_online \auto_least_busy \
team_idstring | null
assignee_user_idsarray | null
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"
  }'

Ejemplo de respuesta (200)

{
  "data": {
    "source": "mercadolibre",
    "team_id": "cccccccc-0000-4000-8000-000000000001",
    "assignee_user_ids": null,
    "assignment_mode": "auto_round_robin"
  }
}

Responde: 200 · 204 · 400 · 401 · 403 · 404 · 409 · 429

En esta página