Taxly Integrator API Exchange Invoice Receiving Guide

Comprehensive instructions for integrators on how to use the Taxly Integrator API to receive incoming invoices through the NRS Exchange system.

Overview

This guide provides comprehensive instructions for integrators on how to use the Taxly Integrator API to receive incoming invoices through the NRS Exchange system. The Taxly platform acts as an intermediary: it is notified by NRS Exchange, acknowledges, downloads and decrypts each invoice, and routes the decrypted invoice to the appropriate integrator based on the customer TIN (Tax Identification Number) found inside the invoice.

Table of Contents

System Architecture

How It Works

  1. NRS Exchange notifies Taxly by webhook that an invoice was transmitted (TRANSMITTING or TRANSMITTED)
  2. Taxly confirms the invoice and acknowledges receipt to NRS. This is automatic and needs nothing from you, because NRS only releases the invoice for download after it has been acknowledged
  3. Taxly downloads the encrypted invoice and decrypts it
  4. Tenant Resolution reads the customer TIN from the decrypted invoice (NRS masks party TINs before download) and matches it to an approved integrator tenant with the same TIN
  5. Webhook Dispatch sends the decrypted invoice to your endpoints subscribed to invoice.transmitted.decrypted
  6. Retention if no tenant matches the customer TIN, or delivery fails, Taxly keeps the decrypted invoice so delivery can be retried

Data Flow

NRS Exchange → Taxly Webhook → Confirm & Acknowledge → Download & Decrypt → Customer TIN → Tenant → Your Webhook → Your System

Prerequisites

Before integrating, ensure you have:

  • Approved Integrator Status on Taxly platform
  • Valid API Key for authentication
  • Webhook Endpoint URL (HTTPS required)
  • TIN Registration - Your tenant's TIN (set when you register, format 12345678-0001) must equal the customer TIN on the invoices addressed to you
  • JSON API processing capability
  • Webhook Security implementation (recommended)

Integration Setup

Step 1: Register as an Integrator

Endpoint: POST /api/v1/integrators/register

Authentication: None (Public endpoint)

Request Body:

{
    "name": "Your Company",
    "tin": "12345678-0001",
    "brand": "YourBrand",
    "domain": "yourcompany.com",
    "description": "E-commerce platform integration for invoice processing",
    "use_case": "Automated invoice receiving and processing for online marketplace transactions",
    "website": "https://yourcompany.com",
    "contact_person": "John Doe",
    "contact_email": "john@yourcompany.com",
    "landlord_id": 1 // optional; defaults to first active landlord if omitted
}

Request Parameters:

Field Type Required Description
name string Yes Tenant/Organization name
tin string Yes Tax Identification Number (TIN) - required for invoice routing
brand string No Brand name for the organization
domain string No Unique domain (e.g., yourcompany.com)
description string Yes Description of the integration
use_case string Yes Detailed use case description
website string No Organization website URL
contact_person string Yes Name of contact person
contact_email string Yes Contact email address
landlord_id integer No Optional: landlord to associate; defaults to first active landlord if omitted

Response:

{
    "success": true,
    "data": {
        "tenant_id": 1,
        "tenant": {
            "id": 1,
            "name": "Your Company",
            "is_integrator": true,
            "integrator_status": "pending"
        },
        "message": "Integrator application submitted successfully. Please wait for approval.",
        "status_check": {
            "endpoint": "/api/v1/integrators/status",
            "method": "GET",
            "parameters": {
                "tenant_id": 1
            },
            "note": "Use this endpoint to check your approval status. No authentication required."
        }
    },
    "message": "Integrator application submitted successfully"
}
Notes:
  • This endpoint automatically creates a new tenant and registers it as an integrator in a single step
  • No authentication is required for registration
  • The tenant_id is returned in the response - save this for checking your approval status
  • Use the status_check endpoint to check if you've been approved (no authentication needed)
  • Once approved, you can generate API keys using your tenant_id

⚠️ Important: Store your API key securely. It will only be shown once.

Step 2: Get Approved

Your application will be reviewed by Taxly administrators. Once approved, your integrator_status will change to approved. Use the status check endpoint to monitor your approval status (see next section).

Step 3: Generate Your First API Key

✅ No Authentication Required for First Key: When generating your first API key, no authentication is required. This is a one-time process allowed only when your tenant is approved and has no existing API keys.

Endpoint: POST /api/v1/integrators/{tenant}/api-keys

Authentication: None required for first key generation (tenant must be approved and have no existing keys)

Required Header: X-Integrator-Email must match the contact email used during registration

Headers:

X-Integrator-Email: john@yourcompany.com
Content-Type: application/json

💡 Alternative: You can also provide the email via query parameter: ?contact_email=john@yourcompany.com

Request Body:

{
    "name": "Production API Key",
    "description": "API key for production environment",
    "permissions": ["invoices.read", "invoices.write"]
}

Example cURL Request:

curl -X POST "https://api.taxly.com/api/v1/integrators/1/api-keys" \
  -H "X-Integrator-Email: john@yourcompany.com" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production API Key",
    "description": "API key for production environment",
    "permissions": ["invoices.read", "invoices.write"]
}'

