gigstack API
  1. Invoices
gigstack API
  • gigstack API, your fiscal infraestructure
  • Ping
    • Ping
    • Ping API (GET)
      GET
    • Ping API (POST)
      POST
    • Ping API (PUT)
      PUT
    • Ping API (DELETE)
      DELETE
  • Payments
    • Payments
    • Create a payment
      POST
    • List payments
      GET
    • Get payment by ID
      GET
  • Invoices
    • Invoices
    • Create an invoice
      POST
    • List invoices
      GET
    • Get invoice by ID
      GET
  • Clients
    • Clients
    • Create a client
      POST
    • List clients
      GET
    • Get client by ID
      GET
  • Services
    • Services
    • Create a service
      POST
    • List services
      GET
    • Get service by ID
      GET
  • Receipts
    • Receipts
    • Create a receipt
      POST
    • List receipts
      GET
    • Get receipt by ID
      GET
    • Update receipt
      PUT
    • Delete receipt
      DELETE
  • Webhooks
    • Webhooks
    • Create a webhook
    • List webhooks
    • Get webhook by ID
    • Delete webhook
  • Catalogs
    • Catalogs
    • List catalogs
    • Get catalog by ID
  • Connect
    • Connect
    • Create a team
    • List teams
    • Get team by ID
    • Update team
    • Get team onboarding URL and connection status
    • Get team members
    • Update team members
    • Remove team members
  1. Invoices

Invoices

Invoices#

The Invoices API allows you to generate and manage invoices with client information, series tracking, and comprehensive invoice management capabilities.

Overview#

Use the Invoices API to:
Create new invoices with client information
Manage invoice series and folio numbers
List and filter existing invoices
Track invoice status and history
Generate PDF invoices
Handle invoice-client relationships

Endpoints#

POST /v2/invoices#

Create a new invoice.
Authentication Required: Yes

Request Body#

{
  "clientId": "client_123",
  "amount": 1000.0,
  "currency": "MXN",
  "description": "Professional services",
  "series": "A",
  "items": [
    {
      "description": "Consulting services",
      "quantity": 1,
      "unitPrice": 800.0,
      "amount": 800.0
    },
    {
      "description": "Setup fee",
      "quantity": 1,
      "unitPrice": 200.0,
      "amount": 200.0
    }
  ],
  "dueDate": "2024-02-15T00:00:00.000Z",
  "issueDate": "2024-01-15T00:00:00.000Z"
}

Parameters#

ParameterTypeRequiredDescription
clientIdstringYesClient identifier
amountnumberYesTotal invoice amount
currencystringNoCurrency code (default: MXN)
descriptionstringNoInvoice description
seriesstringNoInvoice series (default: A)
itemsarrayNoInvoice line items
dueDatestringNoInvoice due date (ISO 8601)
issueDatestringNoInvoice issue date (ISO 8601)

Response#

Success Response (201 Created):
{
  "data": {
    "id": "inv_456",
    "client": {
      "rfc": "XAXX010101000",
      "name": "Cliente Example",
      "legalName": "Cliente Example S.A. de C.V."
    },
    "status": "draft",
    "amount": 1000.0,
    "currency": "MXN",
    "series": "A",
    "invoice": {
      "folioNumber": "A001"
    },
    "description": "Professional services",
    "dueDate": "2024-02-15T00:00:00.000Z",
    "issueDate": "2024-01-15T00:00:00.000Z",
    "timestamp": "2024-01-15T10:30:00.000Z",
    "items": [
      {
        "description": "Consulting services",
        "quantity": 1,
        "unitPrice": 800.0,
        "amount": 800.0
      },
      {
        "description": "Setup fee",
        "quantity": 1,
        "unitPrice": 200.0,
        "amount": 200.0
      }
    ]
  },
  "message": "Invoice created successfully"
}

GET /v2/invoices#

List invoices with optional filtering.
Authentication Required: Yes

Query Parameters#

