Chart of Accounts
Chart of accounts management API endpoints
Chart of Accounts API
Manage accounts in your organization.
Base Path
/api/accountsEndpoints
List Chart of Accounts
List all accounts in your organization.
GET /api/accountsQuery 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/accountsExample 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 Account
Retrieve a specific account by ID.
GET /api/accounts/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Account ID |
Example Request:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/accounts/123e4567-e89b-12d3-a456-426614174000Error Responses:
404 Not Found- Account not found
Create Account
Create a new account.
POST /api/accountsRequest 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/accountsUpdate Account
Update an existing account.
PUT /api/accounts/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Account 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/accounts/123e4567-e89b-12d3-a456-426614174000Error Responses:
404 Not Found- Account not found
Delete Account
Delete a account.
DELETE /api/accounts/{id}Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Account ID |
Example Request:
curl -X DELETE \
-H "Authorization: Bearer YOUR_TOKEN" \
https://api.glapi.io/api/accounts/123e4567-e89b-12d3-a456-426614174000Example Response:
{
"success": true
}Error Responses:
404 Not Found- Account 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 accounts
const items = await client.accounts.list.query();
// Get account
const item = await client.accounts.get.query({
id: '123e4567-e89b-12d3-a456-426614174000'
});
// Create account
const newItem = await client.accounts.create.mutate({
status: 'active',
});
// Update account
const updated = await client.accounts.update.mutate({
id: '123e4567-e89b-12d3-a456-426614174000',
data: {
status: 'inactive',
},
});
// Delete account
await client.accounts.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 accounts
response = requests.get(f'{API_BASE}/accounts', headers=HEADERS)
items = response.json()
# Get account
response = requests.get(
f'{API_BASE}/accounts/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS
)
item = response.json()
# Create account
response = requests.post(
f'{API_BASE}/accounts',
headers=HEADERS,
json={'status': 'active'}
)
new_item = response.json()
# Update account
response = requests.put(
f'{API_BASE}/accounts/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS,
json={'status': 'inactive'}
)
updated = response.json()
# Delete account
response = requests.delete(
f'{API_BASE}/accounts/123e4567-e89b-12d3-a456-426614174000',
headers=HEADERS
)