Response:

{
    "success": true,
    "data": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "Production API Key",
        "description": "API key for production environment",
        "key": "taxly_abc123xyz789...",
        "permissions": ["invoices.read", "invoices.write"],
        "tenant_id": 1,
        "created_at": "2025-01-27T14:30:00Z"
    },
    "message": "API key created successfully"
}

⚠️ Important: Store your API key securely. The key field will only be shown once and cannot be retrieved again. If you lose it, you'll need to generate a new key.

Subsequent API Key Generation

After generating your first API key, all subsequent API key operations (including regenerating api key) require authentication using your existing API key:

Endpoint: POST /api/v1/integrators/{tenant}/api-keys/regenerate

Authentication: x-api-key your_existing_api_key

Headers for Subsequent Requests:

x-api-key: taxly_abc123xyz789...
Content-Type: application/json

Step 4: List, Rotate, or Revoke Existing API Keys

🔐 Current API key management flow: once your first key has been issued, all key management actions are authenticated with the active x-api-key header. The authenticated API key must belong to the same {tenant} in the URL.

List API Keys: GET /api/v1/integrators/{tenant}/api-keys

Regenerate Current API Key: POST /api/v1/integrators/{tenant}/api-keys/regenerate

Revoke API Key: DELETE /api/v1/integrators/{tenant}/api-keys/{apiKey}

Authentication: x-api-key: your_current_api_key

Important Regeneration Rules

  • The regenerate endpoint is POST only.
  • You must call the endpoint with the same tenant ID that owns the API key in x-api-key.
  • Regeneration rotates the currently authenticated API key.
  • The new plaintext key is shown only once in the response. Save it immediately.
  • If you send an invalid key, the API returns 401 Invalid API key provided.

Example: List API Keys

curl -X GET "https://api.taxly.com/api/v1/integrators/27/api-keys" \
  -H "Accept: application/json" \
  -H "x-api-key: taxly_abc123xyz789..."

Example: Regenerate Current API Key

curl -X POST "https://api.taxly.com/api/v1/integrators/27/api-keys/regenerate" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "x-api-key: taxly_abc123xyz789..." \
  -d '{}'

Example Regeneration Response

{
    "success": true,
    "data": {
        "api_key": {
            "id": 10,
            "name": "Production API Key",
            "key": "taxly_new_plaintext_key_shown_once",
            "masked": "taxly_****c754",
            "description": "API key for production environment",
            "permissions": ["invoices.read", "invoices.write"],
            "active": true,
            "created_at": "2026-04-09T10:15:00Z",
            "updated_at": "2026-04-09T13:10:00Z"
        }
    },
    "message": "API key regenerated successfully"
}

⚠️ Common cause of authorization errors: if the tenant in the URL does not match the tenant that owns the supplied x-api-key, the request will fail with an authorization error.

Check Approval Status

✅ No Authentication Required: This endpoint is public and can be called without an API key or authentication.

After registering as an integrator, you can check your approval status at any time without authentication. This allows you to monitor when you can start generating API keys.

Endpoint: GET /api/v1/integrators/status

Authentication: None (Public endpoint)

Query Parameters

You must provide at least one of the following parameters:

Parameter Type Required Description
tenant_id integer Conditional Your tenant ID (from registration response)
email string Conditional Contact email used during registration

Example Request

# Check by tenant ID
curl "https://api.taxly.com/api/v1/integrators/status?tenant_id=123"

# Check by email
curl "https://api.taxly.com/api/v1/integrators/status?email=john@yourcompany.com"

Response Examples

Pending Status:

{
    "success": true,
    "data": {
        "tenant_id": 1,
        "name": "Your Company",
        "integrator_status": "pending",
        "status_message": "Your integrator application is pending review. Please check back later.",
        "can_generate_api_keys": false,
        "can_use_api": false,
        "applied_at": "2025-01-27T12:00:00Z",
        "next_steps": [
            "Wait for admin approval",
            "Check this endpoint periodically for status updates",
            "You will be able to generate API keys once approved"
        ]
    },
    "message": "Integrator status retrieved successfully"
}

Approved Status:

{
    "success": true,
    "data": {
        "tenant_id": 1,
        "name": "Your Company",
        "integrator_status": "approved",
        "status_message": "Your integrator application has been approved. You can now generate API keys and use the API.",
        "can_generate_api_keys": true,
        "can_use_api": true,
        "applied_at": "2025-01-27T12:00:00Z",
        "reviewed_at": "2025-01-27T14:00:00Z",
        "review_reason": "Application meets all requirements",
        "next_steps": [
            "Generate API keys using POST /api/v1/integrators/{tenant}/api-keys",
            "Use your API key to authenticate requests",
            "Start integrating with the invoice API"
        ]
    },
    "message": "Integrator status retrieved successfully"
}

Rejected Status:

