PatoCard

Your system, connected to your loyalty cards

Sign up customers, record visits and redeem rewards from your booking system or your point of sale. Every visit reaches the customer's phone, in their Apple Wallet or Google Wallet, in seconds.

A customer came to class
curl -X POST https://patocard.com/api/v1/tarjetas/$TARJETA/visitas \
  -H "Authorization: Bearer $PATOCARD_LLAVE" \
  -H "Idempotency-Key: $(uuidgen)"

201 "saldo": 7, "meta": 10

And on your customer's phone, their card already says 7 of 10.

Get started in three steps

  1. 1

    Create a key

    In your dashboard: Ajustes → Integraciones (Settings → Integrations; the dashboard is in Spanish for now). Pick «solo leer» (read only) if your system just looks things up, or «leer y escribir» (read and write) if it will sign up customers or record visits. The REST API comes with the Max plan.

  2. 2

    Keep it secret

    It's shown only once. It goes on your system's server, never in an app or a web page. One key per system: if you stop using one, revoke its key and the others keep working.

  3. 3

    Test it

    Call /yo with your key. If it answers with your business's name, you're all set.

curl https://patocard.com/api/v1/yo \
  -H "Authorization: Bearer $PATOCARD_LLAVE"

API rules

One key, one business

Each call's business comes from the key, not from the URL. Anything belonging to another business answers 404, same as what doesn't exist.

A retry doesn't give two stamps

Send a unique Idempotency-Key with every write and repeat it when retrying. For 24 hours we return the original response, with the Idempotency-Replayed header, without repeating the operation.

The same rules as the counter

A visit through the API goes through the program's promotions, referrals, tiers and daily cap. The API can't skip the cap.

Clear data

JSON with Spanish field names in camelCase (see the glossary below), ISO 8601 dates in UTC and uuid ids. A card's id is the same thing its QR holds. Everything is logged in the business's activity with origin «api».

The field names, in English

The API speaks Spanish: paths, fields and error codes are the contract and they don't change. This is what they mean.

cliente / clientescustomer(s)
tarjeta / tarjetascard(s)
programa / programasloyalty program(s)
nombre, telefononame, phone
fechaNacimientobirth date
saldo, metabalance, goal
sellos, visitasstamps, visits
premio / premiosDisponiblesreward / available rewards
canjeredemption
nivel, vencetier, expires
alta, notificarsign-up, notify
instaladainstalled in a wallet
refExternathe customer's id in your system
mensajes, titulo, cuerpomessages, title, body
codigo, mensaje, detalle, motivocode, message, detail, reason
lectura / escrituraread / write (key scope)

When something goes wrong

Always the same shape. Program against codigo, which never changes; mensaje is for people (and it's in Spanish).

{
  "error": {
    "codigo": "conflicto",
    "mensaje": "Ya llegó al límite de sellos de hoy",
    "detalle": {
      "motivo": "limite_diario"
    }
  }
}
CodeHTTPWhen
invalido400The body or the parameters fail validation.
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.
alcance_insuficiente403The key is read-only.
no_encontrado404It doesn't exist at this business (another business's data is also a 404).
conflicto409It clashes with the current state; detalle.motivo says why.
limite429Too many calls with this key: 3,000 reads or 600 writes per hour, and 60 sign-ups with notificar per hour. Retry-After says how long to wait.

Read

Read programs, customers and cards. A read-only key is enough.

Test your key

GET/api/v1/yo

Which business and which key these are. It's the first call when integrating: if it answers, the key and the plan are fine.

A read-only key is enough.

Request
curl https://patocard.com/api/v1/yo \
  -H "Authorization: Bearer $PATOCARD_LLAVE"
Response 200: The business and the key (never the full key).
{
  "negocio": {
    "nombre": "Ila Hot Room",
    "slug": "ila"
  },
  "llave": {
    "nombre": "Ollynk",
    "prefijo": "pc_live_hLBzJM",
    "alcance": "escritura"
  }
}
Possible errors (2)
CodeHTTPWhen
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.

List programs

GET/api/v1/programas

The business's active programs. You need the id of one to sign up a customer. mecanica is sellos (stamps add up) or multipase (a class pack that counts down). urlAlta is the program's sign-up link (the one behind the counter QR): send it to a customer and the card installs itself. niveles (null if the program has none) holds the ladder with each tier's clave, and origen says who decides it: automatico (visits), manual (the business) or externo (your system, with PUT /clientes/{ref}/nivel).

