Businesses

Create businesses, configure FIRS settings, upload crypto keys, and manage APP provider connections

Create and manage businesses on the Earnipay platform. Each business represents a legal entity with its own FIRS configuration, team members, customers, products, and invoices. Users can belong to multiple businesses with different roles.

Endpoints

MethodEndpointDescription
POST/v1/businessesCreate a new business
GET/v1/businessesList your businesses
GET/v1/businesses/{id}Get business details
PATCH/v1/businesses/{id}Update a business
DELETE/v1/businesses/{id}Delete a business (soft delete)
PATCH/v1/businesses/{id}/settingsUpdate business settings
PATCH/v1/businesses/{id}/firs-configUpdate FIRS configuration
PATCH/v1/businesses/{id}/crypto-keysUpload FIRS crypto keys file
PATCH/v1/businesses/{id}/app-configConfigure APP connection
POST/v1/businesses/{id}/test-app-connectionTest APP connection
PATCH/v1/businesses/{id}/app-providerUpdate APP provider
GET/v1/businesses/providers/supportedList supported APP providers
PATCH/v1/businesses/{id}/interswitch-credentialsUpdate Interswitch credentials
POST/v1/businesses/{id}/test-interswitch-connectionTest Interswitch connection
POST/v1/businesses/{id}/set-defaultSet as default business
POST/v1/businesses/uploadUpload a file (e.g., logo)
🔑

All endpoints on this page require authentication. See Authentication for details.


Create a Business

Register a new business entity with its tax identification and address details.

curl -X POST https://e-invoicing.earnipay.com/v1/businesses \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Okafor Trading Ltd",
    "TIN": "12345678-0001",
    "businessType": "LLC",
    "address": "15 Marina Road",
    "city": "Lagos",
    "state": "Lagos",
    "country": "Nigeria",
    "logoUrl": "https://example.com/logo.png",
    "firsEmail": "[email protected]",
    "firsPassword": "firs-portal-password"
  }'
ParameterTypeRequiredDescription
namestringYesBusiness legal name
TINstringYesTax Identification Number
businessTypestringYesOne of: SOLE_PROPRIETORSHIP, PARTNERSHIP, LLC, CORPORATION, NON_PROFIT, OTHER
addressstringYesStreet address
citystringYesCity
statestringYesState
countrystringYesCountry
logoUrlstringNoURL to business logo (use the upload endpoint first)
firsEmailstringNoEmail registered with FIRS
firsPasswordstringNoFIRS portal password
{
  "statusCode": 201,
  "message": "Business created successfully.",
  "data": {
    "id": "biz_xyz789",
    "name": "Okafor Trading Ltd",
    "TIN": "12345678-0001",
    "businessType": "LLC",
    "address": "15 Marina Road",
    "city": "Lagos",
    "state": "Lagos",
    "country": "Nigeria",
    "logoUrl": "https://example.com/logo.png",
    "firsEmail": "[email protected]",
    "settings": {
      "requireApproval": false,
      "autoSubmitToFirs": false
    },
    "firsConfig": null,
    "appProvider": null,
    "createdAt": "2026-03-13T10:00:00.000Z",
    "updatedAt": "2026-03-13T10:00:00.000Z"
  }
}

List Businesses

Retrieve all businesses associated with your account.

curl https://e-invoicing.earnipay.com/v1/businesses \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
{
  "statusCode": 200,
  "message": "Businesses retrieved successfully.",
  "data": [
    {
      "id": "biz_xyz789",
      "name": "Okafor Trading Ltd",
      "TIN": "12345678-0001",
      "businessType": "LLC",
      "city": "Lagos",
      "state": "Lagos",
      "country": "Nigeria",
      "createdAt": "2026-03-13T10:00:00.000Z"
    }
  ]
}

Get Business Details

Retrieve full details for a specific business, including its FIRS configuration and APP provider settings.