{
    "success": true,
    "data": {
        "tenant_id": 1,
        "name": "Your Company",
        "integrator_status": "rejected",
        "status_message": "Your integrator application has been rejected. Please contact support for more information.",
        "can_generate_api_keys": false,
        "can_use_api": false,
        "applied_at": "2025-01-27T12:00:00Z",
        "reviewed_at": "2025-01-27T14:00:00Z",
        "review_reason": "Incomplete application details",
        "next_steps": [
            "Review the rejection reason provided",
            "Contact support if you believe this is an error",
            "You may reapply with additional information if needed"
        ]
    },
    "message": "Integrator status retrieved successfully"
}
Response Fields:
  • integrator_status: Current status (pending, approved, or rejected)
  • can_generate_api_keys: Whether you can generate API keys (requires approval)
  • can_use_api: Whether you can use the API (requires approval)
  • applied_at: When you submitted your application
  • reviewed_at: When admin reviewed your application (if applicable)
  • review_reason: Reason for approval/rejection (if applicable)
  • next_steps: Suggested actions based on your status

💡 Tip: Save your tenant_id after registration and use it to periodically check your status. You can also use the email address you registered with as an alternative.

Webhook Configuration

Setting Up Your Webhook Endpoint

Your webhook endpoint must:

  • Accept POST requests
  • Return HTTP 200 status for successful processing
  • Handle JSON payloads
  • Process requests within 30 seconds
  • Be accessible via HTTPS

Webhook Endpoint Requirements

Method: POST

Content-Type: application/json

Headers Included:

  • X-Webhook-Source: Taxly
  • X-Webhook-Event: exchange_invoice.received
  • X-Webhook-Event: invoice.transmitted.decrypted for decrypted transmitted invoices

Important for Integrators

If you want to receive the full decrypted invoice payload for transmitted invoices, your webhook must be subscribed to the invoice.transmitted.decrypted event.

If this event is not subscribed, Taxly may complete post-transmit processing successfully but no decrypted invoice payload will be sent to your endpoint.

Registering Your Webhook

Endpoint: POST /api/v1/webhooks

Authentication: x-api-key taxly_abc123xyz789...

Storage model: Webhook endpoints are now linked directly to your tenant_id. Older organization-linked records remain supported for backward compatibility.

Request Body:

{
    "url": "https://yourdomain.com/webhooks/taxly/invoices",
    "events": ["exchange_invoice.received", "invoice.transmitted.decrypted"],
    "secret": "your_webhook_secret_for_security",
    "description": "Primary webhook endpoint for receiving exchange invoices",
    "name": "Production Webhook"
}
Field Mapping Notes:
  • name maps to message in the database
  • events maps to subscribed_events in the database
  • irn is a generated placeholder (CONFIG-{tenant_id}-{unique id}) kept for older records
  • forward_status is a legacy field and is always pending for endpoints
  • description is accepted but not stored

Request Parameters:

Field Type Required Description
url string Yes Your webhook endpoint URL (must be HTTPS)
events array Yes Array of events to subscribe to. Supported events:
  • exchange_invoice.received - Incoming invoices from NRS
  • invoice.transmitted.decrypted - Decrypted transmitted invoices
  • invoice.transmission.status - Transmission status updates
  • webhook.delivered - Webhook delivery confirmations
  • webhook.failed - Webhook delivery failures
secret string Yes Secret key for webhook signature validation (minimum 10 characters)
description string No Accepted for compatibility but not stored or returned (max 255 characters)
name string No Name for the webhook endpoint (max 100 characters)

Example cURL Request:

curl -X POST "https://api.taxly.com/api/v1/webhooks" \
  -H "x-api-key: taxly_abc123xyz789..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yourdomain.com/webhooks/taxly/invoices",
    "events": ["exchange_invoice.received", "invoice.transmitted.decrypted"],
    "secret": "your_webhook_secret_for_security",
    "description": "Primary webhook endpoint for receiving exchange invoices",
    "name": "Production Webhook"
}'

Response:

{
    "success": true,
    "data": {
        "endpoint": {
            "id": 1,
            "tenant_id": 24,
            "url": "https://yourdomain.com/webhooks/taxly/invoices",
            "secret": "your_webhook_secret_for_security",
            "subscribed_events": ["exchange_invoice.received", "invoice.transmitted.decrypted"],
            "message": "Production Webhook",
            "forward_status": "pending",
            "irn": "CONFIG-24-65f1c0a1b2c3d",
            "created_at": "2026-04-17T12:00:00Z",
            "updated_at": "2026-04-17T12:00:00Z"
        }
    },
    "message": "Webhook endpoint created successfully"
}
Response Notes:
  • irn is automatically generated as CONFIG-{tenant_id}-{unique id} to ensure uniqueness
  • message contains the value from the name field in the request
  • subscribed_events contains the value from the events field in the request
  • forward_status is a legacy field and is always pending for new webhooks

Direct tenant linkage

