Get started

Quick start

Make your first call, create a customer, raise an invoice and receive a webhook. It takes about 15 minutes against a staging organization.

You need a staging organization and an API key for it with the scopes customers:write, invoices:write and webhooks:manage. Your organization's admin creates the key: see Set up an integration.

  1. Set your key and base URL#

    Every example on this site reads two environment variables, so the same code runs against staging and production and the key never appears in your source.

    Shell
    export FLUX_BASE_URL="https://<your Flux API host>"
    export FLUX_API_KEY="flx_live_…"

    On Windows PowerShell:

    PowerShell
    $env:FLUX_BASE_URL = "https://<your Flux API host>"
    $env:FLUX_API_KEY = "flx_live_…"
    EnvironmentAPI base URLUse
    Productionproduction API base URLYour organization's live data.
    Staginghttps://erpapi.osigla.com.ng confirm the staging URL can be publishedFor building and testing, with a staging organization. how integrators get staging access
  2. Make your first call#

    List one customer. A 200 means your key works.

    curl "$FLUX_BASE_URL/api/v1/customers?limit=1" \
      -H "Authorization: ApiKey $FLUX_API_KEY"
    200 OK

    A new staging organization may have no customers yet, so data can be empty.

    200 OK
    {
      "data": [],
      "nextCursor": null,
      "hasMore": false
    }

    A 401 unauthorized means the key is missing, mistyped or revoked. Check the header is Authorization: ApiKey flx_live_…, with the word ApiKey, not Bearer.

  3. Create a customer#

    Use your own id for the customer as externalRef, so you can find it again. The Idempotency-Key makes the request safe to retry.

    curl -X POST "$FLUX_BASE_URL/api/v1/customers" \
      -H "Authorization: ApiKey $FLUX_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: create-customer-ws_42" \
      -d '{
      "customerType": "company",
      "companyName": "Leadway Group",
      "legalName": "Leadway Group Plc",
      "email": "finance@leadway.example",
      "phone": "+2348012345678",
      "address": "121 Funso Williams Ave, Lagos",
      "taxId": "12345678-0001",
      "vatNumber": "VAT-001",
      "rcNumber": "RC123456",
      "externalRef": "ws_42",
      "regulatedEntityCount": 3,
      "defaultCurrency": "NGN",
      "contacts": [
        {
          "name": "Finance",
          "email": "finance@leadway.example",
          "isBillingPrimary": true,
          "ccOnInvoices": false
        },
        {
          "name": "CFO",
          "email": "cfo@leadway.example",
          "isBillingPrimary": false,
          "ccOnInvoices": true
        }
      ]
    }'
    201 Created
    201 Created
    {
      "id": 812,
      "externalRef": "ws_42",
      "customerType": "company",
      "name": "Leadway Group Plc",
      "legalName": "Leadway Group Plc",
      "companyName": "Leadway Group",
      "firstName": null,
      "lastName": null,
      "email": "finance@leadway.example",
      "phone": "+2348012345678",
      "address": "121 Funso Williams Ave, Lagos",
      "taxId": "12345678-0001",
      "vatNumber": "VAT-001",
      "rcNumber": "RC123456",
      "parentCustomerId": null,
      "regulatedEntityCount": 3,
      "defaultCurrency": "NGN",
      "defaultSettlementBankId": null,
      "contacts": [
        {
          "name": "Finance",
          "email": "finance@leadway.example",
          "phone": null,
          "isBillingPrimary": true,
          "ccOnInvoices": false
        },
        {
          "name": "CFO",
          "email": "cfo@leadway.example",
          "phone": null,
          "isBillingPrimary": false,
          "ccOnInvoices": true
        }
      ],
      "createdAt": "2026-11-01T10:20:00",
      "updatedAt": null
    }

    Keep the id: you need it to raise an invoice.

  4. Raise an invoice#

    Invoice lines reference services in the organization's catalogue by serviceId. The API can't list services yet, so ask your organization's admin for the ids. The examples use 7 and 9.

    curl -X POST "$FLUX_BASE_URL/api/v1/invoices" \
      -H "Authorization: ApiKey $FLUX_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: invoice-ws_42-2026-11" \
      -d '{
      "externalRef": "ws_42-2026-11",
      "customerId": 812,
      "currency": "NGN",
      "dueDate": "2026-11-15",
      "discount": 0,
      "periodStart": "2026-11-01",
      "periodEnd": "2026-11-30",
      "invoiceType": "subscription",
      "nextDueDate": "2026-12-01",
      "comments": "November subscription",
      "lines": [
        {
          "serviceId": 7,
          "quantity": 3,
          "unitPrice": 250000,
          "detail": "3 entities"
        },
        {
          "serviceId": 9,
          "amount": 50000
        }
      ]
    }'
    201 Created
    201 Created
    {
      "id": 5012,
      "number": "MAX-2026-0042",
      "externalRef": "ws_42-2026-11",
      "customerId": 812,
      "currency": "NGN",
      "status": "awaiting_approval",
      "overdue": false,
      "paymentStatus": null,
      "invoiceType": "subscription",
      "periodStart": "2026-11-01T00:00:00",
      "periodEnd": "2026-11-30T00:00:00",
      "nextDueDate": "2026-12-01T00:00:00",
      "createdAt": "2026-11-01T09:00:00",
      "approvedAt": null,
      "dueDate": "2026-11-15T00:00:00",
      "paidAt": null,
      "subtotal": 800000.00,
      "discount": 0.00,
      "taxableNet": 800000.00,
      "vatAmount": 60000.00,
      "vatLabel": "VAT (7.5%)",
      "total": 860000.00,
      "lines": [
        {
          "serviceId": 7,
          "description": "Subscription — 3 entities (3 × 250,000.00)",
          "detail": "3 entities",
          "quantity": 3,
          "unitPrice": 250000.00,
          "amount": 750000.00
        },
        {
          "serviceId": 9,
          "description": "Onboarding",
          "detail": null,
          "quantity": 1,
          "unitPrice": 50000.00,
          "amount": 50000.00
        }
      ],
      "payments": null
    }
    Nothing goes to the customer yet

    The invoice is awaiting_approval. Flux notifies the organization's reviewers, not the customer. The customer gets the invoice by email only when it's approved. Approve it in the staging app to see invoice.approved and invoice.issued arrive.

    Send the same request again. You get 200 and the same invoice, because the externalRef was already used. That's how you avoid double billing.

  5. Receive your first webhook#

    Register an https URL you control. For a quick look, use a request inspector; for real work, your own endpoint.

    curl -X POST "$FLUX_BASE_URL/api/v1/webhook-endpoints" \
      -H "Authorization: ApiKey $FLUX_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: endpoint-quickstart" \
      -d '{
      "url": "https://hooks.example.com/flux",
      "description": "Quick start",
      "events": ["*"]
    }'

    The response includes secret, the signing secret. It's shown once. Store it with your API key. Then send a test event:

    curl -X POST "$FLUX_BASE_URL/api/v1/webhook-endpoints/3/test" \
      -H "Authorization: ApiKey $FLUX_API_KEY"

    Within a few seconds your endpoint receives:

    Request your endpoint receives
    POST /flux HTTP/1.1
    Host: hooks.example.com
    Content-Type: application/json
    User-Agent: FluxERP-Webhooks/1
    Flux-Event-Id: evt_01JC8Z5T6Q1W3M4N5P6R7S8T9V
    Flux-Event-Type: webhook.test
    Flux-Signature: t=1793528400,v1=7d6b8ca702474b03c774aa73d62e80609c1db53535dbeb2d19bab0eeede8af5f
    Body (formatted here; Flux sends it as compact JSON)
    {
      "id": "evt_01JC8Z5T6Q1W3M4N5P6R7S8T9V",
      "type": "webhook.test",
      "created": "2026-11-01T10:20:00.4121933Z",
      "data": {
        "object": {
          "endpointId": 3,
          "message": "Test event from Flux ERP"
        }
      }
    }

    Respond with any 2xx within 10 seconds. Then verify the signature before you trust a delivery.

  6. Next steps#