A read-only key is enough.

Request
curl https://patocard.com/api/v1/programas \
  -H "Authorization: Bearer $PATOCARD_LLAVE"
Response 200: The programs, oldest first.
{
  "programas": [
    {
      "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
      "nombre": "Clases",
      "slug": "sellos",
      "mecanica": "sellos",
      "meta": 10,
      "premio": "1 clase gratis",
      "urlAlta": "https://patocard.com/alta/estudio/sellos",
      "niveles": {
        "origen": "externo",
        "escalera": [
          {
            "clave": "member",
            "nombre": "Member"
          },
          {
            "clave": "vip_heat",
            "nombre": "VIP Heat Member"
          }
        ]
      }
    }
  ]
}
Possible errors (2)
CodeHTTPWhen
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.

Search customers

GET/api/v1/clientes

Searches by identity: phone, email or refExterna —the customer's id in your system— (at least one). Phones are compared by their last 10 digits, so +52 55 1234 5678, (55) 1234-5678 and 5512345678 find the same customer. There's no search by name, on purpose. 20 results max.

A read-only key is enough.

ParameterInWhat it is
telefonoqueryPhone, in any format.
emailqueryEmail; case-insensitive.
refExternaqueryThe customer's id in your system (the one you sent in PUT /clientes/{ref}/nivel).
Request
curl https://patocard.com/api/v1/clientes?telefono=5512345678 \
  -H "Authorization: Bearer $PATOCARD_LLAVE"
Response 200: The matching customers, with their cards.
{
  "clientes": [
    {
      "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
      "refExterna": null,
      "nombre": "Ana López",
      "telefono": "5512345678",
      "email": "ana@ejemplo.com",
      "fechaNacimiento": "1990-04-12",
      "creadoEn": "2026-10-18T16:32:32.000Z",
      "tarjetas": [
        {
          "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
          "programa": {
            "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
            "nombre": "Clases",
            "mecanica": "sellos"
          },
          "activa": true,
          "saldo": 7,
          "meta": 10,
          "premiosDisponibles": [],
          "nivel": null,
          "instalada": true,
          "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
          "creadaEn": "2026-10-18T16:32:32.000Z"
        }
      ]
    }
  ]
}
Possible errors (3)
CodeHTTPWhen
invalido400None of telefono, email or refExterna was sent.
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.

Get a customer

GET/api/v1/clientes/{id}

The customer with all their cards at the business.

A read-only key is enough.

ParameterInWhat it is
id*pathThe customer's id.
Request
curl https://patocard.com/api/v1/clientes/39a8da8f-2a37-4a83-a105-b18d4f8110b5 \
  -H "Authorization: Bearer $PATOCARD_LLAVE"
Response 200: The customer.
{
  "cliente": {
    "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
    "refExterna": null,
    "nombre": "Ana López",
    "telefono": "5512345678",
    "email": "ana@ejemplo.com",
    "fechaNacimiento": "1990-04-12",
    "creadoEn": "2026-10-18T16:32:32.000Z",
    "tarjetas": [
      {
        "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
        "programa": {
          "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
          "nombre": "Clases",
          "mecanica": "sellos"
        },
        "activa": true,
        "saldo": 7,
        "meta": 10,
        "premiosDisponibles": [],
        "nivel": null,
        "instalada": true,
        "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
        "creadaEn": "2026-10-18T16:32:32.000Z"
      }
    ]
  }
}
Possible errors (3)
CodeHTTPWhen
no_encontrado404It doesn't exist at this business.
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.

Get a card

GET/api/v1/tarjetas/{id}

Balance, goal, available rewards, tier, whether the customer already added it to their wallet, and url: the link the customer opens or installs it with. saldo is stamps in a stamp program and classes left in a pack.

A read-only key is enough.

ParameterInWhat it is
id*pathThe card's id (it's also what its QR contains).
Request
curl https://patocard.com/api/v1/tarjetas/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec \
  -H "Authorization: Bearer $PATOCARD_LLAVE"
Response 200: The card.
{
  "tarjeta": {
    "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
    "programa": {
      "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
      "nombre": "Clases",
      "mecanica": "sellos"
    },
    "activa": true,
    "saldo": 7,
    "meta": 10,
    "premiosDisponibles": [],
    "nivel": null,
    "instalada": true,
    "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
    "creadaEn": "2026-10-18T16:32:32.000Z",
    "cliente": {
      "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
      "nombre": "Ana López"
    }
  }
}
Possible errors (3)
CodeHTTPWhen
no_encontrado404It doesn't exist at this business.
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.