Taxly now stores integrator webhook endpoints directly against the authenticated integrator tenant. This makes webhook lookup and dispatch simpler and more reliable.

  • Your API key resolves your authenticated tenant_id
  • The webhook endpoint is stored against that tenant
  • Webhook dispatch for decrypted transmitted invoices looks up endpoints by tenant_id, including older endpoints still linked to one of your organizations
  • If the same URL is registered more than once, it receives the invoice once per registration, so keep one registration per URL

Expected transmitted invoice flow

  1. NRS notifies Taxly that an invoice was transmitted (or Taxly transmits it to NRS)
  2. Taxly confirms the invoice and acknowledges receipt to NRS
  3. Taxly downloads the encrypted invoice and decrypts it
  4. Taxly reads the customer TIN from the decrypted invoice and finds the matching integrator tenant
  5. Taxly sends the full decrypted invoice to that tenant's subscribed webhooks using invoice.transmitted.decrypted

Invoice Receiving Process

1. Invoice Transmission

When another system transmits an invoice to your organization through NRS Exchange:

  1. NRS notifies Taxly that the invoice was transmitted
  2. Taxly looks the invoice up, confirms it and acknowledges receipt to NRS (automatic)
  3. Taxly downloads and decrypts the invoice
  4. Taxly reads the customer TIN from the decrypted invoice and matches it to your tenant
  5. Taxly sends the decrypted invoice to your webhook endpoints subscribed to invoice.transmitted.decrypted

Invoices with no matching customer

NRS masks party TINs until an invoice is acknowledged, so Taxly can only identify the customer after decrypting it. If no approved integrator tenant has that customer TIN, nothing is sent to any webhook. Taxly keeps the decrypted invoice and shows it to Taxly administrators as Customer not found, and delivery is retried once a matching tenant exists. If you expect an invoice and have not received it, check that your tenant TIN is registered exactly as it appears on the invoice, then contact support with the IRN.

Invoices you transmit through Taxly

For invoices transmitted through Taxly (POST /api/v1/invoices/{irn}/transmit), the same download and decrypt steps run after NRS confirms the transmission. The optional webhook_url on the transmit request only receives invoice.transmission.status updates. The decrypted invoice itself is sent to the customer's registered webhook endpoints, never to that webhook_url.

  1. The invoice is successfully transmitted to NRS
  2. Taxly runs post-transmit processing
  3. Taxly downloads the encrypted invoice package from NRS
  4. Taxly decrypts the invoice payload
  5. Taxly resolves the destination integrator by the customer TIN in the decrypted invoice
  6. Taxly sends the decrypted invoice to webhooks subscribed to invoice.transmitted.decrypted

2. Webhook Processing

Your webhook endpoint should:

  1. Validate the webhook authenticity
  2. Parse the JSON payload
  3. Process the invoice data
  4. Store the invoice in your system
  5. Return HTTP 200 status

3. Response Requirements

Success Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "received",
  "message": "Invoice processed successfully",
  "your_invoice_id": "INV-12345"
}

Error Response:

HTTP/1.1 500 Internal Server Error
Content-Type: application/json

{
  "status": "error",
  "message": "Failed to process invoice"
}

Any 2xx response counts as delivered. Any other status, or no response within 30 seconds, is recorded as a failed delivery.

Webhook Payload Structure

Decrypted Transmitted Invoice Payload

When your webhook is subscribed to invoice.transmitted.decrypted, Taxly sends a POST whose JSON body is exactly the structure below. The envelope fields are added by Taxly, while invoice_payload contains the decrypted invoice as returned by NRS (a JSON object when the decrypted content is valid JSON, otherwise a raw string). The request headers are Content-Type: application/json, X-Webhook-Source: Taxly, X-Webhook-Event: invoice.transmitted.decrypted and, when your endpoint has a secret, X-Webhook-Signature (HMAC-SHA256 of the raw request body):

The example below uses dummy/sample data only to illustrate the structure of a transmitted invoice webhook payload.

