API Docs

Connect JustInvoice with your favorite tools and automate your workflow

REST API

JustInvoice provides a powerful REST API that allows you to programmatically create, manage, and track invoices. Integrate with your existing systems, automate workflows, and build custom solutions that fit your business needs.

RESTful Design

Standard HTTP methods and JSON responses for easy integration

Secure Authentication

API key-based authentication with industry-standard security

High Performance

Fast response times and high availability for production use

API Endpoints

Our API provides endpoints for all major invoice operations. Here are the key endpoints you'll use most frequently:

Method Endpoint Description
POST /api/invoices Create a new invoice with customer details, line items, and payment terms
GET /api/invoices Retrieve a list of invoices within the last 30 days
GET /api/invoices?days={int:days} Retrieve a list of invoices within the last number days specified. Min 1, Max 365
GET /api/invoices/{id} Get detailed information about a specific invoice
POST /api/invoices/{id}/cancelled Mark an invoice as cancelled
POST /api/invoices/{id}/paid Mark an invoice as paid
DELETE /api/invoices/{id} Delete an invoice

API Authentication

JustInvoice API supports two authentication methods to ensure secure access to your account. You can use either method:

X-API-KEY Header

Pass your API key directly in the X-API-KEY header for simple and secure authentication.

X-API-KEY: YOUR_API_KEY
Simple Direct

Authorization Header

Use the Authorization header with ApiKey scheme for standard HTTP authentication patterns.

Authorization: ApiKey YOUR_API_KEY
Standard HTTP Compliant Flexible

Setting Up Stripe Payment Provider

Follow these steps to configure Stripe as your payment provider in JustInvoice:

  1. Login to Stripe - Sign into your Stripe account at dashboard.stripe.com
  2. Navigate to API Keys - Go to DeveloperAPI Keys in your Stripe dashboard
  3. Create Restricted Key - Click Create restricted key to generate a new API key with limited permissions
  4. Set Checkout Session Permission - Set the Checkout Session permission to Write
  5. Set Other Permissions - Ensure all other permissions are set to None for security
  6. Copy API Key - Copy the generated Stripe API Key (it starts with rk_ for restricted keys)
  7. Go to JustInvoice Settings - Navigate to your Settings page on JustInvoice
  8. Paste API Key - Paste your Stripe API Key into the payment provider section
Security Note: Using a restricted key with minimal permissions ensures that JustInvoice can only create checkout sessions and cannot access other parts of your Stripe account.

Code Examples

Get started quickly with these code examples in popular programming languages:

# Create a new invoice

curl -X POST https://api.justinvoice.io/api/invoices \
  -H 'Authorization: ApiKey YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '
    {
        "customerEmail": "bob.smith@example.com",
        "customerFirstName": "Bob",
        "customerLastName": "Smith",
        "customerCompanyName": "Smith Consulting",
        "customerAddress": "123 Main Street",
        "customerCity": "New York",
        "customerProvinceState": "NY",
        "customerPostalCode": "10001",
        "customerCountry": "US",
        "invoiceDate": "2025-08-10T14:30:00Z",
        "invoiceStatus": 5,
        "currencyCode": "USD",
        "noteToCustomer": "Thank you for your business!",
        "lineItems": [
            {
                "description": "Consulting Hours",
                "quantity": 2,
                "unitPrice": 150
            }
        ]
    }'
