API ReferenceView as MarkdownOpenAPI

Donations

View as Markdown

Donations are fundraising campaigns: a story, an optional target amount, predefined amounts to give and add-on options such as a gift.

Endpoints that need a token: the site owner creates it in their admin (Developers > API reference). AI assistants: how to ask the user for one.

8 endpoints in 2 parts: Donation, AI builder.

List all donations

Returns the site's donations, newest first unless a sort is given.

User with accessOptional user

Needs a signed-in user whose plan grants access.

Query parameters
publishedstring

Only donations with this published.

completedstring

Only donations with this completed.

sortBystring

The order of the results.

collectionstring

Only results in this collection.

skipstring

How many results to skip - for paging.

wherestring

Only donations with this where.

Returns

Returns a list of Donation objects.

Status codes

200 401 402 404 500

GET/donations
curl -X GET 'http://debate.bg/donations?ionic=true&published=...&completed=...&sortBy=...' \
  -H 'Authorization: Bearer <TOKEN>'
Response
[
  {
    "enabled": false,
    "has_shippable_items": false,
    "medias": [
      {
        "media": "6543210fedcba98765432100",
        "gcs_url": "example-item",
        "gcs_480_30_url": "example-item",
        "gcs_720_30_url": "example-item",
        "gcs_1080_30_url": "example-item",
        "duration": 1,
        "vimeo_uri": "example",
        "vimeo_picture": "example",
        "vimeo_url": "example-item",
        "youtube_url": "example-item",
        "youtube_picture": "example",
        "thumbnail": "example",
        "_id": "6543210fedcba98765432100"
      }
    ],
    "url": "example-item",
    "static_url": "example-item",
    "title": "Example",
    "description": "Text shown on the site.",
    "about_page": "6543210fedcba98765432100",
    "collection_id": "6543210fedcba98765432100",
    "topics": [
      {
        "collection_id": "6543210fedcba98765432100",
        "_id": "6543210fedcba98765432100"
      }
    ],
    "owner_id": "6543210fedcba98765432100",
    "options": [
      {
        "name": "Example",
        "options": [],
        "_id": "6543210fedcba98765432100"
      }
    ],
    "_id": "6543210fedcba98765432100",
    "updatedAt": "2026-11-04T12:00:00.000Z",
    "createdAt": "2026-11-04T12:00:00.000Z",
    "target_amount": {
      "enabled": false,
      "amount": 0
    },
    "predefined_amounts": {
      "enabled": false,
      "amounts": "example"
    }
  }
]

Create a donation

Creates a donation from the fields sent.

Admin token

Needs a site admin token.

Parameters
titlestring

Name of the campaign, required.

Returns

Returns the Donation object.

Status codes

201 400 401 500

POST/donations
curl -X POST 'http://debate.bg/donations?ionic=true' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{ "title": "..." }'
Response
{
  "enabled": false,
  "has_shippable_items": false,
  "medias": [
    {
      "media": "6543210fedcba98765432100",
      "gcs_url": "example-item",
      "gcs_480_30_url": "example-item",
      "gcs_720_30_url": "example-item",
      "gcs_1080_30_url": "example-item",
      "duration": 1,
      "vimeo_uri": "example",
      "vimeo_picture": "example",
      "vimeo_url": "example-item",
      "youtube_url": "example-item",
      "youtube_picture": "example",
      "thumbnail": "example",
      "_id": "6543210fedcba98765432100"
    }
  ],
  "url": "example-item",
  "static_url": "example-item",
  "title": "Example",
  "description": "Text shown on the site.",
  "about_page": "6543210fedcba98765432100",
  "collection_id": "6543210fedcba98765432100",
  "topics": [
    {
      "collection_id": "6543210fedcba98765432100",
      "_id": "6543210fedcba98765432100"
    }
  ],
  "owner_id": "6543210fedcba98765432100",
  "options": [
    {
      "name": "Example",
      "options": [],
      "_id": "6543210fedcba98765432100"
    }
  ],
  "_id": "6543210fedcba98765432100",
  "updatedAt": "2026-11-04T12:00:00.000Z",
  "createdAt": "2026-11-04T12:00:00.000Z",
  "target_amount": {
    "enabled": false,
    "amount": 0
  },
  "predefined_amounts": {
    "enabled": false,
    "amounts": "example"
  }
}

