Sign inGet started

Documentation

Explore guides, API references, SDKs, and examples to integrate stackin.

ShortcutsIntroductionAuthenticationIssue an invoice
Auth headerAuthorization: Bearer ••••••••••••••••

Copy a prompt for your AI

Paste it into your editor's assistant chat — Claude Code, Cursor, Copilot, Codex or ChatGPT. Each prompt tells the agent what to do, what to check and what never to do with your key.

  • Install the MCPConnects the MCP server to whichever client the agent runs in, by OAuth or key, and checks the authorized companies.Copy promptCopy prompt: Install the MCP
    Show the prompt
    You are my coding assistant. Connect Stackin's MCP server (Brazilian NF-e and NFS-e invoices) to this client. 1. Work out which client you are running in (Claude Code, Cursor, VS Code/Copilot, Codex, Windsurf, Zed, Gemini CLI or another) and read its tab at https://docs.stackin.io/en/mcp#install — each client has its own format and its own environment-variable syntax. 2. Add the remote server https://mcp.stackin.io/mcp (streamable HTTP) the way that client expects. Use OAuth by default: with no header, the client opens the Stackin sign-in in the browser and I authorize the company. 3. Only if I say there is no browser, use the alternative: the Authorization: Bearer header with the key read from the STACKIN_API_KEY environment variable, in the client's syntax. If the variable does not exist, ask me to create it — never ask for the key in the chat. 4. Verify: list the server's tools and call list_authorized_companies. Show which companies and permissions the connection covers, and in which environment (homologation or production). Never: - print, log or commit the key, or write it literally into a versioned file; - issue, cancel or correct an invoice during setup; - make up syntax — if the client's own docs disagree with https://docs.stackin.io/en/mcp#install, show me the difference before going on.
    /prompts/en/install-mcp.md
  • Install the SDKDetects the project's language, installs the official SDK and makes a first call in homologation.Copy promptCopy prompt: Install the SDK
    Show the prompt
    You are my coding assistant. Install Stackin's official SDK (Brazilian NF-e and NFS-e invoices) in this project and make a first call in homologation. 1. Detect the project's language from its files (pyproject.toml/requirements.txt, package.json, go.mod, composer.json) and use the package manager it already uses: - Python: pip install stackin-python-sdk (the package imports as stackin) - Node: npm install @stackin-io/stackin-node-sdk - Go: go get github.com/stackin-io/stackin-go-sdk - PHP: composer require stackin-io/stackin-php-sdk 2. Read https://docs.stackin.io/en/sdks#installation and https://docs.stackin.io/en/sdks#authentication. The key is an SDK key generated at https://app.stackin.io; the environment is fixed on the key, so use a homologation key. 3. Create the client in one place in the code, reading the key from the STACKIN_API_KEY environment variable. Add the variable to .env.example (with no value) and confirm .env is in .gitignore. 4. Make one read call to prove the connection (listing the invoice history, for example) and show me the result. On a 401, check the key is an SDK key and not an API key (https://docs.stackin.io/en/sdks#errors). Never: - write the key into code, a log or a commit; - issue any invoice unless I ask, and never in production without my explicit confirmation; - switch the language or the package manager the project already uses.
    /prompts/en/install-sdk.md
  • Build the integrationIssuing from your own domain objects, with idempotency, webhooks, rejections and tests.Copy promptCopy prompt: Build the integration
    Show the prompt
    You are my coding assistant. Build invoice issuing through Stackin into this project (NFS-e for services, NF-e for goods), in homologation. 1. Read the code and tell me where a billable sale or service comes from and who the recipient is. Propose where the integration lives (one module/service) before writing it. 2. Use the official SDK (https://docs.stackin.io/en/sdks) or the HTTP API (https://docs.stackin.io/en/api). Create the client once, with the key in STACKIN_API_KEY. 3. Build the issue call from the domain objects: https://docs.stackin.io/en/api#issue-invoice and https://docs.stackin.io/en/api#item-values. Do not make up an NCM, CFOP or service code — read it from the product record or ask me. 4. Send one idempotency key per business event (the order id, for example), stored with the order: https://docs.stackin.io/en/api#idempotency. Repeating the call must never produce a second invoice. 5. Store the returned id and access key. Follow the outcome by webhook (https://docs.stackin.io/en/api#webhooks), checking Stackin-Signature and ignoring a repeated Stackin-Delivery-Id; consult the status (https://docs.stackin.io/en/api#consult-invoice) only as a fallback. 6. Treat a rejection as a business state: store the reason, show it to the user and allow a reissue after the fix (https://docs.stackin.io/en/api#errors, https://docs.stackin.io/en/api#reissue-invoice). 7. Write tests with a mocked client and an optional integration test against homologation. Never: - expose the key in code, logs or commits; - issue in production, or switch the key to production, without my explicit confirmation; - retry an issue call without the same idempotency key.
    /prompts/en/integration.md
  • Fix an errorDiagnoses authentication, validation, tax-authority rejections, certificates and rate limits, and proposes the fix.Copy promptCopy prompt: Fix an error
    Show the prompt
    You are my coding assistant. Help me diagnose a problem with Stackin (Brazilian NF-e and NFS-e invoices) in this project. 1. Ask for the exact error message, the HTTP status, the operation and the document type. Do not guess before that. 2. Check the environment without exposing the key: does STACKIN_API_KEY exist? Is it an API key (api.stackin.io) or an SDK key (sdk.stackin.io)? Homologation or production? 3. Classify by status, using https://docs.stackin.io/en/api#errors: - 401: key missing, expired, or created for the other host. - 403: the connection does not cover the company, or the permission/OAuth scope is missing (INSUFFICIENT_PERMISSION, https://docs.stackin.io/en/mcp#scopes). - 400: the issuer's setup — certificate, address or fiscal fields at https://app.stackin.io. - 422: company_required (the connection covers several companies and the call names none, https://docs.stackin.io/en/api#companies), an invalid field, or a SEFAZ/municipal rejection with the error block. For the authority's code and what to change, use explain_rejection over MCP, GET /invoices/{invoice_id}/rejection over the API, or rejection(invoice_id) in the Python SDK; the other SDKs do not have the method yet, so call the HTTP route. The submission history (get_invoice_submissions, https://docs.stackin.io/en/api#invoice-submissions) is only the raw data, for when the explanation is not enough. - 429: wait Retry-After and repeat with the same idempotency key (https://docs.stackin.io/en/api#rate-limits). - 502/503: the authority did not answer; check error.retryable. 4. Propose the smallest fix, explain why, and apply it only after I agree. Never: - print or commit the key; - reissue, cancel or issue again in production without my explicit confirmation — first check the invoice was not already authorized; - turn off webhook signature checks to "make it work".
    /prompts/en/troubleshoot.md
Reliable

99.9%+ uptime

Secure

Encrypted data, LGPD-ready

Fast

Scalable, low-latency infrastructure

AI-first

Official MCP server — issue from an agent

© 2026 stackin. All rights reserved.Built with code, purpose, and coffee.Privacy PolicyTerms of UseContact