ChatGPT
ChatGPT doesn't (yet) consume MCP natively. The workaround is a Custom GPT with Actions pointed at the Transactional REST API. The end result is the same: ChatGPT can list your documents and generate PDFs.
Prerequisites
- ChatGPT Plus or Team/Enterprise (Custom GPTs require a paid plan)
- A Transactional API token (
tk_live_…)
1. Create a Custom GPT
In ChatGPT, click your avatar → My GPTs → Create. Pick a name (e.g. Transactional Assistant) and a description.
In the Configure tab:
- Instructions — paste the snippet at the bottom of this guide.
- Capabilities — disable Web browsing and DALL-E unless you actually need them. Leave Code interpreter off.
- Actions — see step 2.
2. Add the Action
Click Create new action. In the schema field, paste the trimmed OpenAPI document below (it's the relevant subset of our full openapi.yaml, reduced to the endpoints a GPT actually needs):
openapi: 3.1.0
info:
title: Transactional API
version: "1.0.0"
servers:
- url: https://api.transactional.dev
paths:
/v1/documents:
get:
operationId: listDocuments
summary: List the user's templates.
responses:
"200": { description: OK }
/v1/documents/{id}:
get:
operationId: getDocument
summary: Get a template with its sample variables.
parameters:
- in: path
name: id
required: true
schema: { type: integer }
responses:
"200": { description: OK }
/v1/generate:
post:
operationId: generatePdf
summary: Render a template to PDF.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [documentId]
properties:
documentId: { type: string, format: uuid }
variables: { type: object }
responses:
"200": { description: OK }
Then in Authentication pick:
- Type — API Key
- Auth Type — Custom
- Custom header name —
x-api-token - API Key — your
tk_live_…token
Save the action.
3. Use it
In any chat with this Custom GPT:
"List my Transactional templates."
ChatGPT will call listDocuments, ask permission, then summarize what it found. Then:
"Generate the invoice template for customer Acme Corp, total 1280.50 €, one line item 'Pro subscription'."
ChatGPT calls generatePdf with the right body. The response includes the signed PDF URL — ChatGPT will print it inline.
Suggested system instructions
Paste this into the Custom GPT's Instructions field:
You are a Transactional assistant. The user has HTML/Tailwind/Handlebars templates
stored in Transactional. You can:
1. listDocuments() to see what's available.
2. getDocument({id}) to inspect a template's body, fonts, and the sample variables it expects.
3. generatePdf({documentId, variables}) to render a PDF.
Workflow:
- If the user asks to generate a PDF, first listDocuments and then getDocument
to learn the exact variables shape. Don't invent variable names — they must match
what the template expects.
- documentId is the template's UUID, not the numeric id.
- The response of generatePdf includes `url`. It is short-lived. Print it to the user
immediately and tell them to save it.
- Branch on the `error` field of any non-2xx response. Common codes:
invalid_document_id (400), UNAUTHORIZED (401), quota_exceeded (402),
NOT_FOUND (404), SERVICE_UNAVAILABLE (503 — safe to retry).
- Never log the API token.
Troubleshooting
"Allowed domains" warning — ChatGPT requires the domain to be added when you publish the GPT. Use api.transactional.dev.
quota_exceeded — Out of generation credits. Top up or upgrade in the dashboard.
Calls succeed but the URL ChatGPT prints is mangled — Some GPT models truncate long URLs. Ask "show me the raw URL from the last response" — it'll print it verbatim.
Next steps
- A first prompt to try →
- Calling /v1/generate from your own code → — once you've sketched a workflow with ChatGPT, you may want to bake it into your backend.