{
    "event": "invoice.transmitted.decrypted",
    "source": "taxly",
    "irn": "INVDEMOA12B34C5-FAKE6789-20260406",
    "status": "TRANSMITTED",
    "customer_tin": "20000001-0001",
    "supplier_tin": "30000002-0001",
    "invoice_payload": {
        "business_id": "11111111-2222-3333-4444-555555555555",
        "irn": "INVDEMOA12B34C5-FAKE6789-20260406",
        "payment_status": "PENDING",
        "customization_id": null,
        "invoice_kind": "B2B",
        "issue_date": "2026-04-06",
        "issue_time": "09:15:30",
        "due_date": "2026-05-06",
        "invoice_type_code": "380",
        "document_currency_code": "NGN",
        "tax_currency_code": "NGN",
        "accounting_supplier_party": {
            "id": "aaaa1111-bbbb-2222-cccc-333333333333",
            "postal_address_id": "dddd4444-eeee-5555-ffff-666666666666",
            "party_name": "Demo Supplier Nigeria Limited",
            "tin": "30000002-0001",
            "email": "billing@demosupplier.example.com",
            "telephone": "+2348000000002",
            "business_description": "Sample supplier record for documentation",
            "postal_address": {
                "id": "12121212-3434-5656-7878-909090909090",
                "street_name": "12 Example Crescent",
                "city_name": "Abuja",
                "postal_zone": "900001",
                "lga": null,
                "state": "FCT",
                "country": "NG"
            }
        },
        "accounting_customer_party": {
            "id": "99999999-8888-7777-6666-555555555555",
            "postal_address_id": "44444444-3333-2222-1111-000000000000",
            "party_name": "Demo Buyer Ventures",
            "tin": "20000001-0001",
            "email": "accounts@demobuyer.example.com",
            "telephone": "+2348000000001",
            "business_description": "Sample buyer record for documentation",
            "postal_address": {
                "id": "abababab-cdcd-efef-1212-343434343434",
                "street_name": "45 Sample Avenue",
                "city_name": "Lagos",
                "postal_zone": "100001",
                "lga": null,
                "state": "Lagos",
                "country": "NG"
            }
        },
        "payment_means": [
            {
                "payment_means_code": "10",
                "payment_due_date": "2026-05-06T00:00:00Z"
            }
        ],
        "allowance_charge": [
            {
                "charge_indicator": true,
                "amount": 125
            }
        ],
        "tax_total": [
            {
                "tax_amount": 375,
                "tax_subtotal": [
                    {
                        "taxable_amount": 5000,
                        "tax_amount": 375,
                        "tax_category": {
                            "id": "VAT",
                            "percent": 7.5
                        },
                        "TaxCategoryPercent": 7.5
                    }
                ]
            }
        ],
        "legal_monetary_total": {
            "line_extension_amount": 5000,
            "tax_exclusive_amount": 5125,
            "tax_inclusive_amount": 5375,
            "payable_amount": 5375
        },
        "invoice_line": [
            {
                "invoiced_quantity": 2,
                "line_extension_amount": 5000,
                "item": {
                    "name": "Demo Software Subscription",
                    "description": "Sample transmitted invoice payload for documentation purposes",
                    "sellers_item_identification": null
                },
                "price": {
                    "price_amount": 2500,
                    "base_quantity": 1,
                    "price_unit": "XBG"
                },
                "isic_code": "6201",
                "service_category": "Software",
                "discount_rate": 0,
                "discount_amount": 0,
                "fee_rate": 0,
                "fee_amount": 0
            }
        ]
    },
    "is_json_payload": true,
    "timestamp": "2026-04-06T09:18:45+00:00"
}

Invoice line classification groups

Each invoice_line item must carry exactly one classification group. Mixing fields from both groups, or omitting both groups entirely, is a validation error.

Group Required fields Use for
A (product) hsn_code + product_category Goods / physical products
B (service) isic_code + service_category Services (software, consulting, etc.)
  • Supplying any field from Group A alongside any field from Group B will be rejected, even if one group is otherwise complete.
  • Both fields within the chosen group are required — a line with only isic_code but no service_category (or vice-versa) is also rejected.
  • Whitespace-only values (" ") are treated as absent, matching the same trimming rule applied during request normalisation.

Exact payload mapping from Taxly

$integratorPayload = [
    "event" => "invoice.transmitted.decrypted",
    "source" => "taxly",
    "irn" => $irn,
    "status" => "TRANSMITTED",
    "customer_tin" => $customerTin,
    "supplier_tin" => $supplierTin,
    "invoice_payload" => $decrypted['json'] ?? $decrypted['raw'],
    "is_json_payload" => $decrypted['is_json'] ?? false,
    "timestamp" => now()->toIso8601String(),
];

This means invoice_payload is not transformed into a separate Taxly schema. Taxly forwards the decrypted JSON as-is when available, and falls back to the raw decrypted string when the content is not JSON.

If you only receive invoice.transmission.status (sent to the webhook_url of a transmit request) but do not receive the decrypted invoice payload, verify that you registered a webhook endpoint subscribed to invoice.transmitted.decrypted for the customer tenant.

Key Fields Explained: invoice.transmitted.decrypted

Field Type Description
event string Always invoice.transmitted.decrypted
source string Always taxly
irn string Invoice Reference Number - unique identifier
status string TRANSMITTED
customer_tin string TIN of the customer (buyer) read from the decrypted invoice. This is the TIN matched to your tenant
supplier_tin string TIN of the supplier (seller) read from the decrypted invoice
invoice_payload object | string The decrypted invoice exactly as returned by NRS
is_json_payload boolean true when invoice_payload is a JSON object, false when it is a raw string
timestamp string ISO 8601 time Taxly sent the webhook

Key Fields Explained: exchange_invoice.received

This older event carries NRS exchange details rather than the decrypted invoice. It is only sent when Taxly can resolve your tenant from the exchange data, which is not always possible because NRS masks party TINs. Use invoice.transmitted.decrypted to reliably receive invoices.

