OfficeGest API v2
Getting started with the OfficeGest API v2
OfficeGest API v2
The OfficeGest API v2 allows you to integrate external systems with OfficeGest through a simple and predictable REST interface.
The API v2 is in an experimental phase. Some endpoints may change without prior notice.
Base URL
Each OfficeGest installation has its own address. The base URL follows this format:
https://<your-domain>/api/v2For example, if your OfficeGest is at https://company.officegest.com, the API base URL will be:
https://company.officegest.com/api/v2Authentication
All API requests require a Bearer Token in the Authorization header.
Get your token
To obtain a Bearer Token, send a POST request to the login endpoint with your credentials:
curl -X POST https://company.officegest.com/api/v2/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "your-username", "password": "your-password"}'The response will include your access token:
{
"data": {
"token": "eyJhbGciOiJIUzI1NiIs..."
}
}Keep your token safe. Do not expose it in client-side code or public repositories.
Include the token in every request
Add the Authorization header with the value Bearer followed by your token:
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...Your first request
Let's test the connection by making a simple request to list customers:
curl https://company.officegest.com/api/v2/entities/customers \
-H "Authorization: Bearer your-token-here"const response = await fetch("https://company.officegest.com/api/v2/entities/customers", {
headers: {
"Authorization": "Bearer your-token-here"
}
});
const data = await response.json();
console.log(data);import requests
response = requests.get(
"https://company.officegest.com/api/v2/entities/customers",
headers={"Authorization": "Bearer your-token-here"}
)
print(response.json())$ch = curl_init("https://company.officegest.com/api/v2/entities/customers");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer your-token-here"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;If everything is set up correctly, you'll receive a JSON response with the list of customers.
API Responses
The API always returns JSON. A typical successful response:
{
"data": [ ... ],
"meta": {
"current_page": 1,
"total": 50
}
}Common errors
| Code | Meaning | What to do |
|---|---|---|
401 | Invalid or missing token | Check that the Authorization header is correct |
403 | Forbidden | Your token does not have access to this resource |
404 | Not found | Check the endpoint URL |
422 | Invalid data | Check the fields sent in the request body |
429 | Too many requests | Wait before trying again |
500 | Internal error | Contact support |
Documentation sections
Explore the available endpoints by category in the sidebar.