curl https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
{
  "statusCode": 200,
  "message": "Business retrieved successfully.",
  "data": {
    "id": "biz_xyz789",
    "name": "Okafor Trading Ltd",
    "TIN": "12345678-0001",
    "businessType": "LLC",
    "address": "15 Marina Road",
    "city": "Lagos",
    "state": "Lagos",
    "country": "Nigeria",
    "logoUrl": "https://example.com/logo.png",
    "firsEmail": "[email protected]",
    "settings": {
      "requireApproval": true,
      "autoSubmitToFirs": false
    },
    "firsConfig": {
      "businessId": "FIRS-BIZ-001",
      "serviceId": "FIRS-SVC-001"
    },
    "appProvider": {
      "name": "interswitch",
      "isConnected": true
    },
    "createdAt": "2026-03-13T10:00:00.000Z",
    "updatedAt": "2026-03-13T12:30:00.000Z"
  }
}

Update a Business

Update business details. Send only the fields you want to change.

curl -X PATCH https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Okafor Trading International Ltd",
    "address": "42 Victoria Island Blvd"
  }'
{
  "statusCode": 200,
  "message": "Business updated successfully.",
  "data": {
    "id": "biz_xyz789",
    "name": "Okafor Trading International Ltd",
    "address": "42 Victoria Island Blvd",
    "city": "Lagos",
    "state": "Lagos",
    "country": "Nigeria",
    "updatedAt": "2026-03-13T14:00:00.000Z"
  }
}

Delete a Business

Soft-delete a business. The business and its data are retained but marked as deleted and no longer accessible through normal queries.

curl -X DELETE https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
{
  "statusCode": 200,
  "message": "Business deleted successfully."
}
⚠️

Deleting a business is a soft delete — the record is preserved for historical and compliance purposes but becomes inaccessible. Only business owners can delete a business.


Business Settings

Configure approval workflows and automatic FIRS submission for a business.

curl -X PATCH https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789/settings \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "requireApproval": true,
    "autoSubmitToFirs": true
  }'
ParameterTypeRequiredDescription
requireApprovalbooleanNoWhen true, invoices move to PENDING_APPROVAL status and require manual approval before submission
autoSubmitToFirsbooleanNoWhen true, approved invoices are automatically submitted to FIRS via the configured APP provider
{
  "statusCode": 200,
  "message": "Business settings updated successfully.",
  "data": {
    "requireApproval": true,
    "autoSubmitToFirs": true
  }
}
💡

When both settings are enabled, invoices follow the full workflow: DRAFTPENDING_APPROVALAPPROVED → automatically submitted to FIRS. When requireApproval is false, invoices skip the approval step.


FIRS Configuration

Update FIRS Config

Set the FIRS Business ID and Service ID for your business. These identifiers are assigned by FIRS when you register for e-invoicing.

curl -X PATCH https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789/firs-config \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "businessId": "FIRS-BIZ-001",
    "serviceId": "FIRS-SVC-001"
  }'
ParameterTypeRequiredDescription
businessIdstringYesYour FIRS-assigned Business ID
serviceIdstringYesYour FIRS-assigned Service ID
{
  "statusCode": 200,
  "message": "FIRS configuration updated successfully.",
  "data": {
    "businessId": "FIRS-BIZ-001",
    "serviceId": "FIRS-SVC-001"
  }
}

Upload Crypto Keys

Upload the crypto_keys.txt file provided by FIRS. This file contains the RSA public key used to encrypt QR codes on invoices.

curl -X PATCH https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789/crypto-keys \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -F "file=@crypto_keys.txt"
ParameterTypeRequiredDescription
filefileYesThe crypto_keys.txt file from FIRS (contains RSA public key)
{
  "statusCode": 200,
  "message": "Crypto keys uploaded successfully."
}

APP Provider Configuration

Configure an Access Point Provider (APP) to submit invoices to FIRS. APPs are licensed service providers in Nigeria's e-invoicing network that handle secure invoice signing and transmission.

List Supported Providers

Get the list of APP providers that Earnipay supports.