Update a donation

Changes the fields sent; the others stay as they are.

Admin token

Needs a site admin token.

Path parameters
idstringRequired

The ID of the donation.

Returns

Returns the Donation object.

Status codes

200 400 401 404 500

PATCH/donations/:id
curl -X PATCH 'http://debate.bg/donations/{id}?ionic=true' \
  -H 'Authorization: Bearer <TOKEN>'
Response
{
  "enabled": false,
  "has_shippable_items": false,
  "medias": [
    {
      "media": "6543210fedcba98765432100",
      "gcs_url": "example-item",
      "gcs_480_30_url": "example-item",
      "gcs_720_30_url": "example-item",
      "gcs_1080_30_url": "example-item",
      "duration": 1,
      "vimeo_uri": "example",
      "vimeo_picture": "example",
      "vimeo_url": "example-item",
      "youtube_url": "example-item",
      "youtube_picture": "example",
      "thumbnail": "example",
      "_id": "6543210fedcba98765432100"
    }
  ],
  "url": "example-item",
  "static_url": "example-item",
  "title": "Example",
  "description": "Text shown on the site.",
  "about_page": "6543210fedcba98765432100",
  "collection_id": "6543210fedcba98765432100",
  "topics": [
    {
      "collection_id": "6543210fedcba98765432100",
      "_id": "6543210fedcba98765432100"
    }
  ],
  "owner_id": "6543210fedcba98765432100",
  "options": [
    {
      "name": "Example",
      "options": [],
      "_id": "6543210fedcba98765432100"
    }
  ],
  "_id": "6543210fedcba98765432100",
  "updatedAt": "2026-11-04T12:00:00.000Z",
  "createdAt": "2026-11-04T12:00:00.000Z",
  "target_amount": {
    "enabled": false,
    "amount": 0
  },
  "predefined_amounts": {
    "enabled": false,
    "amounts": "example"
  }
}

Delete a donation

Deletes the donation. This cannot be undone.

Admin token

Needs a site admin token.

Path parameters
idstringRequired

The ID of the donation.

Returns

Returns an empty answer on success.

Status codes

200 401 404 500

DELETE/donations/:id
curl -X DELETE 'http://debate.bg/donations/{id}?ionic=true' \
  -H 'Authorization: Bearer <TOKEN>'

Retrieve a donation

Returns one donation, found by its URL slug.

Page accessOptional user

Pages limited to some users check the token when one is sent.

Path parameters
urlstringRequired

The donation's URL slug, as in its address on the site.

Query parameters
sessionIdstring

Only donations with this session id.

Returns

Returns the Donation object.

Status codes

200 401 402 404 500

GET/donations/:url
curl -X GET 'http://debate.bg/donations/{url}?ionic=true&sessionId=...'
Response
{
  "enabled": false,
  "has_shippable_items": false,
  "medias": [
    {
      "media": "6543210fedcba98765432100",
      "gcs_url": "example-item",
      "gcs_480_30_url": "example-item",
      "gcs_720_30_url": "example-item",
      "gcs_1080_30_url": "example-item",
      "duration": 1,
      "vimeo_uri": "example",
      "vimeo_picture": "example",
      "vimeo_url": "example-item",
      "youtube_url": "example-item",
      "youtube_picture": "example",
      "thumbnail": "example",
      "_id": "6543210fedcba98765432100"
    }
  ],
  "url": "example-item",
  "static_url": "example-item",
  "title": "Example",
  "description": "Text shown on the site.",
  "about_page": "6543210fedcba98765432100",
  "collection_id": "6543210fedcba98765432100",
  "topics": [
    {
      "collection_id": "6543210fedcba98765432100",
      "_id": "6543210fedcba98765432100"
    }
  ],
  "owner_id": "6543210fedcba98765432100",
  "options": [
    {
      "name": "Example",
      "options": [],
      "_id": "6543210fedcba98765432100"
    }
  ],
  "_id": "6543210fedcba98765432100",
  "updatedAt": "2026-11-04T12:00:00.000Z",
  "createdAt": "2026-11-04T12:00:00.000Z",
  "target_amount": {
    "enabled": false,
    "amount": 0
  },
  "predefined_amounts": {
    "enabled": false,
    "amounts": "example"
  }
}

