# Self-invoicing

Receipts your buyers invoice themselves on the issuer's portal.

The guide, step by step: https://fiscalisto.com/en/docs/api/autofactura.md

## Endpoints

- [Record a receipt](https://fiscalisto.com/en/docs/api/referencia/autofactura/create-ticket.md): `POST /v1/tickets`
- [List receipts](https://fiscalisto.com/en/docs/api/referencia/autofactura/list-tickets.md): `GET /v1/tickets`
- [Get a receipt](https://fiscalisto.com/en/docs/api/referencia/autofactura/get-ticket.md): `GET /v1/tickets/{id}`
- [Cancel a receipt](https://fiscalisto.com/en/docs/api/referencia/autofactura/cancel-ticket.md): `DELETE /v1/tickets/{id}`
- [Get an issuer's self-invoicing portal](https://fiscalisto.com/en/docs/api/referencia/autofactura/get-self-invoicing.md): `GET /v1/issuers/{id}/self_invoicing`
- [Change the self-invoicing rules](https://fiscalisto.com/en/docs/api/referencia/autofactura/update-self-invoicing.md): `POST /v1/issuers/{id}/self_invoicing`

## The Ticket object

A sale your buyer can invoice themselves in the issuer's portal (self-invoicing).

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_). |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `object` | `"ticket"` | yes | What kind of object it is («invoice», «customer»…). |
| `issuer` | string | yes | The issuer that sold. |
| `folio` | string | yes | The sale's folio in your system. |
| `code` | string | yes | What your buyer types in the portal along with the total: the folio and 4 random characters (A123-K7QX). Print it on the ticket or send it with the purchase. |
| `status` | `pending`, `invoiced`, `global`, `cancelled` | yes | pending (can be invoiced), invoiced (your buyer invoiced it: the invoice in invoice), global (it went into the period's global invoice) or cancelled. |
| `url` | string or null | yes | The portal page with the ticket's code (c) and total (t): the portal finds it on its own and the buyer only gives their details. Anyone with the link can invoice the ticket: give it only to the buyer (like the printed ticket). You can embed it with fiscalisto.js. null if it is no longer pending. |
| `total` | number | yes | What was charged, taxes included and without tip. |
| `tip` | number | yes | The tip (it doesn't go on the invoice). |
| `payment_form` | string | yes | The sale's c_FormaPago. |
| `description` | string | yes | The invoice's line item (the first one, if it has several). |
| `product_key` | string | yes | The line item's c_ClaveProdServ (the first one, if it has several). |
| `lines` | array of object | yes | Its line items, in order: just one if it was recorded without lines. Each with its product (prd_… or null), description, SAT codes, IVA (null if not subject to tax), units and what was charged for it, taxes included. |
| `lines[].product` | string or null | yes | A product from your catalog (prd_…): takes its key, unit, price and taxes. |
| `lines[].description` | string | yes | Description. |
| `lines[].product_key` | string | yes | Product or service key (ClaveProdServ), 8 digits from c_ClaveProdServ. Look it up with GET /v1/sat_catalogs/product_keys?q=… |
| `lines[].unit_key` | string | yes | Unit key (ClaveUnidad) from c_ClaveUnidad: E48 service unit, H87 piece, ACT activity… By default H87 if the product key is for goods (segments 10 to 60) and E48 if it's for a service. |
| `lines[].iva` | string or null | yes | Transferred VAT rate: 0.16 (the default), 0.08 (border region), 0 or exento. |
| `lines[].local_taxes` | array of object | yes | Its local taxes (its product's or the ones you sent), included in its total. |
| `lines[].local_taxes[].retention` | boolean | yes | true if it's a local withholding; false if it's a transfer. |
| `lines[].local_taxes[].name` | string | yes | Name of the local tax (ImpLocTrasladado or ImpLocRetenido), like ISH. |
| `lines[].local_taxes[].rate` | number | yes | Rate in percent (TasadeTraslado or TasadeRetencion). |
| `lines[].ieps` | number or null | yes | Its IEPS (its product's or the one you sent), included in its total: a rate or, with `ieps_factor` `Cuota`, pesos per unit. `null`: no IEPS. |
| `lines[].ieps_factor` | `Tasa`, `Cuota` or null | yes | Tasa or Cuota (IEPS TipoFactor). |
| `lines[].detail` | string or null | yes | The detail you sent (nights, dates, reservation): it goes after the description on the invoice as the self-invoicing `invoice_concepts.line_detail` says. |
| `lines[].quantity` | number | yes | Quantity (Cantidad). 1 by default. |
| `lines[].total` | number | yes | Total in the receipt's currency (Total). |
| `sold_at` | string (date-time) | yes | When it was sold. |
| `invoiceable_until` | string | yes | The last day (YYYY-MM-DD) the buyer can invoice it; after that it goes into the global invoice. |
| `invoice` | string or null | yes | The invoice (inv_…) your buyer made, or null. |
| `global_invoice` | string or null | yes | The global invoice (inv_…) it went into, or null. |
| `invoiced_amount` | number | yes | What the invoices of a receipt split into several already cover (self-invoicing allows it with `split_max`), taxes included. 0 if it hasn't been split; a `pending` receipt above 0 has `total - invoiced_amount` left to invoice with the same code, and a split `invoiced` receipt has `invoice` null. |
| `customer` | object or null | yes | Who it was invoiced to, or null. |
| `customer.tax_id` | string | yes | RFC (Rfc), 12 characters for a persona moral and 13 for a persona física. |
| `customer.legal_name` | string or null | yes | Name or razón social exactly as on the constancia de situación fiscal, without the capital regime (without «S.A. de C.V.»). |
| `branch` | string or null | yes | The branch (brn_…) where the sale was made, or null (the Matriz). Its invoice is stamped from there and the portal shows its name and logo. |
| `buyer` | object or null | yes | Who paid, as the sale's source knows them (the `buyer` you sent, or the customer of a Stripe payment). It isn't the invoice's recipient (`customer`). |
| `buyer.name` | string or null | yes | Name. |
| `buyer.email` | string or null | yes | Email to send it to (several separated by commas). Only used if sending is requested. |
| `created_at` | string (date-time) or null | yes | When it was recorded. |

Example:

```json
{
  "id": "tkt_OufpKqnrvx9p6hW1yQbT3mZr8sKdLx0VeN",
  "object": "ticket",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "folio": "A1042",
  "code": "A1042-K7QX",
  "status": "pending",
  "url": "https://fiscalisto.com/autofactura/Tx8mQ2vLp9WnR4c?c=A1042-K7QX&t=580",
  "total": 580,
  "tip": 0,
  "payment_form": "04",
  "description": "Consumo de alimentos",
  "product_key": "90101501",
  "lines": [
    {
      "product": null,
      "description": "Consumo de alimentos",
      "product_key": "90101501",
      "unit_key": "E48",
      "iva": "0.16",
      "local_taxes": [],
      "ieps": null,
      "ieps_factor": null,
      "detail": null,
      "quantity": 1,
      "total": 580
    }
  ],
  "sold_at": "2026-10-24T14:32:00-06:00",
  "invoiceable_until": "2026-10-31",
  "invoice": null,
  "global_invoice": null,
  "invoiced_amount": 0,
  "customer": null,
  "branch": null,
  "buyer": {
    "name": "Laura Méndez",
    "email": "laura@example.com"
  },
  "created_at": "2026-10-24T14:32:05-06:00"
}
```

## The SelfInvoicing object

An issuer's self-invoicing portal and its rules.

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"self_invoicing"` | yes | What kind of object it is («invoice», «customer»…). |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `issuer` | string | yes | The issuer. |
| `portal_url` | string | yes | The issuer's permanent portal: there any buyer invoices with their code and total. |
| `window` | `month`, `days` | yes | month: it can be invoiced until the end of the sale's month. days: until window_days days after. |
| `window_days` | integer | yes | Days to invoice with window: days. (from -9007199254740991 to 9007199254740991) |
| `global_periodicity` | `01`, `02`, `03`, `04` | yes | How often the global invoice is stamped on its own with what nobody invoiced: 01 daily, 02 weekly, 03 biweekly, 04 monthly. |
| `global_invoice` | `auto`, `off` | yes | auto: tickets nobody invoiced go on their own to their period's global invoice. off: Fiscalisto doesn't make a global invoice for these tickets (you make it elsewhere). |
| `ask_total` | boolean | yes | Whether the portal asks for the total to find the ticket (true) or only its code (false). |
| `portal_title` | string or null | yes | The portal's title, or null for «Facture su ticket». |
| `portal_message` | string or null | yes | The message under the title, or null. |
| `code_hint` | string or null | yes | Where the buyer finds their code, under the field; null for Fiscalisto's text. |
| `portal_theme` | `auto`, `light`, `dark` | yes | auto: the theme of the buyer's device, which they can change. light or dark: always that one, on the portal page, its QRs and inside your site. |
| `portal_accent` | string or null | yes | The portal's button color («#rrggbb»), or null for Fiscalisto's. |
| `portal_radius` | integer or null | yes | The portal's corners in pixels (0 to 24), or null for Fiscalisto's. |
| `portal_style` | object | yes | How the portal looks besides its theme, color and corners (Autofactura › Cómo se ve el portal). |
| `portal_style.layout` | `checkout`, `compact`, `card` | yes | checkout: the invoice fills in next to the form. compact: only the form, the invoice collapsed. card: the form in a centered card. |
| `portal_style.density` | `comfortable`, `compact` | yes | comfortable or compact. |
| `portal_style.header` | `logo`, `name`, `name_rfc`, `logo_name` | yes | What the top says: name_rfc, name, logo_name or logo. |
| `portal_style.logo_size` | `s`, `m`, `l` | yes | The logo size: s, m or l. |
| `portal_style.logo_shape` | `square`, `rounded`, `circle` | yes | The logo shape: square, rounded or circle. |
| `portal_style.font` | string | yes | The font: system or one from Google Fonts. |
| `portal_style.heading_font` | string or null | yes | The headings font, or null for the same as the body text. |
| `portal_style.heading_size` | `s`, `m`, `l` | yes | The title size: s, m or l. |
| `portal_style.borders` | `none`, `subtle`, `strong` | yes | The borders: none, subtle or strong. |
| `portal_style.shadow` | `none`, `soft`, `strong` | yes | The shadow: none, soft or strong. |
| `portal_style.ways` | object | yes | The ways to give their details besides typing them. |
| `portal_style.ways.constancia` | boolean | yes | Upload the constancia (PDF). |
| `portal_style.ways.qr` | boolean | yes | Scan the constancia's QR. |
| `portal_style.ways.cif` | boolean | yes | Look up the details with RFC and idCIF. |
| `portal_style.ways.recall` | boolean | yes | «Ya le hemos facturado antes»: RFC and email. |
| `portal_style.ways.abroad` | boolean | yes | Invoice customers abroad. |
| `portal_style.ways.norfc` | boolean | yes | «No tengo RFC»: in the person's name, with XAXX010101000. |
| `portal_style.email_required` | boolean | yes | Whether invoicing without an email is not allowed. |
| `portal_style.show_deadline` | boolean | yes | Whether it says until when it can be invoiced. |
| `portal_style.back` | object or null | yes | The button at the end to go back to your site, or null. |
| `portal_style.back.label` | string | yes | The button's text. |
| `portal_style.back.url` | string | yes | Where it goes (https). |
| `portal_style.css` | string | yes | Your own CSS, already sanitized. |
| `portal_style.colors` | object | yes | The page colors; null uses the theme's. |
| `portal_style.colors.background` | string or null | yes | The page background, or null. |
| `portal_style.colors.card` | string or null | yes | The background of fields and cards, or null. |
| `portal_style.colors.text` | string or null | yes | The text, or null. |
| `portal_style.colors.button_text` | string or null | yes | The button text, or null. |
| `portal_style.noun` | `ticket`, `nota`, `cuenta`, `compra`, `pedido`, `orden`, `reservacion`, `estancia`, `boleto` | yes | What the portal calls what is invoiced («reservacion» in a hotel). |
| `portal_style.texts` | object | yes | Your own texts by key (step_ticket, submit, success_title, concepts_title…), each with es and en. A missing one uses Fiscalisto's. |
| `invoice_concepts` | object | yes | The line items of the invoice the buyer makes in the portal. |
| `invoice_concepts.mode` | `itemized`, `single`, `grouped` | yes | itemized: one line item per ticket line; single: just one; grouped: one per group in groups. Anything with another set of taxes (like a night with ISH) always goes in its own line item. |
| `invoice_concepts.customer_choice` | boolean | yes | Whether the buyer can choose in the portal among the customer_options. |
| `invoice_concepts.customer_options` | array of `itemized`, `single`, `grouped` | yes | The options the buyer sees when they can choose (always includes mode, which arrives selected). |
| `invoice_concepts.description` | string | yes | The single line item's description, like «Consumo». |
| `invoice_concepts.product_key` | string or null | yes | The single line item's ClaveProdServ, or null for the largest line's. |
| `invoice_concepts.unit_key` | string or null | yes | Its ClaveUnidad, or null for the largest line's. |
| `invoice_concepts.groups` | array of object | yes | The «Por categoría» groups, in order: each line goes in the first one that takes it. |
| `invoice_concepts.groups[].name` | string | yes | The line item's name, like «Alimentos y bebidas». |
| `invoice_concepts.groups[].product_key` | string or null | yes | Its ClaveProdServ, or null for the largest line in the group. |
| `invoice_concepts.groups[].unit_key` | string or null | yes | Its ClaveUnidad, or null for the largest line's. |
| `invoice_concepts.groups[].sat_keys` | array of string | yes | The SAT codes it takes, complete or their start (2 to 8 digits, like 9010). |
| `invoice_concepts.groups[].categories` | array of string | yes | The product categories it takes, by their path («Hotel › Habitaciones»); a category also takes the ones inside it. |
| `invoice_concepts.ungrouped` | `itemized`, `group` | yes | What no group takes: itemized, broken down; group, in one more line item called ungrouped_name. |
| `invoice_concepts.ungrouped_name` | string | yes | The line item name for what no group takes. |
| `invoice_concepts.line_detail` | `customer`, `always`, `never` | yes | What happens to each ticket line's detail: customer, the buyer sees the checkbox unticked and ticks it if they want it; always, it always goes after the description; never, it never goes. |
| `retention_mode` | `keep_total`, `subtract` | yes | When invoicing a persona moral that withholds (1.25% ISR in RESICO, or the product's). keep_total: the base grows and the invoice adds up to what was paid. subtract: the base is the ticket's and the total is what was paid minus the withholding. |
| `invoice_series` | string or null | yes | The series for invoices issued from the portal and from a ticket, like AF, or null for the issuer's invoice series. The global invoice doesn't use it. |
| `customer_notes` | boolean | yes | true: the portal asks the buyer for a note for their invoice's PDF (up to 500 characters). It only appears on the PDF, never in the XML. |
| `failure_email` | boolean | yes | true: when a buyer can't invoice because of something on the issuer's side, an email goes out; false: it only stays in Alertas. |
| `split_max` | integer | yes | The most invoices a receipt can have (splitting a receipt into several invoices), counting the one that takes all that's left; 0: it can't be split. (from -9007199254740991 to 9007199254740991) |
| `split_min` | number | yes | The least each invoice of a split receipt can be, taxes included; less can't be left to invoice either, except by the invoice that takes all that's left. |
| `split_same` | boolean | yes | true: a buyer can make several invoices with the same details at once (4 of 250 from a 1,000 receipt). |
| `global_concepts` | `ticket`, `summary` | yes | ticket: the global invoice carries one «Venta» line item per ticket, with its folio. summary: only the period's total amount, one per tax combination (NoIdentificacion «Resumen»), for a persona física in RESICO (rule 2.7.1.21 of the RMF 2026). |

Example:

```json
{
  "object": "self_invoicing",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "portal_url": "https://fiscalisto.com/autofactura/Tx8mQ2vLp9WnR4c",
  "window": "month",
  "window_days": 7,
  "global_periodicity": "04",
  "global_invoice": "auto",
  "ask_total": true,
  "portal_title": null,
  "portal_message": null,
  "code_hint": null,
  "portal_theme": "auto",
  "portal_accent": "#0b7c77",
  "portal_radius": null,
  "portal_style": {
    "layout": "checkout",
    "density": "comfortable",
    "header": "name_rfc",
    "logo_size": "m",
    "logo_shape": "rounded",
    "font": "system",
    "heading_font": null,
    "heading_size": "m",
    "borders": "subtle",
    "shadow": "soft",
    "ways": {
      "constancia": true,
      "qr": true,
      "cif": true,
      "recall": true,
      "abroad": true,
      "norfc": false
    },
    "email_required": false,
    "show_deadline": true,
    "back": null,
    "css": "",
    "colors": {
      "background": null,
      "card": null,
      "text": null,
      "button_text": null
    },
    "noun": "ticket",
    "texts": {}
  },
  "retention_mode": "keep_total",
  "invoice_series": null,
  "customer_notes": false,
  "failure_email": true,
  "split_max": 4,
  "split_min": 100,
  "split_same": true,
  "global_concepts": "ticket",
  "invoice_concepts": {
    "mode": "itemized",
    "customer_choice": true,
    "customer_options": [
      "itemized",
      "single",
      "grouped"
    ],
    "description": "Consumo",
    "product_key": null,
    "unit_key": null,
    "groups": [
      {
        "name": "Alimentos y bebidas",
        "product_key": "90101501",
        "unit_key": "E48",
        "sat_keys": [
          "901015"
        ],
        "categories": []
      },
      {
        "name": "Hospedaje",
        "product_key": null,
        "unit_key": null,
        "sat_keys": [],
        "categories": [
          "Hotel › Habitaciones"
        ]
      }
    ],
    "ungrouped": "group",
    "ungrouped_name": "Otros servicios",
    "line_detail": "customer"
  }
}
```