Make changes

Sign up, record visits and redeem. They need a read-write key.

Sign up a customer

POST/api/v1/clientes

Creates the customer and their card in a program. If they already had a card in that program, it's handed back (200, reentrega: true) instead of duplicated. By default the customer isn't notified: with notificar: true they get the welcome email (or, if they already had it, their card's link), and notificacion says whether it went out. To send them the card through another channel, use tarjeta.url.

Needs a read-write key. Accepts Idempotency-Key.

FieldTypeWhat it is
programaId*uuidThe program (from GET /programas).
nombre*string2 to 120 characters.
telefono*string10 digits, in any format.
emailstringFor the welcome email.
fechaNacimientodateYYYY-MM-DD, for the birthday greeting.
notificarbooleanNotify the customer. Default false.
Request
curl -X POST https://patocard.com/api/v1/clientes \
  -H "Authorization: Bearer $PATOCARD_LLAVE" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"programaId":"6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5","nombre":"Ana López","telefono":"+52 55 1234 5678","email":"ana@ejemplo.com","notificar":true}'
Response 201: Created (`201`) or handed back (`200`).
{
  "reentrega": false,
  "cliente": {
    "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
    "refExterna": null,
    "nombre": "Ana López",
    "telefono": "5512345678",
    "email": "ana@ejemplo.com",
    "fechaNacimiento": "1990-04-12",
    "creadoEn": "2026-10-18T16:32:32.000Z",
    "tarjetas": [
      {
        "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
        "programa": {
          "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
          "nombre": "Clases",
          "mecanica": "sellos"
        },
        "activa": true,
        "saldo": 0,
        "meta": 10,
        "premiosDisponibles": [],
        "nivel": null,
        "instalada": false,
        "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
        "creadaEn": "2026-10-18T16:32:32.000Z"
      }
    ]
  },
  "tarjeta": {
    "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
    "programa": {
      "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
      "nombre": "Clases",
      "mecanica": "sellos"
    },
    "activa": true,
    "saldo": 0,
    "meta": 10,
    "premiosDisponibles": [],
    "nivel": null,
    "instalada": false,
    "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
    "creadaEn": "2026-10-18T16:32:32.000Z",
    "cliente": {
      "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
      "nombre": "Ana López"
    }
  },
  "notificacion": {
    "tipo": "bienvenida",
    "enviada": true
  }
}
Possible errors (7)
CodeHTTPWhen
invalido400A field fails validation (detalle.campo says which).
no_encontrado404The program doesn't belong to this business.
conflicto409The program is inactive.
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.
alcance_insuficiente403The key is read-only.
cuenta_pausada402The business's account is paused (the trial ended or a charge failed). Nothing is deleted.

Record a visit

POST/api/v1/tarjetas/{id}/visitas

The customer came in. In a stamp program it adds one —with the program's promotions, referrals and daily cap, just like the counter scanner—; in a pack it takes off one class. The daily cap can't be skipped through the API. If this visit completes the goal, premiosGanados says so.

Needs a read-write key. Accepts Idempotency-Key.

ParameterInWhat it is
id*pathThe card's id.
Request
curl -X POST https://patocard.com/api/v1/tarjetas/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec/visitas \
  -H "Authorization: Bearer $PATOCARD_LLAVE" \
  -H "Idempotency-Key: $(uuidgen)"