Create a donation with AI

Create a donation from a prompt, written by the AI builder.

User token

Needs the token of a signed-in user.

Parameters
promptstring

What the AI should do with the donation, in plain words - any language.

chatIdstring

The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.

aiVersionstring

Which version of the AI builder to use; leave it out for the current one.

item_idstring

The ID of the donation to change.

Status codes

200 401 500

POST/create-new-donation
curl -X POST 'http://debate.bg/create-new-donation?ionic=true' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{ "prompt": "...", "chatId": "...", "aiVersion": "...", "item_id": "..." }'
Response
{
  "chat_id": "6543210fedcba98765432100",
  "role": "user",
  "text": "Text shown on the site.",
  "target_url": "example-item",
  "action": "RESPONSE",
  "options": [
    "example"
  ],
  "medias": [
    {
      "media": "6543210fedcba98765432100",
      "gcs_url": "example-item",
      "gemini_uri": "example",
      "gemini_interaction_id": "example",
      "_id": "6543210fedcba98765432100"
    }
  ],
  "products": [
    "6543210fedcba98765432101"
  ],
  "services": [
    "6543210fedcba98765432101"
  ],
  "blogposts": [
    "6543210fedcba98765432101"
  ],
  "programs": [
    "6543210fedcba98765432101"
  ],
  "suggestions": [
    {
      "text": "Text shown on the site.",
      "route": "example",
      "item_id": "6543210fedcba98765432100",
      "medias": [],
      "picture": "6543210fedcba98765432100",
      "_id": "6543210fedcba98765432100"
    }
  ],
  "is_system": false,
  "_id": "6543210fedcba98765432100",
  "updatedAt": "2026-11-04T12:00:00.000Z",
  "createdAt": "2026-11-04T12:00:00.000Z",
  "data": {
    "object": "example",
    "object_type": "example",
    "edit_summary": "example",
    "edit_diff": "example",
    "undo_record": "example",
    "hero_animation_offer": "example",
    "preview_state": "example",
    "pending_credit_cost": 0,
    "target_restore": "example",
    "media_request": "example",
    "item_request": "example",
    "reference_request": "example"
  }
}

Generate a donation with AI

Use it to create a new donation or fundraising campaign from scratch or a prompt.

User token

Needs the token of a signed-in user.

Parameters
promptstring

What the AI should do with the donation, in plain words - any language.

chatIdstring

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

POST/generate-donation
curl -X POST 'http://debate.bg/generate-donation?ionic=true' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{ "prompt": "...", "chatId": "..." }'

Modify a donation with AI

Use it to edit or update an existing donation campaign.

User token

Needs the token of a signed-in user.

Parameters
promptstring

What the AI should do with the donation, in plain words - any language.

item_datastring

The current donation, as JSON - the AI changes it and returns the result.

chatIdstring

The AI chat this request belongs to; its history and language carry over. Leave it out to start a new chat.

item_idstring

The ID of the donation to change.

item_idsstring

The donation's item ids.

Status codes

200 401 500

POST/modify-donation
curl -X POST 'http://debate.bg/modify-donation?ionic=true' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{ "prompt": "...", "item_data": "...", "chatId": "...", "item_id": "...", "item_ids": "..." }'
↑↓ Navigate↵ GoEsc Close