Field Type Description
irn string Invoice Reference Number - unique identifier
direction string INCOMING for invoices you receive
status string Current status: TRANSMITTED
buyer_tin string Your TIN as the buyer
seller_tin string Supplier's TIN
source string Always FIRS_EXCHANGE
received_at string ISO 8601 timestamp when Taxly received the invoice
invoice_data object Complete invoice details from NRS
invoice_line[].hsn_code string Harmonized System Number for goods. Must be paired with product_category. Mutually exclusive with isic_code / service_category.
invoice_line[].product_category string Product category label. Required when hsn_code is present.
invoice_line[].isic_code string International Standard Industrial Classification code for services. Must be paired with service_category. Mutually exclusive with hsn_code / product_category.
invoice_line[].service_category string Service category label. Required when isic_code is present.

API Endpoints

Integrator Status

Endpoint: GET /api/v1/integrators/status

Authentication: None (public)

Query params: tenant_id or email (one required)

First key issuance (no Taxly login required): When generating your first API key, no authentication is required. This is allowed only when the tenant is approved and has no API keys yet. Subsequent calls should use the issued API key for authentication.

⚠️ Legacy keys deprecate in 14 days: Legacy (non-tenant) keys continue to work during a 14-day grace period and will then expire. Rotate to tenant-bound API keys promptly.

API key header format: for integrator endpoints, use x-api-key: your_key_here. Do not send it as a Bearer token. For key rotation, use POST /api/v1/integrators/{tenant}/api-keys/regenerate with the currently active key in the header.

Invoice Operations

Search Invoices

Endpoint: GET /api/v1/invoices/search/{business_id}

Parameters: only the business_id path parameter. The response is NRS's search result for that business; no filters are applied by Taxly.

Download Invoice

Endpoint: GET /api/v1/invoices/{irn}/download

Response: JSON from NRS containing the invoice encrypted as { iv_hex, pub, data } (not a PDF). It is encrypted with Taxly's NRS credentials, so to receive the readable invoice use the invoice.transmitted.decrypted webhook. NRS only allows this download once the invoice has been acknowledged.

Confirm Invoice

Endpoint: GET /api/v1/invoices/{irn}/confirm

Purpose: Confirms the invoice with NRS and returns its status (issue date, due date, payment status, transmitted and delivered flags)

Transmit Invoice

Endpoint: POST /api/v1/invoices/{irn}/transmit

Body: optional webhook_url. When supplied, Taxly posts invoice.transmission.status updates for this transmission to it. The decrypted invoice is sent only to the customer's registered webhook endpoints.

Health Check

Endpoint: GET /api/v1/invoices/transmit/health-check

Purpose: Checks that Taxly can reach the NRS transmission service. It does not test your webhook endpoint.

Webhook Management

List Webhooks

Endpoint: GET /api/v1/webhooks

Behavior: Returns webhook endpoints connected to the authenticated tenant_id.

Create Webhook

Endpoint: POST /api/v1/webhooks

Behavior: Creates the webhook endpoint directly under the authenticated integrator tenant_id.

Update Webhook

Endpoint: PUT/PATCH /api/v1/webhooks/{id}

Behavior: Updates an existing webhook endpoint. Supports partial updates.

Authorization: You can only update webhooks that belong to your authenticated tenant.

Special Feature: You can now update the tenant_id to transfer webhook ownership between tenants.

Request Parameters:
Field Type Required Description
url string No Webhook endpoint URL (must be HTTPS)
secret string No Secret key for webhook signature validation (minimum 10 characters)
events array No Array of events to subscribe to
description string No Description of the webhook endpoint (max 255 characters)
name string No Name for the webhook endpoint (max 100 characters)
tenant_id integer No NEW: Update the tenant ownership of this webhook
Example Request - Update URL and Secret:
curl -X PATCH "https://api.taxly.com/api/v1/webhooks/123" \
  -H "x-api-key: taxly_abc123xyz789..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://newdomain.com/webhooks/taxly/invoices",
    "secret": "new_webhook_secret_12345"
}'
Example Request - Transfer Tenant Ownership:
curl -X PATCH "https://api.taxly.com/api/v1/webhooks/123" \
  -H "x-api-key: taxly_abc123xyz789..." \
  -H "Content-Type: application/json" \
  -d '{
    "tenant_id": 25,
    "description": "Transferred webhook for new tenant"
}'
Example Response:
{
    "success": true,
    "data": {
        "endpoint": {
            "id": 123,
            "tenant_id": 24,
            "url": "https://newdomain.com/webhooks/taxly/invoices",
            "secret": "new_webhook_secret_12345",
            "subscribed_events": ["exchange_invoice.received", "invoice.transmitted.decrypted"],
            "message": "Production Webhook",
            "forward_status": "pending",
            "irn": "CONFIG-24-65f1c0a1b2c3d",
            "created_at": "2026-04-17T12:00:00Z",
            "updated_at": "2026-04-17T15:30:00Z"
        }
    },
    "message": "Webhook endpoint updated successfully"
}
⚠️ Important Notes:
  • You can only update webhooks that belong to your currently authenticated tenant
  • When updating tenant_id, the webhook will be transferred to the new tenant
  • Duplicate URL validation prevents conflicts within the same tenant
  • All standard validation rules apply (URL format, secret length, event validity, etc.)