Response 201: The card, already updated.
{
  "tarjeta": {
    "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
    "programa": {
      "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
      "nombre": "Clases",
      "mecanica": "sellos"
    },
    "activa": true,
    "saldo": 0,
    "meta": 10,
    "premiosDisponibles": [
      {
        "id": "a80709d3-3773-4ae5-8dc0-a193dc47e14a",
        "descripcion": "1 clase gratis",
        "venceEn": null
      }
    ],
    "nivel": null,
    "instalada": true,
    "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
    "creadaEn": "2026-10-18T16:32:32.000Z",
    "cliente": {
      "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
      "nombre": "Ana López"
    }
  },
  "premiosGanados": [
    "1 clase gratis"
  ],
  "promocion": null,
  "subioNivel": null
}
Possible errors (6)
CodeHTTPWhen
no_encontrado404The card doesn't belong to this business.
conflicto409detalle.motivo: limite_diario (hit today's cap), sin_saldo (pack used up), tarjeta_inactiva…
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.
alcance_insuficiente403The key is read-only.
cuenta_pausada402The business's account is paused (the trial ended or a charge failed). Nothing is deleted.

Redeem a reward

POST/api/v1/premios/{id}/canje

Marks an available reward as redeemed. The id comes from tarjeta.premiosDisponibles.

Needs a read-write key. Accepts Idempotency-Key.

ParameterInWhat it is
id*pathThe reward's id.
Request
curl -X POST https://patocard.com/api/v1/premios/a80709d3-3773-4ae5-8dc0-a193dc47e14a/canje \
  -H "Authorization: Bearer $PATOCARD_LLAVE" \
  -H "Idempotency-Key: $(uuidgen)"
Response 200: The redeemed reward and the card.
{
  "premio": {
    "id": "a80709d3-3773-4ae5-8dc0-a193dc47e14a",
    "descripcion": "1 clase gratis",
    "canjeadoEn": "2026-10-18T17:01:00.000Z"
  },
  "tarjeta": {
    "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
    "programa": {
      "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
      "nombre": "Clases",
      "mecanica": "sellos"
    },
    "activa": true,
    "saldo": 0,
    "meta": 10,
    "premiosDisponibles": [],
    "nivel": null,
    "instalada": true,
    "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
    "creadaEn": "2026-10-18T16:32:32.000Z",
    "cliente": {
      "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
      "nombre": "Ana López"
    }
  }
}
Possible errors (6)
CodeHTTPWhen
no_encontrado404The reward doesn't belong to this business.
conflicto409detalle.motivo: premio_ya_canjeado or premio_vencido.
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.
alcance_insuficiente403The key is read-only.
cuenta_pausada402The business's account is paused (the trial ended or a charge failed). Nothing is deleted.

Send the customer a message

POST/api/v1/tarjetas/{id}/mensajes

A notification to the customer's phone: it rings on the lock screen and stays written on the card, in Apple and Google Wallet. It's for what your system knows and PatoCard doesn't: “your class is tomorrow at 7”, “you have 2 classes left”. It accepts the panel's placeholders: {cliente}, {sellos}, {meta}, {faltan}, {premio}, {nivel}. Apple shows the cuerpo; Google shows titulo and cuerpo. Cap: 3 messages per card every 24 hours, counting the business's automatic ones (it's Google's limit, and we apply it on Apple too so we don't pester). The card must be installed (instalada: true). Requires a plan that includes card messages. It shows up in the panel's history as sent by the API.

Needs a read-write key. Accepts Idempotency-Key.

ParameterInWhat it is
id*pathThe card's id.
FieldTypeWhat it is
titulo*string2 to 40 characters. Google shows it.
cuerpo*string4 to 180 characters, with optional placeholders.
Request
curl -X POST https://patocard.com/api/v1/tarjetas/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec/mensajes \
  -H "Authorization: Bearer $PATOCARD_LLAVE" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"titulo":"Ila Hot Room","cuerpo":"{cliente}, tu clase de Hot Pilates es mañana a las 7:00. ¡Te esperamos!"}'
Response 201: Delivered. `entrega` says which wallet it went through.
{
  "mensaje": {
    "id": "5b1e0c2a-8d4f-4e7a-9c3b-2f6a1d8e4c70",
    "titulo": "Ila Hot Room",
    "cuerpo": "Ana López, tu clase de Hot Pilates es mañana a las 7:00. ¡Te esperamos!"
  },
  "entrega": {
    "apple": true,
    "google": false
  },
  "avisosRestantesHoy": 2,
  "tarjetaId": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec"
}
Possible errors (9)
CodeHTTPWhen
invalido400titulo or cuerpo out of range (detalle.campo).
plan_no_incluye403The business's plan doesn't include card messages.
no_encontrado404The card doesn't belong to this business.
conflicto409detalle.motivo: sin_pase (it's not in their wallet: send them tarjeta.url), cuota_del_pase (already got 3 messages in 24 h), no_entregado (no phone has it anymore), tarjeta_inactiva.
limite429More than 60 messages in an hour with the same key.
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.
alcance_insuficiente403The key is read-only.
cuenta_pausada402The business's account is paused (the trial ended or a charge failed). Nothing is deleted.

Set the tier from your system

PUT/api/v1/clientes/{id}/nivel

For when your software (bookings, gym) sells and cancels the membership: you say which tier each customer has and their card changes design on its own in Apple and Google Wallet. The program must have its tier in the hands of «Tu sistema» (Your system; Ajustes → Programas → Niveles in the panel); the keys come from GET /programas. Creates and updates: if PatoCard doesn't know the customer and you send cliente, it signs them up (201) and from then on recognizes them by your {id}; if they already existed with that phone, it links them to your {id}. It's a true PUT: sending the same thing twice doesn't cause a second change, push or webhook. With vence, once that day passes (in the business's time zone) the card loses the tier on its own; renewing is sending it again with another date. When moving up, the customer gets the tier greeting if the business has it on, and your webhooks get nivel.cambio.

