# Builderly API reference

Base URL: http://pendarium.max-media.io
Generated from the running server on 2026-11-05T11:46:46.200Z. Every mounted route is listed with the access it needs, the parameters its handler reads and the data models it uses.

## Authentication

Send `Authorization: Bearer <token>` where a route needs a token. Add `?ionic=true` to get JSON from routes that also render pages.

- **Admin token** (`admin`): Bearer token of a site admin (Authorization: Bearer <token>).
- **User token** (`user`): Bearer token of a signed-in user of the site.
- **Optional user** (`optional-user`): Works without a token; a user token personalises the answer.
- **User with access** (`user-priv`): A signed-in user whose plan grants access to the item.
- **Page access** (`page-priv`): Pages limited to some users check the token when one is sent.
- **Webhook signature** (`webhook`): Called by a provider; verified by its signature.
- **reCAPTCHA** (`recaptcha`): Needs a reCAPTCHA token from the site form.
- **System** (`system`): Internal - called by the platform itself.

### For AI assistants: getting a token

Public endpoints (Access: Public) need no token. Everything else - changing the site, or reading its orders, bookings, customers and other private data - needs the site owner's API token.

You cannot create a token yourself, and you must not ask for the owner's password. Ask the user for a token instead - you can send them this message as it is:

> To work with your site through its API, I need an API token from you:
> 1. Sign in to your Builderly admin: https://admin.max-media.io
> 2. Open Developers > API reference (or go straight to https://admin.max-media.io/tabs/site-builder/api-docs).
> 3. Press "Generate token", copy the token and paste it here.
> The token acts as you, so only share it in this chat. You can cancel it at any time by signing out of all devices.

Then send it with every request as `Authorization: Bearer <token>`, and add `?ionic=true` to get JSON. Calls go to the site's own address (its domain), not to the reference's.

The token acts as the user: say what you will change and wait for their yes before any request that creates, changes or deletes something, never repeat the token back, and never put it in a link or a file you share.

## Status codes

| Code | Name | Meaning |
| --- | --- | --- |
| 200 | OK | It worked. The answer is the object or list asked for. |
| 201 | Created | The object was created. Some endpoints send it back; others send an empty body. |
| 202 | Accepted | The work was started and finishes in the background - for example a video being processed ({ "status": "processing" }). Check back on the object. |
| 204 | No Content | It worked, and there is nothing to send back - for example after removing a staff member. |
| 301 | Moved Permanently | The address changed; follow the Location header. |
| 400 | Bad Request | The request was refused as sent: a required field is missing, a value has the wrong type or fails validation. The body says what - often as plain text. |
| 401 | Unauthorized | No token, or one that is invalid or signed out. Without ?ionic=true, some endpoints answer this with the HTML login page instead of JSON. |
| 402 | Payment Required | The content needs a subscription: the user has no price plan that unlocks it. |
| 403 | Forbidden | The token is valid but may not do this - the record belongs to someone else, or the user is not an admin. AI builder endpoints also answer 403 when the account is out of credits. |
| 404 | Not Found | No object with that ID or URL slug, or no such endpoint. |
| 409 | Conflict | It clashes with the current state: the item is already being processed, a version is already applied, or an AI plan or preview is no longer available. |
| 410 | Gone | It existed but is no longer there - for example a comment already deleted on the social network. |
| 412 | Precondition Failed | A rule the request must meet is not met - for example push notifications of the same type at least 48 hours apart. |
| 418 | I'm a teapot | An account confirmation or password reset link was used with an email that does not match it. |
| 421 | Misdirected Request | The domain is not a Builderly site. Call the site's own address. |
| 422 | Unprocessable Content | The request was understood but could not be done - for example the AI could not read the website it was asked to clone. The message says what to try instead. |
| 429 | Too Many Requests | Slow down: the site's request limit was reached, an AI chat already has a request running, or the hourly limit of AI search answers is used up. Wait and retry. |
| 500 | Internal Server Error | Something failed on the server. Retrying later may work; if it keeps failing, the request may be one the endpoint does not handle. |
| 502 | Bad Gateway | A service the request depends on failed - for example the address a redirect forwards to. |
| 503 | Service Unavailable | Used by the lead form when an order is below its minimum value, not only for outages: read the message. |

Errors do not share one shape: depending on the endpoint the body is plain text, { "error": "..." }, { "message": "..." } or empty. Rely on the status code, and show the body to the user as the reason.

## Endpoints

### Events

Events are ticketed events: dates, ticket tiers with prices, a venue and, optionally, a seating plan with seats to choose from. Venues and seating plans are set up once and reused across events.

#### Event

##### List all events
`GET /events`
Returns the site's events, newest first unless a sort is given.
- Access: Optional user
- Returns: a list of Event objects.
- Status codes: 200, 500
- Models: Event

##### Create an event
`POST /events`
Creates an event from the fields sent.
- Access: User token
- Returns: the Event object.
- Status codes: 201, 400, 401, 500
- Models: Event

##### Retrieve an event
`GET /events/:id`
Returns one event, found by its ID.
- Access: Optional user
- Path:
  - `id` (string): The ID of the event.
- Returns: the Event object.
- Status codes: 200, 404, 500
- Models: Event

##### Update an event
`PATCH /events/:id`
Changes the fields sent; the others stay as they are.
- Access: User token
- Path:
  - `id` (string): The ID of the event.
- Returns: the Event object.
- Status codes: 200, 400, 401, 404, 500
- Models: Event

##### Delete an event
`DELETE /events/:id`
Deletes the event. This cannot be undone.
- Access: User token
- Path:
  - `id` (string): The ID of the event.
- Returns: an empty answer on success.
- Status codes: 200, 401, 404, 500
- Models: Event

#### Seating Plan

##### List all seating plans
`GET /seating-plans`
Returns the site's seating plans, newest first unless a sort is given.
- Access: Public
- Returns: a list of SeatingPlan objects.
- Status codes: 200, 500
- Models: SeatingPlan

##### Create a seating plan
`POST /seating-plans`
Creates a seating plan from the fields sent.
- Access: User token
- Returns: the SeatingPlan object.
- Status codes: 201, 400, 401, 500
- Models: SeatingPlan

##### Retrieve a seating plan
`GET /seating-plans/:id`
Returns one seating plan, found by its ID.
- Access: Public
- Path:
  - `id` (string): The ID of the seating plan.
- Returns: the SeatingPlan object.
- Status codes: 200, 404, 500
- Models: SeatingPlan

##### Update a seating plan
`PATCH /seating-plans/:id`
Changes the fields sent; the others stay as they are.
- Access: User token
- Path:
  - `id` (string): The ID of the seating plan.
- Returns: the SeatingPlan object.
- Status codes: 200, 400, 401, 404, 500
- Models: SeatingPlan

##### Delete a seating plan
`DELETE /seating-plans/:id`
Deletes the seating plan. This cannot be undone.
- Access: User token
- Path:
  - `id` (string): The ID of the seating plan.
- Returns: an empty answer on success.
- Status codes: 200, 401, 404, 500
- Models: SeatingPlan

#### Ticket

##### Retrieve an events date
`GET /events-date/:id/:date_index`
Returns one events date, found by its ID.
- Access: Optional user
- Path:
  - `id` (string): The ID of the events date.
  - `date_index` (string): The events date's date index.
- Status codes: 200, 404, 500
- Models: Event

##### Retrieve a ticket
`GET /ticket/:id`
Returns one ticket, found by its ID.
- Access: Optional user
- Path:
  - `id` (string): The ID of the ticket.
- Returns: the Ticket object.
- Status codes: 200, 404, 500
- Models: Ticket, Event, Order, QrCode

##### Create a ticket
`POST /tickets`
Creates a ticket from the fields sent.
- Access: Optional user
- Body:
  - `findIndex` (string): The ticket's find index.
  - `splice` (string): The ticket's splice.
  - `push` (string): The ticket's push.
  - `tickets` (string): The ticket's tickets.
  - `freeze_action` (string): The ticket's freeze action.
  - `bought_by_admin` (string): The ticket's bought by admin.
  - `freeze` (string): The ticket's freeze.
- Returns: the Ticket object.
- Status codes: 201, 400, 500
- Models: Event, Ticket

#### Venue

##### List all venues
`GET /venues`
Returns the site's venues, newest first unless a sort is given.
- Access: Public
- Returns: a list of Venue objects.
- Status codes: 200, 500
- Models: Venue

##### Create a venue
`POST /venues`
Creates a venue from the fields sent.
- Access: User token
- Returns: the Venue object.
- Status codes: 201, 400, 401, 500
- Models: Venue

##### Retrieve a venue
`GET /venues/:id`
Returns one venue, found by its ID.
- Access: Public
- Path:
  - `id` (string): The ID of the venue.
- Returns: the Venue object.
- Status codes: 200, 404, 500
- Models: Venue

##### Update a venue
`PATCH /venues/:id`
Changes the fields sent; the others stay as they are.
- Access: User token
- Path:
  - `id` (string): The ID of the venue.
- Returns: the Venue object.
- Status codes: 200, 400, 401, 404, 500
- Models: Venue

##### Delete a venue
`DELETE /venues/:id`
Deletes the venue. This cannot be undone.
- Access: User token
- Path:
  - `id` (string): The ID of the venue.
- Returns: an empty answer on success.
- Status codes: 200, 401, 404, 500
- Models: Venue

#### AI builder

##### Create an event with AI
`POST /create-new-event`
Create an event from a prompt, written by the AI builder.
- Access: User token
- Body:
  - `prompt` (string): What the AI should do with the event, in plain words - any language.
  - `chatId` (string): The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.
  - `aiVersion` (string): Which version of the AI builder to use; leave it out for the current one.
  - `item_id` (string): The ID of the event to change.
- Status codes: 200, 401, 500
- Models: ChatMessage

##### Create a seating plan with AI
`POST /create-new-seating-plan`
Create a seating plan from a prompt, written by the AI builder.
- Access: User token
- Body:
  - `prompt` (string): What the AI should do with the seating plan, in plain words - any language.
  - `chatId` (string): The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.
  - `aiVersion` (string): Which version of the AI builder to use; leave it out for the current one.
  - `item_id` (string): The ID of the seating plan to change.
- Status codes: 200, 401, 500

##### Create a venue with AI
`POST /create-new-venue`
Create a venue from a prompt, written by the AI builder.
- Access: User token
- Body:
  - `prompt` (string): What the AI should do with the venue, in plain words - any language.
  - `chatId` (string): The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.
  - `aiVersion` (string): Which version of the AI builder to use; leave it out for the current one.
  - `item_id` (string): The ID of the venue to change.
- Status codes: 200, 401, 500
- Models: ChatMessage

##### Generate an event with AI
`POST /generate-event`
Use it to create a new ticketed event with dates, ticket tiers, and a venue.
- Access: User token
- Body:
  - `prompt` (string): What the AI should do with the event, in plain words - any language.
  - `chatId` (string): The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.
- Status codes: 200, 401, 500

##### Generate a seating plan with AI
`POST /generate-seating-plan`
Use it to create a new seating plan or seat map layout for an event venue.
- Access: User token
- Body:
  - `prompt` (string): What the AI should do with the seating plan, in plain words - any language.
  - `chatId` (string): The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.
- Status codes: 200, 401, 500

##### Generate a venue with AI
`POST /generate-venue`
Use it to create a new event venue (name, address, and origin/region).
- Access: User token
- Body:
  - `prompt` (string): What the AI should do with the venue, in plain words - any language.
  - `chatId` (string): The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.
- Status codes: 200, 401, 500

##### Modify an event with AI
`POST /modify-event`
Use it to edit or update an existing event.
- Access: User token
- Body:
  - `prompt` (string): What the AI should do with the event, in plain words - any language.
  - `item_data` (string): The current event, as JSON - the AI changes it and returns the result.
  - `chatId` (string): The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.
  - `item_id` (string): The ID of the event to change.
  - `item_ids` (string): The event's item ids.
- Status codes: 200, 401, 500

##### Modify a seating plan with AI
`POST /modify-seating-plan`
Use it to edit or update an existing seating plan.
- Access: User token
- Body:
  - `prompt` (string): What the AI should do with the seating plan, in plain words - any language.
  - `item_data` (string): The current seating plan, as JSON - the AI changes it and returns the result.
  - `chatId` (string): The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.
- Status codes: 200, 401, 500

##### Modify a venue with AI
`POST /modify-venue`
Use it to edit or update an existing venue.
- Access: User token
- Body:
  - `prompt` (string): What the AI should do with the venue, in plain words - any language.
  - `item_data` (string): The current venue, as JSON - the AI changes it and returns the result.
  - `chatId` (string): The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.
  - `item_id` (string): The ID of the venue to change.
  - `item_ids` (string): The venue's item ids.
- Status codes: 200, 401, 500

## Objects

### ChatMessage

- `chat_id`: ObjectId, required, → ChatHistory
- `role`: String, one of user | model
- `text`: String
- `target_url`: String
- `action`: String, one of RESPONSE | REDIRECT | OBJECT_RESPONSE | ERROR | CLARIFY | PROPOSED_ACTION
- `options`: String[]
- `data.object`: Mixed
- `data.object_type`: String
- `data.edit_summary`: Mixed
- `data.edit_diff`: Mixed
- `data.undo_record`: Mixed
- `data.hero_animation_offer`: Mixed
- `data.preview_state`: String
- `data.pending_credit_cost`: Number
- `data.target_restore`: Mixed
- `data.media_request`: Mixed
- `data.item_request`: Mixed
- `data.reference_request`: Mixed
- `data.section_options`: Mixed
- `data.section_blueprint`: Mixed
- `data.section_style_options`: Mixed
- `data.section_style_blueprint`: Mixed
- `data.section_role_picker`: Mixed
- `data.small_section_regeneration_options`: Mixed
- `data.small_section_regeneration_target`: Mixed
- `data.small_section_regeneration_prompt`: String
- `data.selected_small_section_action`: Mixed
- `data.component_regeneration_input`: Mixed
- `data.selected_section_role`: Mixed
- `data.selected_section_option`: Mixed
- `data.selected_section_style`: Mixed
- `data.section_options_target`: Mixed
- `data.section_options_prompt`: String
- `data.style_options_target`: Mixed
- `data.style_options_prompt`: String
- `data.previous_container`: Mixed
- `data.preserved_custom_components`: Mixed[]
- `data.selection_request`: Mixed
- `data.proposed_action`: Mixed
- `data.plan_result`: Mixed
- `data.parsed_intent`: Mixed
- `data.parsed_intent_version`: Number
- `data.parsed_intent_at`: Date
- `data.item_id`: ObjectId
- `data.design_archetype`: String
- `data.design_palette`: Mixed
- `data.out_of_credits`: Boolean
- `data.site_wide_edit`: Mixed
- `data.redesign`: Mixed
- `medias`: Object[]
  - `media`: ObjectId, → Media
  - `gcs_url`: String
  - `gemini_uri`: String
  - `gemini_interaction_id`: String
  - `_id`: ObjectId
- `products`: ObjectId[], → Product
- `services`: ObjectId[], → Service
- `blogposts`: ObjectId[], → BlogPost
- `programs`: ObjectId[], → Program
- `suggestions`: Object[]
  - `text`: String
  - `route`: String
  - `item_id`: ObjectId
  - `medias`: Mixed[]
  - `picture`: ObjectId
  - `_id`: ObjectId
- `is_system`: Boolean, default false
- `_id`: ObjectId
- `updatedAt`: Date
- `createdAt`: Date

### Event

A ticketed event at a venue.

- `name`: String, required
- `venue`: ObjectId, required, → Venue
- `description`: String, required
- `medias`: Object[]
  - `media`: ObjectId, → Media
  - `gcs_url`: String
  - `gcs_480_30_url`: String
  - `gcs_720_30_url`: String
  - `gcs_1080_30_url`: String
  - `duration`: Number
  - `vimeo_uri`: String
  - `vimeo_picture`: String
  - `vimeo_url`: String
  - `youtube_url`: String
  - `youtube_picture`: String
  - `thumbnail`: String
  - `_id`: ObjectId
- `dates`: Object[]
  - `date`: Date, required
  - `seating_plan.id`: ObjectId, required, → SeatingPlan
  - `seating_plan.sections`: Object[], required
    - `subsections`: Object[], required
      - `rows`: Object[], required
      - `edit`: Boolean, required
      - `widest_column`: Number, required
      - `justify`: String, required
      - `left`: Number
      - `top`: Number
    - `section_type`: String, required
    - `name`: String, required
    - `top`: Number
    - `left`: Number
    - `color`: String
    - `premium_color`: String
    - `rotation`: Number
    - `tier`: Number, default 0
    - `max_seats`: Number
    - `tickets`: ObjectId[], → Ticket
  - `_id`: ObjectId
- `tier_1.name`: String
- `tier_1.price`: Number
- `tier_2.name`: String
- `tier_2.price`: Number
- `tier_3.name`: String
- `tier_3.price`: Number
- `tier_4.name`: String
- `tier_4.price`: Number
- `tier_5.name`: String
- `tier_5.price`: Number
- `tier_6.name`: String
- `tier_6.price`: Number
- `tier_7.name`: String
- `tier_7.price`: Number
- `tier_8.name`: String
- `tier_8.price`: Number
- `tier_9.name`: String
- `tier_9.price`: Number
- `tier_10.name`: String
- `tier_10.price`: Number
- `tier_11.name`: String
- `tier_11.price`: Number
- `tier_12.name`: String
- `tier_12.price`: Number
- `tier_13.name`: String
- `tier_13.price`: Number
- `tier_14.name`: String
- `tier_14.price`: Number
- `tier_15.name`: String
- `tier_15.price`: Number
- `owner_id`: ObjectId, required, → User
- `_id`: ObjectId
- `updatedAt`: Date
- `createdAt`: Date

### Order

A completed purchase.

- `organization_name`: String
- `firstname`: String, required
- `lastname`: String, required
- `email`: String, required
- `phone_number`: String, required
- `address`: String, required
- `city`: String, required
- `state`: String
- `country`: String, required
- `zip_code`: String, required
- `tax_identification_number`: String
- `notes`: String
- `products`: String[]
- `products_obj`: Object[]
  - `product_id`: ObjectId, → Product
  - `name`: String
  - `options`: String
  - `price`: Number
  - `quantity`: Number
  - `_id`: ObjectId
- `programs`: String[]
- `programs_obj`: Object[]
  - `program_id`: ObjectId, → Program
  - `title`: String
  - `price`: Number
  - `_id`: ObjectId
- `tickets`: ObjectId[], → Ticket
- `donations`: ObjectId[], → Donation
- `donations_obj`: Object[]
  - `donation_id`: ObjectId, → Donation
  - `name`: String
  - `options`: String
  - `price`: Number
  - `quantity`: Number
  - `_id`: ObjectId
- `value`: Number
- `finalized`: Boolean, default false
- `fulfilled`: Boolean, default false
- `paid`: Boolean, default false
- `delivery_method`: String
- `payment_method`: String
- `shipping_cost`: Number
- `coupon_code`: String
- `owner_id`: ObjectId, → User
- `reference_id`: String
- `rating_mail_sent`: Boolean, default false
- `shipping_label`: String
- `shipping_option`: String, one of address | office, default "address"
- `shipping_message`: String
- `shipping_office`: String
- `_id`: ObjectId
- `updatedAt`: Date
- `createdAt`: Date

### QrCode

- `ticket`: ObjectId, required, → Ticket
- `status`: String, one of used | not-used, default "not-used"
- `_id`: ObjectId
- `updatedAt`: Date
- `createdAt`: Date

### SeatingPlan

- `name`: String, required
- `sections`: Object[], required
  - `subsections`: Object[], required
    - `rows`: Object[], required
      - `columns`: Object[], required
      - `top`: Number
      - `left`: Number
      - `formated_row_index`: Number, required
    - `edit`: Boolean, required
    - `widest_column`: Number, required
    - `justify`: String, required
    - `left`: Number
    - `top`: Number
  - `section_type`: String, required
  - `name`: String, required
  - `top`: Number
  - `left`: Number
  - `color`: String
  - `premium_color`: String
  - `rotation`: Number
  - `max_seats`: Number
- `venue`: ObjectId, required, → Venue
- `_id`: ObjectId
- `updatedAt`: Date
- `createdAt`: Date

### Ticket

- `event`: ObjectId, required, → Event
- `date`: Number, required
- `section`: Number
- `subsection`: Number
- `row`: Number
- `seat`: Number
- `row_index_formated`: Number
- `seat_index_formated`: Number
- `lead_id`: ObjectId, → Lead
- `socket_id`: String
- `tier.name`: String
- `tier.price`: Number
- `status`: String, one of frozen | waiting-for-payment | paid | frozen-by-admin | bought-by-admin, default "frozen"
- `expiration_time`: Date, required
- `qr_code`: ObjectId, → QrCode
- `_id`: ObjectId
- `updatedAt`: Date
- `createdAt`: Date

### Venue

- `name`: String, required
- `origin_address`: ObjectId, required, → OriginAddress
- `address`: String, required
- `medias`: Object[]
  - `media`: ObjectId, → Media
  - `gcs_url`: String
  - `gcs_480_30_url`: String
  - `gcs_720_30_url`: String
  - `gcs_1080_30_url`: String
  - `duration`: Number
  - `vimeo_uri`: String
  - `vimeo_picture`: String
  - `vimeo_url`: String
  - `youtube_url`: String
  - `youtube_picture`: String
  - `thumbnail`: String
  - `_id`: ObjectId
- `_id`: ObjectId
- `updatedAt`: Date
- `createdAt`: Date
