Invoices
Invoice management API endpoints
Invoices API
Manage invoices in your organization.
Base Path
/api/invoicesEndpoints
List Invoices
List all invoices in your organization.
GET /api/invoicesQuery Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
includeInactive | boolean | No | Include inactive records in the results |
Example Request:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/invoicesExample Response:
[
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organizationId": "org_123",
"status": "active",
"createdAt": "2025-01-15T10:30:00Z",
"updatedAt": "2025-01-15T10:30:00Z"
}
]Get Invoice
Retrieve a specific invoice by ID.
GET /api/invoices/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Invoice ID |
Example Request:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/invoices/123e4567-e89b-12d3-a456-426614174000Error Responses:
404 Not Found- Invoice not found
Create Invoice
Create a new invoice.
POST /api/invoicesRequest Body:
{
"status": "active"
}Example Request:
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "active"}' \
https://api.glapi.io/api/invoicesUpdate Invoice
Update an existing invoice.
PUT /api/invoices/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Invoice ID |
Request Body:
Provide only the fields you want to update. All fields are optional.
{
"status": "inactive"
}Example Request:
curl -X PUT \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "inactive"}' \
https://api.glapi.io/api/invoices/123e4567-e89b-12d3-a456-426614174000Error Responses:
404 Not Found- Invoice not found
Delete Invoice
Delete a invoice.
DELETE /api/invoices/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Invoice ID |
Example Request:
curl -X DELETE \
-H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/invoices/123e4567-e89b-12d3-a456-426614174000Example Response:
{
"success": true
}Error Responses:
404 Not Found- Invoice not found
Code Examples
TypeScript
import { createTRPCClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '@glapi/trpc';
const client = createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: 'https://api.glapi.io/api/trpc',
headers: () => ({
Authorization: `Bearer ${process.env.GLAPI_TOKEN}`,
}),
}),
],
});
// List invoices
const items = await client.invoices.list.query();
// Get invoice
const item = await client.invoices.get.query({
id: '123e4567-e89b-12d3-a456-426614174000'
});
// Create invoice
const newItem = await client.invoices.create.mutate({
status: 'active',
});
// Update invoice
const updated = await client.invoices.update.mutate({
id: '123e4567-e89b-12d3-a456-426614174000',
data: {
status: 'inactive',
},
});
// Delete invoice
await client.invoices.delete.mutate({
id: '123e4567-e89b-12d3-a456-426614174000'
});Python
import requests
import os
API_BASE = 'https://api.glapi.io/api'
TOKEN = os.environ.get('GLAPI_TOKEN')
HEADERS = {
'Authorization': f'Bearer {TOKEN}',
'Content-Type': 'application/json',
}
# List invoices
response = requests.get(f'{API_BASE}/invoices', headers=HEADERS)
items = response.json()
# Get invoice
response = requests.get(
f'{API_BASE}/invoices/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS
)
item = response.json()
# Create invoice
response = requests.post(
f'{API_BASE}/invoices',
headers=HEADERS,
json={'status': 'active'}
)
new_item = response.json()
# Update invoice
response = requests.put(
f'{API_BASE}/invoices/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS,
json={'status': 'inactive'}
)
updated = response.json()
# Delete invoice
response = requests.delete(
f'{API_BASE}/invoices/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS
)