Get started
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
Every error has a stable data.code. The full catalog, the error body and examples are in Errors.
| Status | data.code | Meaning | What to do |
|---|---|---|---|
401 | UNAUTHENTICATED | Invalid or missing token | Check that the Authorization header is correct |
403 | FORBIDDEN | Forbidden | Your token does not have access to this resource |
404 | NOT_FOUND | Not found | Check the endpoint URL |
422 | VALIDATION_FAILED | Invalid data | Check the fields listed in data.errors |
429 | RATE_LIMITED | Too many requests | Wait the seconds in Retry-After; see Rate limits |
500 | INTERNAL_ERROR | Internal error | Contact support with the trace ID |
OpenAPI specification
The public operations of the API v2 are available as an OpenAPI 3.0 document, at a fixed URL and without login, to import into Postman, Insomnia or a client generator:
https://api.officegest.com/docs/officegest-api/v2/openapi.jsonSpecification last updated on . Download openapi.json (552 operations).
Documentation sections
Explore the available endpoints by category in the sidebar.