ParameterTypeDescription
limitnumberNumber of results to return (default: 20, max: 100)
offsetnumberNumber of results to skip
clientIdstringFilter by client ID
statusstringFilter by invoice status
seriesstringFilter by invoice series
fromstringFilter invoices from date (ISO 8601)
tostringFilter invoices to date (ISO 8601)
minAmountnumberFilter by minimum amount
maxAmountnumberFilter by maximum amount

Response#

Success Response (200 OK):
{
  "data": [
    {
      "id": "inv_456",
      "client": {
        "rfc": "XAXX010101000",
        "name": "Cliente Example"
      },
      "status": "sent",
      "amount": 1000.0,
      "currency": "MXN",
      "series": "A",
      "invoice": {
        "folioNumber": "A001"
      },
      "timestamp": "2024-01-15T10:30:00.000Z"
    }
  ],
  "message": "Invoices retrieved successfully",
  "totalResults": 1,
  "hasMore": false,
  "next": null
}

GET /v2/invoices/{invoiceId}#

Get a specific invoice by ID.
Authentication Required: Yes

Response#

Success Response (200 OK):
{
  "data": {
    "id": "inv_456",
    "client": {
      "rfc": "XAXX010101000",
      "name": "Cliente Example",
      "legalName": "Cliente Example S.A. de C.V.",
      "email": "cliente@example.com"
    },
    "status": "sent",
    "amount": 1000.0,
    "currency": "MXN",
    "series": "A",
    "invoice": {
      "folioNumber": "A001"
    },
    "description": "Professional services",
    "dueDate": "2024-02-15T00:00:00.000Z",
    "issueDate": "2024-01-15T00:00:00.000Z",
    "timestamp": "2024-01-15T10:30:00.000Z",
    "items": [
      {
        "description": "Consulting services",
        "quantity": 1,
        "unitPrice": 800.0,
        "amount": 800.0
      },
      {
        "description": "Setup fee",
        "quantity": 1,
        "unitPrice": 200.0,
        "amount": 200.0
      }
    ]
  },
  "message": "Invoice retrieved successfully"
}

PUT /v2/invoices/{invoiceId}#

Update an existing invoice.
Authentication Required: Yes

Request Body#

{
  "description": "Updated professional services",
  "dueDate": "2024-03-01T00:00:00.000Z"
}

DELETE /v2/invoices/{invoiceId}#

Delete (cancel) an invoice.
Authentication Required: Yes

Invoice Status#

StatusDescription
draftInvoice is in draft state
sentInvoice has been sent to client
paidInvoice has been paid
overdueInvoice is past due date
cancelledInvoice has been cancelled
refundedInvoice has been refunded

Invoice Series#

Invoice series help organize and categorize your invoices:
Series A: Default series for standard invoices
Series B: Can be used for different business units
Custom Series: Create custom series as needed
Each series maintains its own folio number sequence (A001, A002, etc.).

Code Examples#

Create an Invoice#

JavaScript/Node.js:
Python:

List Invoices with Filtering#

cURL:

Error Handling#

Common Error Responses#

Validation Error (400 Bad Request):
{
  "error": {
    "code": "validation_error",
    "message": "Invalid request parameters",
    "details": {
      "amount": "Amount must be greater than 0",
      "clientId": "Client ID is required",
      "items": "At least one item is required"
    }
  },
  "message": "Request validation failed"
}
Client Not Found (404 Not Found):
{
  "error": {
    "code": "client_not_found",
    "message": "The specified client does not exist"
  },
  "message": "Client validation failed"
}

Best Practices#

1.
Client Validation: Ensure client exists before creating invoices
2.
Series Management: Use consistent series for better organization
3.
Item Details: Include detailed line items for transparency
4.
Due Dates: Set appropriate due dates based on your payment terms
5.
Status Tracking: Monitor invoice status changes for follow-up
6.
Currency Consistency: Use consistent currency codes (ISO 4217)

Integration with Payments#

Link invoices with payments for complete transaction tracking:

Next Steps#

Manage client information
Process payments for invoices
Set up webhooks for invoice notifications
Modified at 2025-06-11 04:54:30
Previous
Get payment by ID
Next
Create an invoice
Built with