Needs a read-write key. Accepts Idempotency-Key.

ParameterInWhat it is
id*pathThe customer's id in YOUR system (up to 100 characters). It also accepts the PatoCard id.
FieldTypeWhat it is
nivel*stringThe tier's clave, or null to remove it (the membership was cancelled).
vencedateYYYY-MM-DD, the last valid day. Without it, the tier doesn't expire.
programaIduuidOnly if the business has more than one program with its tier set by «Tu sistema».
clienteobject{ nombre, telefono, email? } to sign them up if PatoCard doesn't know them. Without it, an unknown customer is a 404.
Request
curl -X PUT https://patocard.com/api/v1/clientes/OLY-48213/nivel \
  -H "Authorization: Bearer $PATOCARD_LLAVE" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"nivel":"vip_heat","vence":"2026-11-30","cliente":{"nombre":"Ana López","telefono":"+52 55 1234 5678"}}'
Response 200: Updated (`200`) or customer signed up (`201`). `cambio` is null if they already had that tier.
{
  "clienteCreado": false,
  "cambio": {
    "de": "member",
    "a": "vip_heat",
    "subio": true
  },
  "cliente": {
    "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
    "refExterna": "OLY-48213",
    "nombre": "Ana López",
    "telefono": "5512345678",
    "email": "ana@ejemplo.com",
    "fechaNacimiento": "1990-04-12",
    "creadoEn": "2026-10-18T16:32:32.000Z",
    "tarjetas": [
      {
        "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
        "programa": {
          "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
          "nombre": "Clases",
          "mecanica": "sellos"
        },
        "activa": true,
        "saldo": 7,
        "meta": 10,
        "premiosDisponibles": [],
        "nivel": {
          "clave": "vip_heat",
          "nombre": "VIP Heat Member",
          "vence": "2026-12-01T06:00:00.000Z"
        },
        "instalada": true,
        "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
        "creadaEn": "2026-10-18T16:32:32.000Z"
      }
    ]
  },
  "tarjeta": {
    "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
    "programa": {
      "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
      "nombre": "Clases",
      "mecanica": "sellos"
    },
    "activa": true,
    "saldo": 7,
    "meta": 10,
    "premiosDisponibles": [],
    "nivel": {
      "clave": "vip_heat",
      "nombre": "VIP Heat Member",
      "vence": "2026-12-01T06:00:00.000Z"
    },
    "instalada": true,
    "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
    "creadaEn": "2026-10-18T16:32:32.000Z",
    "cliente": {
      "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
      "nombre": "Ana López"
    }
  }
}
Possible errors (7)
CodeHTTPWhen
invalido400A field fails validation (detalle.campo). A nivel that doesn't exist brings detalle.validos with the right keys; several programs with an external tier and no programaId brings detalle.programas.
no_encontrado404The customer doesn't exist and you didn't send cliente; or the program doesn't belong to this business.
conflicto409detalle.motivo: origen_no_externo (that program's tier isn't decided by your system), telefono_de_otra_ref (that phone is already linked to another {id} of yours), tarjeta_inactiva, en_proceso.
no_autenticado401No key, malformed, nonexistent or revoked.
plan_no_incluye403The business's plan doesn't include the REST API.
alcance_insuficiente403The key is read-only.
cuenta_pausada402The business's account is paused (the trial ended or a charge failed). Nothing is deleted.

AI assistants (MCP)

Connect Claude, ChatGPT or your own agent to your loyalty program and ask it anything: “how many active customers do I have this month?”, “how many stamps does 55 1234 5678 have?”. It's a remote MCP server, on every plan. When you connect it you choose whether the agent only sees your program or also operates: signing up customers, giving stamps, redeeming rewards, designing cards and preparing campaigns that you approve. More about the MCP.