// Create a new invoice
const createInvoice = async (invoiceData) => {
  const response = await fetch('https://api.justinvoice.io/api/invoices', {
    method: 'POST',
    headers: {
      'Authorization': 'ApiKey YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(invoiceData)
  });
  
  return await response.json();
};

const invoice = await createInvoice({
  customerEmail: 'bob.smith@example.com',
  customerFirstName: 'Bob',
  customerLastName: 'Smith',
  customerCompanyName: 'Smith Consulting',
  customerAddress: '123 Main Street',
  customerCity: 'New York',
  customerProvinceState: 'NY',
  customerPostalCode: '10001',
  customerCountry: 'US',
  invoiceDate: '2025-08-10T14:30:00Z',
  invoiceStatus: 5,
  currencyCode: 'USD',
  noteToCustomer: 'Thank you for your business!',
  lineItems: [{
    description: 'Consulting Hours',
    quantity: 2,
    unitPrice: 150
  }]
});
import requests
import json

def create_invoice(invoice_data):
    url = 'https://api.justinvoice.io/api/invoices'
    headers = {
        'Authorization': 'ApiKey YOUR_API_KEY',
        'Content-Type': 'application/json'
    }
    
    response = requests.post(url, headers=headers, json=invoice_data)
    return response.json()

invoice = create_invoice({
    'customerEmail': 'bob.smith@example.com',
    'customerFirstName': 'Bob',
    'customerLastName': 'Smith',
    'customerCompanyName': 'Smith Consulting',
    'customerAddress': '123 Main Street',
    'customerCity': 'New York',
    'customerProvinceState': 'NY',
    'customerPostalCode': '10001',
    'customerCountry': 'US',
    'invoiceDate': '2025-08-10T14:30:00Z',
    'invoiceStatus': 5,
    'currencyCode': 'USD',
    'noteToCustomer': 'Thank you for your business!',
    'lineItems': [{
        'description': 'Consulting Hours',
        'quantity': 2,
        'unitPrice': 150
    }]
})
using System.Net.Http;
using System.Text.Json;

public async Task CreateInvoiceAsync(InvoiceRequest request)
{
    using var client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", "ApiKey YOUR_API_KEY");
    
    var json = JsonSerializer.Serialize(request);
    var content = new StringContent(json, Encoding.UTF8, "application/json");
    
    var response = await client.PostAsync("https://api.justinvoice.io/api/invoices", content);
    var responseContent = await response.Content.ReadAsStringAsync();
    
    return JsonSerializer.Deserialize(responseContent);
}

var invoice = await CreateInvoiceAsync(new InvoiceRequest
{
    CustomerEmail = "bob.smith@example.com",
    CustomerFirstName = "Bob",
    CustomerLastName = "Smith",
    CustomerCompanyName = "Smith Consulting",
    CustomerAddress = "123 Main Street",
    CustomerCity = "New York",
    CustomerProvinceState = "NY",
    CustomerPostalCode = "10001",
    CustomerCountry = "US",
    InvoiceDate = DateTime.Parse("2025-08-10T14:30:00Z"),
    InvoiceStatus = 5,
    CurrencyCode = "USD",
    NoteToCustomer = "Thank you for your business!",
    LineItems = new[] { 
        new LineItem { 
            Description = "Consulting Hours", 
            Quantity = 2, 
            UnitPrice = 150.00m 
        } 
    }
});

Invoice Status Values

When creating invoices, you can specify the initial status using the invoiceStatus field. Here are the available status values:

Status Value Description Use Case
0 Final - Invoice is created and ready for payment Standard invoice creation, immediately available for customer payment
1 Payment Request Sent - Payment link has been sent to customer When you want to track that payment has been requested
2 Paid - Invoice has been paid by customer Automatically set when payment is received
3 Cancelled - Invoice has been cancelled When you need to void an invoice
4 Failed - Payment attempt failed Automatically set when payment processing fails
5 Draft - Invoice is a draft When you want to save an invoice as a draft
Note: If you don't specify invoiceStatus, it will default to 0 (Final). For most use cases, you can omit this field and let JustInvoice set the appropriate default status. When creating invoices, you can only use Draft (5) or Final (0).

Zapier Integration

We publish a native Zapier integration that makes it simple to create invoices from any of the 5000+ apps supported by Zapier. Automate your invoicing workflow without writing a single line of code.

Create Invoices Automatically

  • Create invoices when new orders come in
  • Generate invoices from form submissions
  • Create invoices from CRM deals
  • Automate invoicing from project management tools
  • Generate invoices from e-commerce sales
  • Create invoices from time tracking apps
Zapier Logo