API Reference

Integrate Glyve into your application with our REST API.
Generate PDFs programmatically with type-safe validation.

Authentication

All API requests require authentication using an API key.
Include your API key in the Authorization header using the Bearer token format.
Loading...
Getting an API Key
Generate an API key from your API Keys page.
Keep your API keys secure and never share them publicly.

Endpoints

GET
/api/documents/{id}/schema

Get Document Schema

Retrieve the JSON schema for a document, including all variables and their types.

Path Parameters

id
string
The unique id of the document

Response

Returns a JSON Schema object following the Zod schema format.
Here's an example response:
Loading...

Example Request

Loading...
POST
/api/documents/{id}/generate

Generate PDF

Generate a PDF document using the provided data.

Path Parameters

id
string
The unique id of the document

Request Body

A JSON object containing the data for the document.
The structure must match the document's schema. Use the schema endpoint to fetch the expected structure.
Loading...

Response

Returns a PDF file with Content-Type: application/pdf.
Example Request
Loading...

Error Handling

The API uses standard HTTP status codes to indicate success or failure.
All error responses include a JSON body with details about the error.

Common Status Codes

200
OK
Request successful
400
Bad Request
Invalid request body or validation error
401
Unauthorized
Missing or invalid API key
404
Not Found
Document not found or not accessible
422
Unprocessable Entity
Document has no content
500
Internal Server Error
Server error during PDF generation

Error Response Format

Loading...

Data Validation

At Glyve, we use Zod to validate request data against the variables defined in each document.
When validation fails, you'll receive a 400 Bad Request response with an array of issues in the ZodIssue format.

Example Validation Error

Loading...