ToolWhat it doesArguments
mi_negocioWhich business the key belongs to, its scope, and the programs with goals and rewards. The first one an agent calls.—
onboardingThe 7 steps to get the business's card ready: which are done, which comes next and what the owner does in person, with the link to their dashboard.—
programasThe loyalty programs: mechanic, stamp goal, reward and sign-up link.—
buscar_clienteCustomers by phone or email, with their cards and balances. No search by name.telefono or email
clienteA customer by id, with their cards.id
tarjetaA card by id: balance, pending rewards, whether it's in Wallet, and latest visits.id
estadisticasThe numbers for 7, 30 or 90 days: active customers, stamps, rewards, by program, and who comes most.dias: 7 | 30 | 90
vista_tarjetaAn image of how the card looks; accepts a trial design without saving it, and the empty, halfway and full states.programaId, sellos?, estados?, …design
listar_imagenesThe images the business already has (logos, backgrounds, stamps), with their id to reuse them.tipo?
guia_disenoRecommended sizes and ratios for each image, the iOS 27 poster zones, and tips.—
liga_subidaA single-use link (30 min) for the owner to upload a photo from their phone. Requires permission to operate.tipo
ver_subidaIf the owner already uploaded the photo, the image's id.subidaId
subir_imagenSaves a base64 image (up to ~3 MB, it's shrunk automatically). Requires permission to operate.tipo, base64, nombre?
historial_disenoPrevious versions of a program's name, reward and design.programaId
revertir_disenoTakes a program back to an earlier version (and it can be undone). Requires permission to operate.programaId, versionId
liga_altaA program's sign-up link, with its QR as an image.programaId
crear_programaCreates a stamp card with its design: classic or iOS 27 poster, colors, the stamp's emoji and shape, background and logo from a URL, vocabulary and back-of-card texts. Requires permission to operate.nombre, meta, premio, maxSellosDia?, estilo?, colores?, emoji?, fondoUrl?, logoUrl?, …
editar_programaChanges a card's name, reward or design (whatever you send). The goal and daily cap stay in the panel. Requires permission to operate.programaId, …
alta_clienteSigns up a customer and returns their card's link. Requires permission to operate.programaId, nombre, telefono, email?, notificar?
dar_selloRecords a visit, with the business's caps. Requires permission to operate.tarjetaId
canjear_premioMarks a reward as handed over. Requires permission to operate.premioId
pedir_campanaPrepares a message to a segment of customers; it stays pending until the owner approves it in the panel.programaId, segmento, umbral?, titulo, cuerpo
crear_negocioNo account: builds a DRAFT business with its card and returns the image, a token to adjust it, and the link for the owner to claim it (expires in 72 h).negocio, giro, ciudad?, premio, meta?, …design
editar_borradorNo account: changes the draft (name, card and design).borrador, …
vista_borradorNo account: image of the draft; tries changes without saving them.borrador, estados?, …design
estado_borradorNo account: whether it was claimed and how long until it expires; can reissue the link.borrador, reponerLiga?
liga_subida_borradorNo account: a link for the owner to upload a photo to the draft.borrador, tipo
ver_subida_borradorNo account: the id of the photo the owner uploaded.borrador, subidaId
claude.ai and Claude Desktop (no setup)
  1. Settings → Connectors → Add custom connector.
  2. Paste the URL https://patocard.com/api/mcp and connect.
  3. A PatoCard screen opens: log in with your account (Google, Face ID or a link to your email) and approve the connection. No key to copy.
Claude Code (one line)
claude mcp add --transport http patocard https://patocard.com/api/mcp --header "Authorization: Bearer pc_live_TU_LLAVE"
claude.ai, Claude Desktop, Cursor and others (remote MCP)
{
  "mcpServers": {
    "patocard": {
      "url": "https://patocard.com/api/mcp",
      "headers": {
        "Authorization": "Bearer pc_live_TU_LLAVE"
      }
    }
  }
}
Clients that only speak stdio (via mcp-remote)
{
  "mcpServers": {
    "patocard": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://patocard.com/api/mcp",
        "--header",
        "Authorization: Bearer pc_live_TU_LLAVE"
      ]
    }
  }
}
  • The URL is https://patocard.com/api/mcp. With a key (Claude Code, Cursor), it goes in Authorization: Bearer: a read key so it only sees, a read-write key so it operates.
  • Every call counts against the same limits as the REST API (reads and writes).
  • The agent only sees your business; there's no search by name, same as the API.
  • Everything an agent does goes through the same rules as the scanner and the dashboard (daily caps, plan, paused account) and is logged in the customer's history as «Un agente de IA» (an AI agent). Nothing deletes.
  • It only prepares campaigns to your customers: none goes out until you approve it in Ajustes → Notificaciones (Settings → Notifications).
  • To design, the agent tries every change without saving it, shows it to you and keeps a history to go back to an earlier version. The recommended size of each photo is in the design guide.

