Saltar a contenido

Admin

Endpoints administrativos. Solo accesibles con el admin token.

Endpoints

GET /admin/clients/:clientName

Información completa de un cliente: OAuth, API key, tokens.

curl https://api.example.com/admin/clients/mi-cliente \
  -H "x-api-token: ADMIN_TOKEN"
{
  "oauth": {
    "authenticated": true,
    "mp_user_id": 241983636,
    "live_mode": true,
    "expires_at": "2025-08-10T14:26:42.000Z",
    "access_token": "APP_USR-...",
    "refresh_token": "TG-...",
    "public_key": "APP_USR-..."
  },
  "api_key": {
    "active": true,
    "key": "mk_a1b2c3...",
    "last_used_at": "2025-02-20T15:30:00.000Z"
  }
}

GET /admin/webhooks/logs

Últimos webhook logs recibidos.

Query parameters:

Param Tipo Default Descripción
limit number 50 Máximo resultados (1-200)
client string Filtrar por cliente

GET /admin/activity

Logs de auditoría de operaciones de escritura.

Query parameters:

Param Tipo Descripción
limit number Máximo resultados (1-200, default 50)
offset number Paginación
action string Filtrar por acción (ej: order.created)
resource_type string Filtrar por tipo (ej: order, store)
status enum success o failed
client string Filtrar por cliente
# Últimas 20 acciones fallidas
curl "https://api.example.com/admin/activity?status=failed&limit=20" \
  -H "x-api-token: ADMIN_TOKEN"
{
  "logs": [
    {
      "id": "uuid",
      "client_name": "mi-cliente",
      "ip_address": "190.123.45.67",
      "action": "order.created",
      "resource_type": "order",
      "resource_id": "550e8400-e29b-41d4...",
      "status": "success",
      "error_message": null,
      "metadata": {
        "mp_order_id": "ORD01...",
        "amount": "1500.50",
        "caja_id": "SUC001-POS001"
      },
      "duration_ms": 342,
      "created_at": "2025-02-20T15:30:00.000Z"
    }
  ],
  "total": 156
}

Acciones registradas:

Action Resource Type Descripción
order.created order Orden creada
order.canceled order Orden cancelada
order.refunded order Orden reembolsada
store.created store Sucursal creada
store.deleted store Sucursal eliminada
pos.created pos POS creado
pos.deleted pos POS eliminado
terminal.mode_changed terminal Modo operativo cambiado
api_key.created api_key API key creada
api_key.revoked api_key API key revocada
oauth.refreshed oauth Token renovado
oauth.logout oauth Sesión cerrada
order.simulated order Evento simulado (test)

POST /admin/orders/:idempotencyKey/simulate

Simula un evento de MercadoPago para testing. La orden pasa por at_terminal antes de alcanzar el estado final.

Solo sandbox

Este endpoint solo funciona con tokens de test de MercadoPago.

Query: ?client=mi-cliente

Body:

Campo Tipo Requerido Descripción
status enum processed, canceled, expired, failed, refunded, action_required
payment_method_type enum debit_card, credit_card, qr
installments number Cuotas (solo credit_card)
payment_method_id enum visa, master, amex, etc.
status_detail enum accredited, insufficient_amount, etc.
curl -X POST "https://api.example.com/admin/orders/simulate/550e8400?client=mi-cliente" \
  -H "Content-Type: application/json" \
  -H "x-api-token: ADMIN_TOKEN" \
  -d '{
    "status": "processed",
    "payment_method_type": "credit_card",
    "installments": 1,
    "payment_method_id": "visa",
    "status_detail": "accredited"
  }'
curl -X POST "https://api.example.com/admin/orders/simulate/550e8400?client=mi-cliente" \
  -H "Content-Type: application/json" \
  -H "x-api-token: ADMIN_TOKEN" \
  -d '{
    "status": "failed",
    "payment_method_type": "debit_card",
    "payment_method_id": "debvisa",
    "status_detail": "insufficient_amount"
  }'

Tiempos

El cambio de estado tarda hasta 10 segundos (o 40 segundos para action_required).