Sign inGet started
Back to blog
Get building

Quickstart

From signup to a first authorized document in one request, using an API key against homologation.

This assumes you already have an API key with context api and environment homologation — see Create an account if you don't. Homologation is free, has no volume limit, and exercises the same authorizer validation as production, just marked as a test transmission.

  • An API key with context api and environment homologation.
  • A registered company with its digital certificate uploaded.
  • The base URL https://api.stackin.io/api/v1.

Every request carries the key as a Bearer token — there's no separate company_id or environment field to set, the key already resolves both. The base URL is https://api.stackin.io/api/v1.

To issue an NF-e, POST to /invoices with document_type set to nfe, the buyer's name and tax id, one or more items, and — for nfe specifically — items[].product.br with an ncm and cfop tax classification code (NFS-e skips this entirely, since a service has no such code). See the API reference for the full request/response example in cURL, Python, Go, or PHP.

POST /invoices
Copy
curl -X POST https://api.stackin.io/api/v1/invoices \
  -H "Authorization: Bearer $STACKIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "document_type": "nfe",
    "client_name": "Buyer Company Ltd",
    "tax_id": "11222333000181",
    "items": [
      {
        "description": "Rosa Holambra Vermelha",
        "unit_price": "112.44",
        "product": { "br": { "ncm": "06031100", "cfop": "5102" } }
      }
    ],
    "recipient_address": {
      "street": "Rua das Flores",
      "number": "1200",
      "neighborhood": "Centro",
      "city": "Joinville",
      "state": "SC",
      "zip_code": "89201100",
      "city_code": "4209102"
    }
  }'

A successful call returns 201 with an access_key, status, and the government protocol number — that access_key is what every later lookup (consult, cancel) is keyed on, so store it alongside your own record of the document.

The same call works for nfse — just change document_type and drop the product.br block, since it doesn't apply. Once this works in homologation, switching to production is only a matter of authenticating with a different key; nothing about the request shape changes.

A key belongs to exactly one environment for its whole lifetime. Moving to production means authenticating with a production key — there is no environment field to flip.