Skip to main content
Some operations in this guide have Discovery handlers but no public gateway route yet: POST /clients/{id}/support-documents. Check the availability notice on each API reference page before using them.
Start with shared fields, then the Mexico or Colombia guide. The CFDI, RFC, SAT catalog, and payment-complement examples below describe Mexico; they are not universal country requirements.
Manage clients with fiscal information for Mexican tax compliance. The Clients API handles customer data, RFC validation, EFOS checking, and SAT compliance requirements.

Overview

Clients are the foundation of your invoicing system. Each client contains fiscal information required for Mexican tax compliance, including RFC (tax ID), tax system, and address information.

Key Features

  • RFC Validation - Automatic tax ID validation against SAT
  • EFOS Checking - Blacklist validation for compliance
  • Address Management - Mexican address structure support
  • Metadata Support - Custom fields for additional data
  • Duplicate Prevention - Search for existing clients before creating (upsert-like behavior)
  • Auto-creation - Create clients during invoice/payment flow

Endpoints

List Clients

Retrieve a paginated list of clients with filtering and search capabilities. Query Parameters: Metadata Filtering: You can filter clients by any metadata key using either dot notation or underscore notation. Both formats are equivalent and supported:
The metadata filtering uses Typesense search for efficient querying without requiring Firestore indexes. When using metadata filters, pagination is controlled via the page parameter instead of the next cursor. Example Requests:
Example Response:

Create Client

Create a new client with fiscal information. Duplicate Prevention (Upsert): Use the search parameter to find existing clients before creating:
  • If a match is found and search.update is false (default): Returns the existing client without modifications (200).
  • If a match is found and search.update is true: Updates the existing client with the provided data and returns it (200).
  • If no match is found: Creates a new client (201).
  • If multiple matches are found: Returns a 409 Conflict error with the list of matching client IDs.
Request Body:
Search Parameters: Example Request (Simple):
Example Request (With Duplicate Prevention):
Response Codes:

Get Client

Retrieve a specific client by ID. Example Request:

Update Client

Update an existing client’s information. Body Parameters: The response includes a pending_receipts summary (attempted, succeeded, failed, skipped, failures) when the check is performed. Example Request:
Skip the pending-receipts invoicing:

Delete Client

Delete a specific client. Example Request:

Validate Client

Validate client’s fiscal information against SAT. Example Request:

Stamp Pending Receipts

Stamps every pending receipt that belongs to this client, to the client’s own fiscal identity.
This issues real CFDIs. Each stamped receipt becomes a live invoice with the SAT, using the client’s rfc, legal_name, address.zip and tax_system. There is no dry-run mode. Cancel through DELETE /invoices/{id} if you stamp by mistake.
Preconditions — the client document must already carry the fiscal data required by the CFDI: If any of these is missing the call returns 400 with code client_fiscal_data_incomplete and a details string naming the missing field(s). Nothing is stamped in that case. Scope — only receipts that match all of the following are considered:
  • team equals the effective team of the API key (or the ?team= Connect target)
  • livemode equals the mode of the API key (a test key never touches live receipts)
  • status is pending
  • client.id equals {id}
Batching — a maximum of 100 receipts are stamped per call. The response’s remaining field reports how many pending receipts are still left for this client (including any that failed in this batch, since a failed receipt stays pending). Keep calling the endpoint until remaining is 0 to drain a backlog. Example Request:
Example Response:
When there is nothing to do the endpoint returns 200 with { "stamped": 0, "failed": 0, "remaining": 0, "results": [] }. Drain loop:

Customer Portal Access

Creates a single-use customer-portal session for a client and returns the URL to send them. The client is identified in the request body, not in the path — pass either id or email (if both are present, id wins). Omitting both returns 400 "Client ID or email is required". The team must have a customer portal configured (customerPortalId); otherwise the call returns 400 "Team customer portal is not configured". Request Body: Example Request:
Example Response:
The link is valid for 5 days (expires_at, epoch ms). Treat the URL as a credential — anyone holding it can see that client’s documents.

Upload CSF (Constancia de Situación Fiscal)

Upload the SAT’s CSF PDF to create a client from it, or to update an existing client. gigstack reads the RFC and CIF from the PDF, validates them against the SAT, and fills in the legal name, RFC, tax regime, fiscal type and status, and the full fiscal address. Send the PDF as multipart/form-data in a file field. Add ?client_id= to update that client; omit it to create a new one.
Returns 201 (message: "Client created from CSF") or 200 (message: "Client updated with CSF data") with the client in data, in the standardized envelope. An unreadable PDF, missing fiscal data or an unknown client_id returns 400.

Support Documents

Attach and list supporting documents (contracts, communications…) for a client. Same fields, limits and response as invoice support documents: multipart/form-data with file (PDF, PNG, JPG or WEBP, up to 10 MB) and documentType; answers 201.

Client Structure

Required Fields

  • None - All fields are optional for maximum flexibility

Important Fields

  • tax_id (string) - RFC for Mexican tax compliance
  • tax_system (string) - SAT tax system code (e.g., “601”, “612”)
  • use (string) - Default CFDI use code (e.g., “P01”, “G03”)
  • email (string) - Email for invoice delivery

Tax System Codes

Common SAT tax system codes:
  • 601 - General de Ley Personas Morales
  • 612 - Persona Física con Actividades Empresariales
  • 621 - Incorporación Fiscal
  • 622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras
  • 623 - Opcional para Grupos de Sociedades
  • 624 - Coordinados
  • 625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas
  • 626 - Régimen Simplificado de Confianza

CFDI Use Codes

Common CFDI use codes:
  • P01 - Por definir
  • G01 - Adquisición de mercancías
  • G02 - Devoluciones, descuentos o bonificaciones
  • G03 - Gastos en general
  • I01 - Construcciones
  • I02 - Mobiliario y equipo de oficina por inversiones
  • I03 - Equipo de transporte
  • I04 - Equipo de computo y accesorios
  • I05 - Dados, troqueles, moldes, matrices y herramental
  • I06 - Comunicaciones telefónicas
  • I07 - Comunicaciones satelitales
  • I08 - Otra maquinaria y equipo

Search and Duplicate Prevention

The search parameter enables upsert-like behavior when creating clients. This is useful for integrations that may send the same client multiple times.

Direct Client Creation (POST /clients)

Within Invoices or Payments

When creating invoices or payments, you can search for existing clients inline:

Search Behavior

Example: Update Existing Client on Match

This will find the client with tax_id: PEGJ800101ABC and update their email to nuevo.email@ejemplo.com.

Validation and Compliance

RFC Validation

  • Automatic format validation
  • SAT registry verification

EFOS Checking

  • Blacklist validation against SAT’s EFOS list
  • Automatic status updates
  • Compliance reporting

Address Validation

  • Mexican postal code verification
  • Address completeness checking

Best Practices

  1. Always include tax_id for Mexican clients
  2. Set appropriate tax_system based on client type
  3. Use metadata for custom business logic
  4. Validate clients before important transactions
  5. Keep addresses updated for compliance
  6. Use search functionality to avoid duplicates

Error Handling

Common error scenarios:

Invalid RFC Format

Client Not Found

EFOS Validation Failed

Multiple Clients Match Search Criteria (409 Conflict)

When using the search parameter and multiple clients match the criteria:
Resolution: Use one of the returned client IDs directly, or use a more specific search key (e.g., combine with email or use the client id directly).
For additional assistance, contact support@gigstack.io