Webhooks

With webhooks, PatoCard tells your server as soon as something happens, without you having to ask. It works with everything: the counter scanner, QR sign-up, the dashboard and the API.

  1. 1

    Add your URL

    In Ajustes → Integraciones → Webhooks (Settings → Integrations): an https address on your server and which events you want. We give you a signing secret, only once.

  2. 2

    Answer 2xx

    Each event is a POST with JSON. Answer any 2xx in under 10 seconds. If not, we retry several times over about an hour and a half.

  3. 3

    Verify the signature

    Compute the HMAC with your secret and compare it with PatoCard-Firma. That's how you know the event comes from us and not someone else.

EventNameWhen it arrives
cliente.altaNew customerSomeone got their card: through the counter QR, a link, the API or an import.
sello.registradoStampA visit added stamps in a stamp program.
visita.registradaClass usedA visit took one class off a pack.
paquete.cargadoPack loadedClasses were loaded onto a pack (the customer bought).
premio.ganadoReward earnedThe customer completed the goal and has a reward to redeem.
premio.canjeadoReward redeemedA reward was redeemed.
nivel.cambioTier changeThe customer moved up or down a tier.
What your server receives (sello.registrado)
{
  "id": "518d8b02-89d1-4245-aeff-70386669a2cc",
  "tipo": "sello.registrado",
  "creadoEn": "2026-10-18T17:01:00.000Z",
  "negocio": {
    "slug": "ila"
  },
  "datos": {
    "tarjeta": {
      "id": "9fb2d02a-2e2f-4567-bd89-e197dc29c0ec",
      "programa": {
        "id": "6c1d2e3f-4a5b-4c6d-8e7f-90a1b2c3d4e5",
        "nombre": "Clases",
        "mecanica": "sellos"
      },
      "activa": true,
      "saldo": 8,
      "meta": 10,
      "premiosDisponibles": [],
      "nivel": null,
      "instalada": true,
      "url": "https://patocard.com/tarjeta/9fb2d02a-2e2f-4567-bd89-e197dc29c0ec?t=…",
      "creadaEn": "2026-10-18T16:32:32.000Z",
      "cliente": {
        "id": "39a8da8f-2a37-4a83-a105-b18d4f8110b5",
        "nombre": "Ana López"
      }
    },
    "cantidad": 1,
    "origen": "escaner"
  }
}
Verify the signature (Node)
import { createHmac, timingSafeEqual } from "node:crypto";

// cuerpo: el texto CRUDO del request, antes de parsear el JSON.
export function avisoValido(cuerpo, firma, secreto) {
  const { t, v1 } = Object.fromEntries(firma.split(",").map((p) => p.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false; // más de 5 min
  const esperada = createHmac("sha256", secreto).update(`${t}.${cuerpo}`).digest("hex");
  return v1?.length === esperada.length && timingSafeEqual(Buffer.from(v1), Buffer.from(esperada));
}
HeaderExampleWhat for
PatoCard-Eventosello.registradoThe kind of event (sello.registrado…), or ping for the panel's test.
PatoCard-Entrega518d8b02-…The event id. It doesn't change between retries: use it to avoid processing the same event twice.
PatoCard-Firmat=1760806860,v1=5f2c…t=<unix>,v1=<firma>: HMAC-SHA256 of <t>.<cuerpo> with your secret. Reject it if it doesn't match or if t is more than 5 minutes old.
  • datos.tarjeta holds the card as it is when sent, with the same shape as GET /tarjetas/{id}. Reward events also bring datos.premio, and tier changes, datos.nivel.
  • The same event can arrive twice (because of a retry). Deduplicate by PatoCard-Entrega.
  • If your server fails 50 times in a row, we pause the webhook and tell you in the dashboard; you resume it with one click once it's fixed.
  • They come with the Max plan, with the REST API.