Delete Webhook

Endpoint: DELETE /api/v1/webhooks/{id}

Behavior: Deletes a webhook endpoint.

Authorization: You can only delete webhooks that belong to your authenticated tenant.

Error Handling

Common API Responses

HTTP status Meaning Resolution
401 Missing or invalid API key Send x-api-key: your_key and check the key is active
403 The key does not belong to the tenant in the URL Use the tenant ID that owns the API key
404 Tenant, webhook or resource not found Verify the ID in the URL
409 A webhook endpoint with this URL already exists for your tenant Update the existing endpoint instead
422 Validation failed, or the maximum of 10 webhook endpoints per tenant was reached Check the data field of the response for the failing fields

Webhook Delivery and Retries

Taxly makes one delivery attempt per endpoint, with a 30 second timeout:

  • A 2xx response marks the delivery as success
  • Any other status, or a timeout, marks it as failed and the decrypted invoice is kept
  • Every attempt is recorded with its HTTP status and response body

Taxly does not retry automatically. After fixing your endpoint, ask Taxly support to retry the delivery for the IRN. Because a retry can deliver an invoice more than once, make your handler idempotent (see Best Practices).

Error Response Format

API errors use this shape; data is only present when there are details:

{
    "success": false,
    "message": "A webhook endpoint with this URL already exists for your tenant.",
    "data": {
        "existing_endpoint": { "id": 7, "url": "https://yourdomain.com/webhook" }
    }
}

Best Practices

1. Webhook Security

Implement webhook signature validation:

// Example validation
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '';
$expectedSignature = hash_hmac('sha256', $payload, 'your_webhook_secret');

if (!hash_equals($signature, $expectedSignature)) {
    http_response_code(401);
    exit('Unauthorized');
}

2. Idempotent Processing

Always check if you've already processed an invoice by IRN:

$existingInvoice = YourInvoiceModel::where('irn', $webhookData['irn'])->first();
if ($existingInvoice) {
    return response()->json(['status' => 'already_processed']);
}

3. Error Handling

Implement comprehensive error handling:

try {
    // Process invoice
    $this->processInvoice($webhookData);
    return response()->json(['status' => 'success']);
} catch (ValidationException $e) {
    Log::error('Invoice validation failed', ['irn' => $webhookData['irn'], 'errors' => $e->errors()]);
    return response()->json(['status' => 'validation_failed'], 422);
} catch (Exception $e) {
    Log::error('Invoice processing failed', ['irn' => $webhookData['irn'], 'error' => $e->getMessage()]);
    return response()->json(['status' => 'processing_failed'], 500);
}

4. Logging

Log all webhook events for debugging:

Log::info('Webhook received', [
    'irn' => $webhookData['irn'],
    'customer_tin' => $webhookData['customer_tin'],
    'supplier_tin' => $webhookData['supplier_tin'],
    'timestamp' => now()->toIso8601String()
]);

5. Response Time

Keep webhook processing under 30 seconds:

  • Validate quickly
  • Store data immediately
  • Process business logic asynchronously
  • Return response promptly

Testing

Test Your Webhook Endpoint

Taxly has no endpoint that sends a test event to your webhook, so test your handler by posting the sample below to it yourself. When your endpoint has a secret, sign the exact body with HMAC-SHA256 and send it in X-Webhook-Signature:

BODY='{"event":"invoice.transmitted.decrypted","source":"taxly","irn":"TEST-INV-123456","status":"TRANSMITTED","customer_tin":"12345678-0001","supplier_tin":"87654321-0001","invoice_payload":{"irn":"TEST-INV-123456","document_currency_code":"NGN"},"is_json_payload":true,"timestamp":"2026-10-13T12:00:00+00:00"}'
SIGNATURE=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "your_webhook_secret" | awk '{print $2}')

curl -X POST https://yourdomain.com/webhook \
  -H "Content-Type: application/json" \
  -H "X-Webhook-Source: Taxly" \
  -H "X-Webhook-Event: invoice.transmitted.decrypted" \
  -H "X-Webhook-Signature: $SIGNATURE" \
  -d "$BODY"

Sample Invoice Data

Use this sample body to test your webhook processing:

{
    "event": "invoice.transmitted.decrypted",
    "source": "taxly",
    "irn": "TEST-INV-123456",
    "status": "TRANSMITTED",
    "customer_tin": "12345678-0001",
    "supplier_tin": "87654321-0001",
    "invoice_payload": {
        "irn": "TEST-INV-123456",
        "invoice_kind": "B2B",
        "issue_date": "2026-10-13",
        "invoice_type_code": "380",
        "document_currency_code": "NGN",
        "accounting_supplier_party": {
            "party_name": "Test Seller Company",
            "tin": "87654321-0001"
        },
        "accounting_customer_party": {
            "party_name": "Test Buyer Company",
            "tin": "12345678-0001"
        }
    },
    "is_json_payload": true,
    "timestamp": "2026-10-13T12:00:00+00:00"
}

