Recibir correos: Reglas

Obtener regla

Una regla con sus condiciones, excepciones y acciones.

POSThttps://g.sendcorex.com/v1command: get_rule

Argumentos

  • idstringobligatorio

    El rule_id.

Inicio rápido

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1',
  {
    commands: [
      {
        command: "get_rule",
        args: {
          id: "Vj0xUlVMRTAx"
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);

Respuesta

{
  "type": "SUCCESS",
  "results": [
    {
      "command": "get_rule",
      "id": "0",
      "type": "SUCCESS",
      "data": {
        "id": "Vj0xUlVMRTAx",
        "rule_id": "Vj0xUlVMRTAx",
        "name": "Clients always in Inbox",
        "match": "all",
        "conditions": [
          {
            "field": "from_domain",
            "op": "in_list",
            "value": "acme.com, globex.com"
          },
          {
            "field": "provider",
            "op": "is_any_of",
            "value": [
              "microsoft_365",
              "google_workspace"
            ]
          }
        ],
        "except": [
          {
            "field": "subject",
            "op": "contains",
            "value": "newsletter"
          }
        ],
        "actions": [
          {
            "type": "keep_inbox"
          },
          {
            "type": "label",
            "value": "Clients"
          },
          {
            "type": "star"
          }
        ],
        "stop": false,
        "timezone": "Asia/Kuala_Lumpur",
        "enabled": true,
        "position": 0,
        "hits": 128,
        "last_hit_at": "2026-10-25T09:12:44Z",
        "created_at": "2026-10-01T02:00:00Z",
        "updated_at": "2026-10-20T08:30:00Z"
      }
    }
  ]
}

Errores

Los errores a nivel HTTP devuelven type, code y message. Los errores marcados con CMD vuelven dentro del resultado del comando, con HTTP 200.

  • 401TOKEN_EXPIRED

    El access token expiró. Llama a Refresh Token y repite la solicitud.

  • 401INVALID_TOKEN

    El token está mal formado, es desconocido o fue revocado.

  • 429RATE_LIMITED

    Más de 15 solicitudes/s o 15 en curso para la misma IP + buzón. Espera la cantidad de segundos indicada en Retry-After.

  • CMDINVALID_ARGS

    Falta un argumento obligatorio o no es válido.

  • CMDNOT_FOUND

    El mensaje, la conversación o la carpeta no existe para este token.

  • CMDINTERNAL

    Error del servidor. El detalle solo se escribe en el log del servidor.