API Overview
GSign RESTful API documentation.
Base URL
Production: https://api.gesign.mn/api/v1
Development: http://localhost:3000/api/v1Authentication
All API requests require authentication via JWT token or API key.
JWT Token (User Sessions)
http
Authorization: Bearer <token>API Key (Server-to-Server)
http
X-API-Key: <api_key>Response Format
Success Response
json
{
"success": true,
"data": {
// Response data
},
"meta": {
"page": 1,
"limit": 20,
"total": 100
}
}Error Response
json
{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Human readable error message",
"details": {}
}
}HTTP Status Codes
| Code | Description |
|---|---|
| 200 | OK |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 422 | Unprocessable Entity |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
Rate Limiting
| Tier | Rate Limit |
|---|---|
| Free | 100 requests/hour |
| Paid | 1,000 requests/hour |
| Enterprise | Custom |
Rate limit headers:
http
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1609459200Pagination
Cursor-based pagination:
http
GET /api/v1/documents?limit=20&cursor=abc123Response:
json
{
"success": true,
"data": [...],
"meta": {
"limit": 20,
"has_more": true,
"next_cursor": "def456"
}
}API Endpoints
Authentication
POST /auth/register- Register new userPOST /auth/login- LoginPOST /auth/refresh- Refresh tokenPOST /auth/logout- LogoutGET /auth/me- Get current user
Documents
GET /documents- List documentsPOST /documents- Upload documentGET /documents/:id- Get documentPUT /documents/:id- Update documentDELETE /documents/:id- Delete documentGET /documents/:id/download- Download document
Envelopes
GET /envelopes- List envelopesPOST /envelopes- Create envelopeGET /envelopes/:id- Get envelopePUT /envelopes/:id- Update envelopeDELETE /envelopes/:id- Delete envelopePOST /envelopes/:id/send- Send envelopePOST /envelopes/:id/void- Void envelope
Certificates
GET /certificates- List certificatesPOST /certificates/generate- Generate certificatePOST /certificates/import- Import certificateGET /certificates/:id- Get certificatePUT /certificates/:id- Update certificateDELETE /certificates/:id- Delete certificatePOST /certificates/:id/sign- Sign with certificatePOST /certificates/:id/validate- Validate certificate
Webhooks
GET /webhooks- List webhooksPOST /webhooks- Create webhookGET /webhooks/:id- Get webhookPUT /webhooks/:id- Update webhookDELETE /webhooks/:id- Delete webhook
Webhook Events
| Event | Description |
|---|---|
| envelope_sent | Envelope was sent to recipients |
| envelope_delivered | Envelope was delivered |
| recipient_signed | A recipient signed |
| envelope_completed | All recipients signed |
| envelope_declined | Envelope was declined |
| envelope_voided | Envelope was voided |
| certificate_generated | Certificate was generated |
| certificate_expired | Certificate expired |
Health Check
http
GET /healthResponse:
json
{
"status": "ok",
"version": "1.0.0"
}