Skip to main content

API Overview

The Proxima Invoice API is a RESTful JSON API built with Go and Gin.

Base URL

http://localhost:8081/api/v1

Production URL will be https://api-invoice.prxm.uz/api/v1.

Authentication

All endpoints except health checks and login require a JWT Bearer token:

curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
http://localhost:8081/api/v1/invoices

See Authentication for login flow.

Response Format

Success (Single Item)

{
"data": { ... },
"error": null
}

Success (List with Pagination)

{
"data": [ ... ],
"meta": {
"total": 150,
"page": 1,
"per_page": 20
}
}

Error

{
"data": null,
"error": {
"code": "NOT_FOUND",
"message": "invoice not found",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}

Error Codes

CodeHTTP StatusDescription
VALIDATION_ERROR400Invalid request body or parameters
UNAUTHORIZED401Missing or invalid JWT token
FORBIDDEN403Insufficient permissions
NOT_FOUND404Resource not found
CONFLICT409Invalid state transition or duplicate
INTERNAL_ERROR500Unexpected server error

Pagination

List endpoints support pagination via query parameters:

ParameterDefaultMaxDescription
page1Page number (1-indexed)
per_page20100Items per page
curl "http://localhost:8081/api/v1/invoices?page=2&per_page=50"

Request Headers

HeaderRequiredDescription
AuthorizationYes*Bearer {jwt_token}
Content-TypeFor POST/PATCHapplication/json
X-Request-IDNoCustom request ID (auto-generated if absent)

*Not required for /healthz, /readyz, /api/v1/auth/login.

Endpoint Summary

MethodPathAuthDescription
GET/healthzNoLiveness probe
GET/readyzNoReadiness probe
POST/api/v1/auth/loginNoGet JWT token
GET/api/v1/clientsYesList active clients
GET/api/v1/clients/:keyYesGet client details
GET/api/v1/clients/:key/worklogsYesGet client worklogs
POST/api/v1/invoices/prefillYesPreview invoice (not saved)
POST/api/v1/invoices/generateYesCreate draft invoice
POST/api/v1/invoices/generate-bulkYesCreate drafts for all clients
GET/api/v1/invoicesYesList invoices
GET/api/v1/invoices/:idYesGet invoice with line items
PATCH/api/v1/invoices/:idYesUpdate invoice fields
PATCH/api/v1/invoices/:id/line-itemsYesAdd/update/remove line items
POST/api/v1/invoices/:id/finalizeYesFinalize and generate PDF
PUT/api/v1/invoices/:id/regenerateYesRegenerate from fresh data
GET/api/v1/invoices/:id/edit-historyYesGet edit history
GET/api/v1/invoices/:id/pdfYesDownload PDF