API Reference

Build Powerful Integrations With The Lexora REST API.

Authentication

Authenticate Your API Requests By Including Your Secret API Key In The Authorization Header Of Every Request. You Can Manage Your API Keys In The Lexora Dashboard Under Developer Settings.

Keep Your Keys Secure

Your Secret Keys Carry Many Privileges. Never Share Them In Publicly Accessible Areas Such As GitHub, Client-Side Code, Or Public Forums.

cURL Authentication Example
curl -X GET https://api.lexorabilling.com/v1/account \
  -H "Authorization: Bearer sk_live_4eC39HqLyjWDarjtT1zdp7dc"

Errors & Responses

Lexora Uses Conventional HTTP Response Codes To Indicate The Success Or Failure Of An API Request. In General, Codes In The 2xx Range Indicate Success.

200 OK - Everything Worked As Expected.
400 Bad Request - The Request Was Unacceptable, Often Due To Missing Parameters.
401 Unauthorized - No Valid API Key Provided.
404 Not Found - The Requested Resource Doesn't Exist.
400 Bad Request
{
  "error": {
    "type": "invalid_request_error",
    "message": "The Customer ID Provided Does Not Exist.",
    "param": "customer_id"
  }
}
POST

Create An Invoice

Creates A New Draft Invoice For A Specific Customer. Line Items Can Be Passed Directly In The Request Payload As An Array Of Objects.

Endpoints

https://api.lexorabilling.com/v1/invoices

Parameters

customer_id Required string

The Unique Identifier Of The Customer You Are Billing.

currency Optional string

Three-Letter ISO Currency Code (E.G., usd). Defaults To The Customer's Associated Currency.

line_items Required array

An Array Of Objects Containing Details About The Specific Products Or Services Being Billed. Includes description, amount, And quantity.

cURL Request
curl -X POST https://api.lexorabilling.com/v1/invoices \
  -H "Authorization: Bearer sk_test_4eC39Hq" \
  -H "Content-Type: application/json" \
  -d '{
  "customer_id": "cus_9s6XKzk",
  "currency": "usd",
  "line_items": [
    {
      "description": "Enterprise Software License",
      "amount": 49900,
      "quantity": 1
    }
  ]
}'
200 Response
{
  "id": "inv_1MzX2J",
  "object": "invoice",
  "customer_id": "cus_9s6XKzk",
  "status": "draft",
  "currency": "usd",
  "total": 49900,
  "created_at": 1679001234
}
GET

List All Invoices

Returns A List Of Your Account's Invoices. The Invoices Are Returned Sorted By Creation Date, With The Most Recently Created Invoices Appearing First.

Endpoints

https://api.lexorabilling.com/v1/invoices

Parameters

limit Optional integer

A Limit On The Number Of Objects To Be Returned. Limit Can Range Between 1 And 100. Defaults To 10.

status Optional string

Filter By Invoice Status. Valid Options Are draft, open, paid, Or void.

cURL Request
curl -X GET https://api.lexorabilling.com/v1/invoices?limit=2 \
  -H "Authorization: Bearer sk_test_4eC39Hq"
200 Response
{
  "object": "list",
  "data": [
    {
      "id": "inv_1MzX2J",
      "object": "invoice",
      "status": "paid",
      "total": 49900
    },
    {
      "id": "inv_8KzW1Q",
      "object": "invoice",
      "status": "draft",
      "total": 15000
    }
  ],
  "has_more": true
}