Everything the dashboard does — orders, status, archives, balance — is available programmatically. The API is available to every account: you create a key in the dashboard.
From a key to downloaded archives in four requests. Create a key in the dashboard with the generations:read and generations:write permissions and put it in the API_KEY environment variable.
Read the catalog
The catalog returns the values an order is built from: languages, styles, countries, verticals. It needs no key.
curl "https://api.pagegeneration.com/v1/catalog"
const response = await fetch('https://api.pagegeneration.com/v1/catalog');
const data = await response.json();
A minimal order is a site count, a style, a language and a brief. Make up the Idempotency-Key yourself: a new one for every new order. Take the order id from the response.
The site list returns artifact_url — a link to the archive of every finished site. The link is valid for an hour and needs no key: fetch it with a plain GET.
Requests and responses are UTF-8 JSON, except archive downloads. A request body can be up to 100 KB. A larger one gets 413 payload_too_large. Times are ISO 8601 in UTC. Identifiers are opaque strings: don’t parse them. An identifier in the path that the service never issued is 404 not_found.
Generation is asynchronous: creating an order returns immediately, and completion is reported by a webhook or by polling the status. There is no synchronous mode.
The language of the message field in errors is set by the Accept-Language header: en, uk or ru, en by default. Error codes, field names and the catalog don’t depend on the language.
What stays fixed in version 1
These don’t change without a new version in the path:
endpoint paths and methods;
order and site status values;
the error envelope;
event names;
archive retention periods;
the behaviour of the idempotency key.
New optional fields, new catalog values and new events may appear without a version change: skip what you don’t recognise instead of failing.
Pass the key in a header: Authorization: Bearer gen_live_…. Header only — never in the request URL.
You create a key in the dashboard: Profile → Access keys. The API is available to every activated account.
A key’s value is shown once, at creation; after that the list shows only its prefix.
Permissions are chosen when the key is created. A request without the required permission gets 403 forbidden; a request with no key or a revoked key gets 401 unauthorized.
An account can have up to 20 active keys. Create a separate key for each integration and give it only the permissions it needs.
Reissuing changes the value at once: the old one stops working at the same moment. To rotate a key without downtime, create a second key, switch the integration over and revoke the first.
Resetting a password revokes all keys created by that person.
A key cannot create another key, change the password or the sign-in settings — a person does that in the dashboard.
Keep the key on your server. Don’t put it in a browser or a mobile app.
An error is a 4xx or 5xx status with a body in a single envelope. Your code should branch on code and details; message is written for a person and may change. Quote request_id when contacting support.
Error envelope
{
"error": {
"code": "capacity_exhausted",
"message": "The catalog can produce 8 distinct sites with this setting.",
"details": {
"max_count": 8,
"required_section_reuse_limit": 2
},
"request_id": "8f3a1c5e-2d47-4b90-a6e1-0c9d7b2f4a63"
}
}
Field
Description
code
A machine code from the table below
message
An explanation in the Accept-Language language
details
Details that depend on the code; not every error has them
request_id
Request identifier; present in every error the service returns
Error codes
Status
Code
Meaning
400
validation_failed
The request couldn’t be parsed or a field is out of range. message says what exactly is wrong; for broken or empty JSON the reason is in details.reason
401
unauthorized
The key is missing, invalid or revoked, or the account is disabled
402
insufficient_credits
Not enough credits. details.required is how many are needed, details.available is how many there are
403
forbidden
The key lacks the required permission
403
account_not_activated
The account is not activated yet: the email is not confirmed or an administrator has not approved the account
404
not_found
No such endpoint or object in your account. Someone else’s object and a malformed identifier look the same as a missing one
409
conflict
The current state doesn’t allow the action: for example, the order has already finished or the archive isn’t ready
409
limit_reached
A limit on the number of objects has been reached: saved settings or subscriptions
413
payload_too_large
The request body is larger than 100 KB
422
capacity_exhausted
The catalog can’t produce that many distinct sites. details.max_count is the achievable number, details.required_section_reuse_limit is the reuse limit that would work, or null
422
idempotency_key_reused
The idempotency key was already used with a different request body
429
rate_limited
Too many requests. Wait and try again
500
internal_error
A failure on the service side. Try again later; for order creation, with the same Idempotency-Key
503
service_paused
The service is temporarily not accepting orders. Credits are untouched; try again later
A 429 response to exceeding the request rate may come without a JSON body and without `request_id`. Detect it by the status, not by parsing the body.
Creating an order — POST /generations — requires an Idempotency-Key header: a string of 8 to 128 characters, for example a UUID or the order number in your system. Without it, or with a shorter or longer one, you get 400.
Repeating a request with the same key and the same body returns the stored first response: no second order is created and credits aren’t reserved twice. The response comes back as it was at creation time — read the current state by the order id.
The same key with a different body is 422 idempotency_key_reused. The parsed body is compared: whitespace and line breaks don’t matter, field order does. Repeat the request unchanged.
A key is remembered only together with a created order. After a refusal — 400, 402, 422, 503 — you can send the same key again, for example after topping up the balance.
Keys are scoped to the account. A key record is stored for at least 24 hours: during that time a repeat is guaranteed to return the first response. Then the record is deleted — within an hour after that — and a request with the same key creates a new order. Retry within 24 hours, and generate a new key for every new order.
Other endpoints don’t read the header. Cancelling, deleting and deactivating are safe to repeat; repeating the creation of an invoice, a subscription or saved settings creates one more object.
Everything a valid order is built from: block roles, styles, delivery technologies, languages, countries, prepared pages, verticals and request limits.
The response is cached for up to a minute, and order intake re-checks everything itself.
Titles and descriptions (title, description) are not translated and don’t depend on Accept-Language. In your own interface show your own names by the keys: role, style, country_code, key.
The lists grow: don’t hard-code them.
curl "https://api.pagegeneration.com/v1/catalog"
const response = await fetch('https://api.pagegeneration.com/v1/catalog');
const data = await response.json();
Ask to add a language or a country that the catalog doesn’t have. Send at least one of the two; a code that is already in the catalog is rejected with 400. The response only means “passed on”: no date is promised.
No more than 3 requests per hour per account; beyond that — 429 rate_limited.
Request parameters
Field
Type
Rules
Description
language_code
string
^[a-z]{2}$
An ISO 639-1 language code that is not in the catalog’s languages
country_code
string
^[A-Z]{2}$
An ISO 3166-1 alpha-2 country code that is not in the catalog’s countries
Create an order. The request is fully checked before any charge: shape, language and style from the catalog, variety capacity, balance. The 202 response comes immediately; the sites are built in the background.
Credits are reserved for the whole order, one per site. If there aren’t enough — 402 insufficient_credits, with required and available in details.
If the catalog can’t produce that many distinct sites — 422 capacity_exhausted: details.max_count is the achievable number, details.required_section_reuse_limit is the smallest section_reuse_limit that would pass, or null.
Per-site lists — domains, business_names, form_endpoints — follow the order of sites; null or a missing item means “no value”. verticals are dealt out in a cycle.
A privacy policy and terms of use are added to every site automatically and don’t count towards the page limit.
Unknown body fields are not stored. Control and invisible characters in strings are rejected with 400.
Request parameters
Field
Type
Rules
Description
Idempotency-Keyheader
string
required8–128
The request retry key, see the Idempotency section
count
integer
required1–100
How many sites to make
style
string
requiredup to 64 characters
A style from the catalog’s styles, or random — the service picks the style
language
string
required
Site language: a code from the catalog’s languages
brief
object
required
The business description. The object is required, its fields are not: an empty object is fine
brief.geo
string
Country: a code from the catalog’s countries, or random. It determines the company’s address, phone and legal form. Missing or unrecognised — the service picks a country for each site
brief.business_name
string
up to 120 characters
Company name, shared by all sites of the order
brief.vertical
string
up to 200 characters
What the company does — the shared topic of the sites
brief.required_mentions
string[]
up to 30 itemsup to 200 characters
Phrases you want in the copy. The service requires each one to be included in the site language (a phrase in another language is translated) and re-checks the result. There is no guarantee: a phrase that is still missing after a retry is not added by the service itself
brief.forbidden_words
string[]
up to 30 itemsup to 100 characters
Words and phrases that must not appear in the copy
brief.tone_of_voice
string
up to 200 characters
Tone of the copy, in your own words
brief.content_directives
string
up to 1000 characters
Guidance for the content of the copy. It doesn’t change the page set or the blocks
target
string
defaulthtmlhtmlphp
Delivery technology, one per order. php — pages as .php files; the site needs PHP hosting
vertical_category
string
up to 64 characters
A vertical key from the catalog’s vertical_categories, or random. It applies only to sites without their own topic: such a site gets a random topic of this vertical and its delivery. No field — a random vertical. An unknown key is 400
shuffle_pages
boolean
defaultfalse
true — every site gets its own page set and its own order of middle blocks; the set comes from pages, or from the catalog when pages is absent. The home page is always there
pages
object[]
up to 20 items
The page set. Required unless shuffle_pages: true is set
pages[].path
string
required
A page path from the catalog’s pages
pages[].roles
string[]
requiredup to 30 items
Block roles in order: header first, footer last. A role with repeatable: false appears at most once
pages[].chances
integer[]
1–100up to 30 items
The chance of a block appearing, in percent; same length and order as roles. No field — all 100
section_reuse_limit
integer
default1001–100
How many sites of the order may get the same block variant. 1 — no repeats
verticals
(string | null)[]
up to 100 itemsup to 200 characters
Topics per site, dealt out in a cycle; null — the shared topic. vertical_category has no effect on a site with its own topic
business_names
(string | null)[]
up to 100 itemsup to 120 characters
Names in site order; null or a missing item — the shared name, and without it — one derived from the domain or chosen by the service
domains
(string | null)[]
up to 100 itemsup to 253 characters
Domains in site order, host name only: example.com. A site without a domain gets a placeholder in the .example zone
form_endpoint
string
up to 2048 characters
Form handler for all sites: an https://… URL, or the word php — a PHP handler in the site archive
form_endpoints
(string | null)[]
up to 100 itemsup to 2048 characters
Form handlers in site order; they take priority over the shared form_endpoint
seed
string
up to 128 characters
The order seed: the service’s random choices depend on it, for example the style for random. If omitted, the service generates one and returns it in the response
The state of an order. With the wait parameter the connection is held until the status changes or the time runs out — long polling for those who don’t need their own server for webhooks.
A wait response returns early only when status changes: growth of ready_count within running doesn’t wake it.
Delete the input data of a finished order — brief, domains, names — and the generated copy. Archives stay available until the end of their retention period.
Only for orders in status succeeded, failed or cancelled; otherwise 409 conflict. A cancelled order that is still finishing a site also answers 409 — try again later.
After deletion the order responses have no business_name, vertical_category and geo_country_code, and the sites’ domain is null.
The idempotency key record is kept: repeating the creation with the same key still returns the first response.
The whole order as one file: a 302 response to a signed link that is valid for an hour.
The archive holds one nested archive per finished site: site-001.zip, site-002.zip and so on by ordinal number.
It works for an order in progress too: the archive contains the sites that are ready at the time of the request. No ready site, or all archives deleted after retention — 409 conflict.
Issue an invoice for credits. This call doesn’t change the balance: credits are added once the payment service confirms the payment. A person pays the invoice in a browser at payment_url.
A purchase below minimum_top_up_credits from the balance is 400; details.minimum_top_up_credits holds the smallest allowed number.
No more than 5 unpaid invoices per hour per account; a request that arrives while the previous invoice is still being created also gets 429 rate_limited.
After payment, poll the balance: confirmation isn’t instant.
409 conflict — payments are temporarily unavailable.
For every event the service sends a POST with a JSON body to the subscription URL. Any 2xx response within 10 seconds counts as delivered. Respond right away and do the work after responding.
import hashlib
import hmac
import time
def is_valid_signature(raw_body: bytes, headers, secret: str, tolerance_seconds: int = 300) -> bool:
timestamp = headers.get("X-Timestamp", "")
signed_payload = timestamp.encode() + b"." + raw_body
expected = hmac.new(secret.encode(), signed_payload, hashlib.sha256).hexdigest()
is_fresh = timestamp.isdigit() and abs(time.time() - int(timestamp)) <= tolerance_seconds
received = [part.strip()[3:] for part in headers.get("X-Signature", "").split(",") if part.strip().startswith("v1=")]
return is_fresh and any(hmac.compare_digest(candidate, expected) for candidate in received)
The body is the same in every attempt. X-Timestamp is the time of the attempt and is part of the signature, so every attempt has its own signature: verify it against the headers of the same delivery.
Retries and ordering
A failure is a non-2xx response, a timeout or a connection error. Redirects are not followed: a 3xx response is a failure too.
Retries come after 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours and 24 hours: up to 8 attempts in total.
A 410 response deactivates the subscription immediately.
Delivery is at-least-once and ordering isn’t guaranteed. Treat an event as a reason to re-read the order through the API, not as the only source of state.
An account gets up to 2,000 deliveries a day (UTC), retries included. Beyond the limit, deliveries are not sent until the end of the day and are not sent later.
URL requirements
https only and the standard port 443 only.
A host name, not an IP address.
No username or password in the URL.
Internal network addresses and the service’s own addresses are rejected.
Waiting to start before the order is closed with a return, hours
72
Download link lifetime, minutes
60
Site archive retention from readiness, days
30
Idempotency key retention, hours, at least
24
Saved settings per account
10
Active keys per account
20
Credits per invoice
10000
Unpaid invoices per hour per account
5
Language or country requests per hour per account
3
Subscriptions per account, including deactivated
50
Subscriptions per event
10
Delivery attempts per event
8
Waiting for the receiver’s response, seconds
10
Deliveries per day per account
2000
Length limits for the order’s strings and lists are in the field table of order creation. After the retention period the archive is deleted, while the order’s artifact_available_until stays in the response.
How do I learn that an order is done without my own server for webhooks?
With long polling: GET /generations/<id>?wait=60. The request returns when the status changes or after a minute; repeat it until a final status.
The order is succeeded but has fewer sites than ordered. Is that an error?
No. succeeded means at least one site is ready. failed_count tells how many failed; their credits are back on the balance. Order the missing sites with a new order.
The request to create an order was cut off. Was the order created?
Within 24 hours, repeat the request with the same Idempotency-Key and the same body. If the order was created, you get it back; if not, it is created now. There will be no second order and no second charge.
What do I do with capacity_exhausted?
Lower count to details.max_count, or raise section_reuse_limit to details.required_section_reuse_limit, or set style: random — then the service picks a style with enough capacity. You can also split the volume into several orders.
How is target: php different from form_endpoint: php?
target is the technology of the whole site: pages as .php files. form_endpoint: php is only the form handler as a PHP file in the archive; it is included with any technology.
The archive link stopped working.
A signed link is valid for an hour. Request the site list or the order archive again — the link will be new. 30 days after a site became ready its archive is deleted and artifact_url becomes null.
Catalog titles come in one language. How do I show them to a user?
The catalog isn’t translated. Keep your own names for the role, style, country_code keys and the vertical key, and show an unknown key as is.
An event arrived twice or out of order.
That is by design: delivery is at-least-once. Drop duplicates by X-Event-Id, and after any event read the order state through the API.
How do I rotate a key without downtime?
Create a second key in the dashboard, switch the integration to it and revoke the first. Reissuing doesn’t fit: the old value stops working at once.