Troubleshooting

Common Issues

1. Not Receiving Webhooks

Check:

  • Your webhook endpoint is registered under the correct integrator tenant_id
  • It is subscribed to invoice.transmitted.decrypted
  • Your tenant TIN exactly matches the customer TIN on the invoice
  • Webhook URL is accessible via HTTPS
  • URL returns HTTP 200 status
  • Processing time is under 30 seconds
  • No firewall blocking Taxly IPs

Debug:

# Test your webhook endpoint
curl -X POST https://yourdomain.com/webhook \
  -H "Content-Type: application/json" \
  -H "X-Webhook-Source: Taxly" \
  -H "X-Webhook-Event: invoice.transmitted.decrypted" \
  -d '{"test": "payload"}'

2. TIN Not Found

Resolution:

  • Verify your tenant TIN is registered in Taxly and the tenant is an approved integrator
  • Check the TIN format: 8 digits, a dash and 4 digits, for example 12345678-0001
  • The customer TIN is read from the decrypted invoice, so it must match your tenant TIN exactly
  • Invoices with no matching tenant are kept by Taxly; contact support with the IRN and they can retry delivery

3. Webhook Authentication Failing

Check:

  • API key is active and not expired
  • Header format: x-api-key: your_api_key (not a Bearer token)
  • API key has correct permissions

4. Invoice Processing Errors

Common Causes:

  • Invalid JSON payload
  • Missing required fields
  • Database connection issues
  • Validation failures

Support

For technical support:

Debug Information

Include this information when contacting support:

  • Your tenant ID
  • API key ID (not the key itself)
  • IRN of problematic invoices
  • Webhook endpoint URL
  • Error messages and timestamps
  • Request/response logs

Changelog

Incoming Invoice Flow and Webhook Updates

Taxly now acknowledges each invoice sent to your organization through NRS Exchange automatically, downloads and decrypts it, and routes it to you by the customer TIN found inside the decrypted invoice. The invoice.transmitted.decrypted webhook payload has a new, flat structure.

Action required

  1. Check your tenant TIN. NRS masks party TINs until an invoice is acknowledged, so Taxly can only identify the customer after decrypting the invoice. Your registered tenant TIN must exactly match the customer TIN on invoices addressed to you, in the format 12345678-0001. TINs in other formats, such as 123456789, will not match.
  2. Subscribe an endpoint to invoice.transmitted.decrypted. This event carries the full decrypted invoice. For invoices you transmit through POST /api/v1/invoices/{irn}/transmit, the optional webhook_url only receives invoice.transmission.status updates. The decrypted invoice goes to the customer's registered webhook endpoints.
  3. Update your webhook receiver for the new payload. The body is now flat. The old wrapper (tenant_id, endpoint_id, webhook_url, headers and a nested payload object) has been removed. The fields are event, source, irn, status, customer_tin, supplier_tin, invoice_payload, is_json_payload and timestamp. invoice_payload is a JSON object when the decrypted content is valid JSON, otherwise a raw string, so handle both. It now includes invoice_kind (for example "B2B").
  4. Verify signatures against the raw body. When your endpoint has a secret, X-Webhook-Signature is an HMAC-SHA256 of the raw request body. Verify it against the raw bytes, not re-serialized JSON.
  5. Respond with 2xx within 30 seconds. Any other status, or no response within 30 seconds, is recorded as a failed delivery.
  6. Keep one registration per URL. A URL registered more than once receives each invoice once per registration.

Process changes

  • Acknowledgement to NRS is automatic and needs nothing from you. NRS only releases the invoice for download after it has been acknowledged.
  • The customer is resolved from the decrypted invoice and matched to an approved integrator tenant with the same TIN.
  • If no approved tenant matches the customer TIN, nothing is sent to any webhook. Taxly keeps the decrypted invoice and delivery is retried once a matching tenant exists. Taxly also keeps the invoice if delivery to your endpoint fails.

Webhook endpoint API changes

Item Change
irn Now generated as CONFIG-{tenant_id}-{unique id} (previously CONFIG-{tenant_id}). Treat it as an opaque value.
forward_status Legacy field, always pending. Ignore it.
description Still accepted but not stored or returned.
Listing Also includes older endpoints still linked to one of your organizations, not only those matching your tenant_id.
Error responses The "Failed to process invoice" response no longer includes error_code: "VALIDATION_FAILED". Do not depend on that field.

URLs, HTTP methods, authentication and request payloads for the existing API endpoints are unchanged.

Compliance

NRS Exchange Compliance

  • ✅ Compliant with NRS Exchange specifications
  • ✅ Proper invoice routing and acknowledgment
  • ✅ Audit trail for all transactions
  • ✅ Secure data transmission
  • ✅ Failed deliveries are kept and can be retried

Data Protection

  • All data is encrypted in transit and at rest
  • Webhook payloads contain only necessary information
  • API keys are securely generated and stored
  • Access logs are maintained for audit purposes

Quick Start Checklist

Version: 1.1.0

Last Updated: October 13, 2026

API Version: v1