Ir al contenido

Inicio rápido Portugal

Este inicio rápido cubre los pasos esenciales para comenzar con la API de SIGN PT, desde la autenticación hasta la creación de su primer registro fiscal. Para una guía más detallada, consulte nuestra guía de integración.

  • Una cuenta fiskaly (regístrese en hub.fiskaly.com)
  • Una clave de API y Secret para una Organización GROUP en el entorno TEST
  • Credenciales de subusuario del AT Portal das Finanças para el contribuyente (credenciales reales requeridas solo en LIVE)
  1. Autenticarse

    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. Crear una Organización 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. Crear una clave de API de sujeto y autenticarse

    Cree una clave de API para la UNIT y autentíquese con ella:

    # 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. Crear Contribuyente, Ubicación y Sistema

    # 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. Crear su primer Registro

    Los Registros requieren dos llamadas: una INTENTION seguida de una 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"}
              }
            ]
          }
        }
      }'

    Una vez que el Registro alcanza el estado COMPLETED, SIGN PT devuelve el payload de cumplimiento para la impresión: código ATCUD, contenido del código QR, fragmento hash y el número de certificado del software.

Was this page helpful?