curl https://e-invoicing.earnipay.com/v1/businesses/providers/supported \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
{
  "statusCode": 200,
  "message": "Supported providers retrieved successfully.",
  "data": [
    {
      "name": "interswitch",
      "displayName": "Interswitch",
      "description": "Submit invoices to FIRS via Interswitch"
    }
  ]
}

Update APP Provider

Set which APP provider to use for this business.

curl -X PATCH https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789/app-provider \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "interswitch"
  }'
{
  "statusCode": 200,
  "message": "APP provider updated successfully.",
  "data": {
    "name": "interswitch",
    "isConnected": false
  }
}

Configure APP Connection

Provide the connection details for your APP provider.

curl -X PATCH https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789/app-config \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "apiUrl": "https://app-provider.example.com/api",
    "apiKey": "your-app-provider-api-key",
    "clientId": "your-client-id"
  }'

Test APP Connection

Verify that the APP provider connection is working before submitting invoices.

curl -X POST https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789/test-app-connection \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
{
  "statusCode": 200,
  "message": "APP connection test successful.",
  "data": {
    "connected": true
  }
}
{
  "statusCode": 400,
  "message": "APP connection test failed. Please check your configuration.",
  "data": {
    "connected": false,
    "error": "Unable to reach the APP provider endpoint."
  }
}

Interswitch Integration

If you're using Interswitch as your APP provider, configure and test the connection with these endpoints.

Update Interswitch Credentials

curl -X PATCH https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789/interswitch-credentials \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "clientId": "ISW-CLIENT-12345",
    "clientSecret": "isw-secret-key",
    "merchantCode": "MX12345"
  }'
ParameterTypeRequiredDescription
clientIdstringYesInterswitch client ID
clientSecretstringYesInterswitch client secret
merchantCodestringYesYour Interswitch merchant code
{
  "statusCode": 200,
  "message": "Interswitch credentials updated successfully."
}

Test Interswitch Connection

curl -X POST https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789/test-interswitch-connection \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
{
  "statusCode": 200,
  "message": "Interswitch connection test successful.",
  "data": {
    "connected": true
  }
}

Set Default Business

Set a business as your default. The default business is used when no business ID is specified in API calls that require one.

curl -X POST https://e-invoicing.earnipay.com/v1/businesses/biz_xyz789/set-default \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
{
  "statusCode": 200,
  "message": "Default business set successfully."
}

Upload File

Upload a file (such as a business logo) to cloud storage. Returns a URL you can use in other API calls.

curl -X POST https://e-invoicing.earnipay.com/v1/businesses/upload \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -F "[email protected]"
{
  "statusCode": 200,
  "message": "File uploaded successfully.",
  "data": {
    "url": "https://storage.earnipay.com/uploads/company-logo-abc123.png"
  }
}

Use the returned url as the logoUrl when creating or updating a business.


Setup Checklist

To fully configure a business for FIRS e-invoicing, complete these steps in order:

  1. Create the businessPOST /v1/businesses with your TIN and business details
  2. Update FIRS configPATCH /v1/businesses/{id}/firs-config with your FIRS Business ID and Service ID
  3. Upload crypto keysPATCH /v1/businesses/{id}/crypto-keys with the crypto_keys.txt file from FIRS
  4. Choose an APP providerPATCH /v1/businesses/{id}/app-provider
  5. Configure the providerPATCH /v1/businesses/{id}/app-config or PATCH /v1/businesses/{id}/interswitch-credentials
  6. Test the connectionPOST /v1/businesses/{id}/test-app-connection or POST /v1/businesses/{id}/test-interswitch-connection
  7. Configure settingsPATCH /v1/businesses/{id}/settings to enable approval workflows and auto-submit

Error Handling

Status CodeErrorDescription
400Bad RequestInvalid parameters or failed connection test
401UnauthorizedMissing or expired access token
403ForbiddenYou don't have permission (e.g., not an OWNER or ADMIN)
404Not FoundBusiness ID doesn't exist or was deleted
409ConflictBusiness with this TIN already exists
{
  "statusCode": 403,
  "message": "You do not have permission to perform this action.",
  "error": "Forbidden"
}