Salta ai contenuti

Portugal Quickstart

Questi contenuti non sono ancora disponibili nella tua lingua.

This quickstart covers the essential steps to get started with the SIGN PT API, from authentication to creating your first fiscal record. For a more detailed walkthrough, refer to our integration guide.

  • A fiskaly account (sign up at hub.fiskaly.com)
  • An API Key and Secret for an Organization GROUP in the TEST environment
  • AT Portal das Finanças subuser credentials for the taxpayer (real credentials required in LIVE only)
  1. Authenticate

    curl -X POST https://test.api.fiskaly.com/tokens \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -d '{
        "content": {
          "type": "API_KEY",
          "key": "YOUR_API_KEY",
          "secret": "YOUR_API_SECRET"
        }
      }'
  2. Create an Organization UNIT

    curl -X POST https://test.api.fiskaly.com/organizations \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "content": {
          "type": "UNIT",
          "name": "My Portuguese Merchant"
        }
      }'
  3. Create a Subject API Key and authenticate

    Create an API key for the UNIT, then authenticate with it:

    # Create Subject API Key (scoped to the `UNIT`)
    curl -X POST https://test.api.fiskaly.com/subjects \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -H "X-Scope-Identifier: ${ORG_ID}" \
      -d '{"content": {"type": "API_KEY"}}'
    
    # Authenticate with the new API Key
    curl -X POST https://test.api.fiskaly.com/tokens \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -d '{"content": {"type": "API_KEY", "key": "NEW_KEY", "secret": "NEW_SECRET"}}'
  4. Create Taxpayer, Location, and System

    # Create Taxpayer
    curl -X POST https://test.api.fiskaly.com/taxpayers \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "content": {
          "type": "COMPANY",
          "name": {
            "legal": "Minha Empresa Lda."
          },
          "address": {
            "line": {
              "type": "STREET_NUMBER",
              "street": "Rua Augusta",
              "number": "28"
            },
            "code": "1100-053",
            "city": "Lisboa",
            "country": "PT"
          },
          "fiscalization": {
            "type": "PT",
            "tax_id_number": "512345678",
            "email": "fiscal@minhaempresa.pt",
            "registration": {
              "capital": "50000.00",
              "office": "CRC Lisboa",
              "other": "sob NIF 512345678"
            },
            "credentials": {
              "type": "AT",
              "username": "512345678/3",
              "password": "YOUR_AT_PASSWORD"
            }
          }
        }
      }'
    
    # Commission Taxpayer
    curl -X PATCH "https://test.api.fiskaly.com/taxpayers/${TAXPAYER_ID}" \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{"content": {"state": "COMMISSIONED"}}'
  5. Create your first Record

    Records require two calls: an INTENTION followed by a TRANSACTION.

    # Part A: Intention
    curl -X POST https://test.api.fiskaly.com/records \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "content": {
          "type": "INTENTION",
          "system": {"id": "YOUR_SYSTEM_ID"},
          "operation": {"type": "TRANSACTION"}
        }
      }'
    
    # Part B: Transaction
    curl -X POST https://test.api.fiskaly.com/records \
      -H "Authorization: Bearer ${ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -H "X-Api-Version: 2026-05-04" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "content": {
          "type": "TRANSACTION",
          "record": {"id": "YOUR_INTENTION_ID"},
          "operation": {
            "type": "RECEIPT",
            "document": {
              "number": "FS-2026/00001",
              "series": "FS-2026",
              "total_vat": {
                "amount": "2.30",
                "exclusive": "10.00",
                "inclusive": "12.30"
              }
            },
            "entries": [
              {
                "type": "SALE",
                "data": {
                  "type": "ITEM",
                  "text": "Product A",
                  "unit": {"quantity": "1.00", "price": "10.00"},
                  "value": {"base": "10.00"},
                  "vat": {
                    "type": "VAT_RATE",
                    "code": "STANDARD",
                    "percentage": "23.00",
                    "amount": "2.30",
                    "exclusive": "10.00",
                    "inclusive": "12.30"
                  }
                },
                "details": {"concept": "GOOD"}
              }
            ],
            "payments": [
              {
                "type": "CASH",
                "details": {"amount": "12.30", "currency": "EUR"}
              }
            ]
          }
        }
      }'

    Once the Record reaches COMPLETED state, SIGN PT returns the compliance payload for printing: ATCUD code, QR code content, hash excerpt, and the software certificate number.

Was this page helpful?