Campaigns API

These are the Campaigns endpoints of the Keila API. For Keila Cloud, the base URL is https://app.keila.io.

All endpoints, unless stated differently, require Bearer authentication.

A campaign is an email message sent to many contacts at once The content can be authored as text, Markdown, blocks, MJML, or HTML.

get /api/v1/campaigns

Index campaigns

Retrieve all campaigns from your project.

Responses

200 Campaign index response

  • data object[]
    • data object

      Example: {"books":[{"title":"Space Book","url":"books.books/spacebook"},{"title":"Earth Book","url":"books.books/earthbook"}]}

    • html_body string

      Example: "<!doctype html>\n<html>\n <body>\n <h1>Hello {{ contact.first_name }}!</h1>\n </body>\n</html>\n"

    • html_content object

      Map of named HTML content slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • id string

      Campaign ID

      Example: "mc_12345"

    • inserted_at string

      Example: "2026-11-04T12:44:26.537051Z"

    • json_body object

      Example: {"blocks":[{"data":{"text":"Hello, I am a block campaign!"},"id":"ff0011","type":"paragraph"}]}

    • mjml_body string

      Example: "<mjml>\n <mj-body>\n <mj-section>\n <mj-column>\n <mj-text>Hello I’m an MJML campaign!</mj-text>\n </mj-column>\n </mj-section>\n </mj-body>\n</mjml>\n"

    • mjml_content object

      Map of named MJML content slots.

      Example: {"main":"<mj-text>Hi {{ contact.first_name }}!</mj-text>"}

    • preview_text string

      Example: "Hello, I am a preview campaign!"

    • scheduled_for string

      Example: "2026-11-04T12:44:26.537048Z"

    • segment_id string

      Example: "sgm_12345"

    • sender_id string

      Example: "ms_12345"

    • sent_at string

      Example: "2026-11-04T12:44:26.537035Z"

    • settings object
    • subject string

      Example: "🚀 Our Space Book is Now Available!"

    • template_id string
    • text_body string

      Example: "Hey {{ contact.first_name }}, are you excited for our Space Book?\n\n[…]\n\n## All Books by Acme Space Corp:\n{% for book in campaign.data.books %}\n - {{ book.title }}: [More info]({{ book.url }})\n{% endfor %}\n"

    • text_content object

      Map of named text content slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • updated_at string

      Example: "2026-11-04T12:44:26.537064Z"

  • meta object
post /api/v1/campaigns

Create Campaign

Request body

  • data object
    • data object

      Example: {"books":[{"title":"Space Book","url":"books.books/spacebook"},{"title":"Earth Book","url":"books.books/earthbook"}]}

    • html_body string

      Example: "<!doctype html>\n<html>\n <body>\n <h1>Hello {{ contact.first_name }}!</h1>\n </body>\n</html>\n"

    • html_content object

      Map of named HTML content slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • json_body object

      Example: {"blocks":[{"data":{"text":"Hello, I am a block campaign!"},"id":"ff0011","type":"paragraph"}]}

    • mjml_body string

      Example: "<mjml>\n <mj-body>\n <mj-section>\n <mj-column>\n <mj-text>Hello I’m an MJML campaign!</mj-text>\n </mj-column>\n </mj-section>\n </mj-body>\n</mjml>\n"

    • mjml_content object

      Map of named MJML content slots.

      Example: {"main":"<mj-text>Hi {{ contact.first_name }}!</mj-text>"}

    • preview_text string

      Example: "Hello, I am a preview campaign!"

    • segment_id string

      Example: "sgm_12345"

    • sender_id string

      Example: "ms_12345"

    • settings object required
    • subject string required

      Example: "🚀 Our Space Book is Now Available!"

    • template_id string
    • text_body string

      Example: "Hey {{ contact.first_name }}, are you excited for our Space Book?\n\n[…]\n\n## All Books by Acme Space Corp:\n{% for book in campaign.data.books %}\n - {{ book.title }}: [More info]({{ book.url }})\n{% endfor %}\n"

    • text_content object

      Map of named text content slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

Responses

200 Campaign response

  • data object
    • data object

      Example: {"books":[{"title":"Space Book","url":"books.books/spacebook"},{"title":"Earth Book","url":"books.books/earthbook"}]}

    • html_body string

      Example: "<!doctype html>\n<html>\n <body>\n <h1>Hello {{ contact.first_name }}!</h1>\n </body>\n</html>\n"

    • html_content object

      Map of named HTML content slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • id string

      Campaign ID

      Example: "mc_12345"

    • inserted_at string

      Example: "2026-11-04T12:44:26.537051Z"

    • json_body object

      Example: {"blocks":[{"data":{"text":"Hello, I am a block campaign!"},"id":"ff0011","type":"paragraph"}]}

    • mjml_body string

      Example: "<mjml>\n <mj-body>\n <mj-section>\n <mj-column>\n <mj-text>Hello I’m an MJML campaign!</mj-text>\n </mj-column>\n </mj-section>\n </mj-body>\n</mjml>\n"

    • mjml_content object

      Map of named MJML content slots.

      Example: {"main":"<mj-text>Hi {{ contact.first_name }}!</mj-text>"}

    • preview_text string

      Example: "Hello, I am a preview campaign!"

    • scheduled_for string

      Example: "2026-11-04T12:44:26.537048Z"

    • segment_id string

      Example: "sgm_12345"

    • sender_id string

      Example: "ms_12345"

    • sent_at string

      Example: "2026-11-04T12:44:26.537035Z"

    • settings object
    • subject string

      Example: "🚀 Our Space Book is Now Available!"

    • template_id string
    • text_body string

      Example: "Hey {{ contact.first_name }}, are you excited for our Space Book?\n\n[…]\n\n## All Books by Acme Space Corp:\n{% for book in campaign.data.books %}\n - {{ book.title }}: [More info]({{ book.url }})\n{% endfor %}\n"

    • text_content object

      Map of named text content slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • updated_at string

      Example: "2026-11-04T12:44:26.537064Z"

get /api/v1/campaigns/{id}

Show Campaign

Parameters

Name In Type Required Description
id path string yes Campaign ID

Responses

200 Campaign response

  • data object
    • data object

      Example: {"books":[{"title":"Space Book","url":"books.books/spacebook"},{"title":"Earth Book","url":"books.books/earthbook"}]}

    • html_body string

      Example: "<!doctype html>\n<html>\n <body>\n <h1>Hello {{ contact.first_name }}!</h1>\n </body>\n</html>\n"

    • html_content object

      Map of named HTML content slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • id string

      Campaign ID

      Example: "mc_12345"

    • inserted_at string

      Example: "2026-11-04T12:44:26.537051Z"

    • json_body object

      Example: {"blocks":[{"data":{"text":"Hello, I am a block campaign!"},"id":"ff0011","type":"paragraph"}]}

    • mjml_body string

      Example: "<mjml>\n <mj-body>\n <mj-section>\n <mj-column>\n <mj-text>Hello I’m an MJML campaign!</mj-text>\n </mj-column>\n </mj-section>\n </mj-body>\n</mjml>\n"

    • mjml_content object

      Map of named MJML content slots.

      Example: {"main":"<mj-text>Hi {{ contact.first_name }}!</mj-text>"}

    • preview_text string

      Example: "Hello, I am a preview campaign!"

    • scheduled_for string

      Example: "2026-11-04T12:44:26.537048Z"

    • segment_id string

      Example: "sgm_12345"

    • sender_id string

      Example: "ms_12345"

    • sent_at string

      Example: "2026-11-04T12:44:26.537035Z"

    • settings object
    • subject string

      Example: "🚀 Our Space Book is Now Available!"

    • template_id string
    • text_body string

      Example: "Hey {{ contact.first_name }}, are you excited for our Space Book?\n\n[…]\n\n## All Books by Acme Space Corp:\n{% for book in campaign.data.books %}\n - {{ book.title }}: [More info]({{ book.url }})\n{% endfor %}\n"

    • text_content object

      Map of named text content slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • updated_at string

      Example: "2026-11-04T12:44:26.537064Z"

put /api/v1/campaigns/{id}

Update Campaign

Parameters

Name In Type Required Description
id path string yes Campaign ID

Request body

  • data object
    • data object

      Example: {"books":[{"title":"Space Book","url":"books.books/spacebook"},{"title":"Earth Book","url":"books.books/earthbook"}]}

    • html_body string

      Example: "<!doctype html>\n<html>\n <body>\n <h1>Hello {{ contact.first_name }}!</h1>\n </body>\n</html>\n"

    • html_content object

      Map of named HTML content slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • json_body object

      Example: {"blocks":[{"data":{"text":"Hello, I am a block campaign!"},"id":"ff0011","type":"paragraph"}]}

    • mjml_body string

      Example: "<mjml>\n <mj-body>\n <mj-section>\n <mj-column>\n <mj-text>Hello I’m an MJML campaign!</mj-text>\n </mj-column>\n </mj-section>\n </mj-body>\n</mjml>\n"

    • mjml_content object

      Map of named MJML content slots.

      Example: {"main":"<mj-text>Hi {{ contact.first_name }}!</mj-text>"}

    • preview_text string

      Example: "Hello, I am a preview campaign!"

    • segment_id string

      Example: "sgm_12345"

    • sender_id string

      Example: "ms_12345"

    • settings object
    • subject string

      Example: "🚀 Our Space Book is Now Available!"

    • template_id string
    • text_body string

      Example: "Hey {{ contact.first_name }}, are you excited for our Space Book?\n\n[…]\n\n## All Books by Acme Space Corp:\n{% for book in campaign.data.books %}\n - {{ book.title }}: [More info]({{ book.url }})\n{% endfor %}\n"

    • text_content object

      Map of named text content slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

Responses

200 Campaign response

  • data object
    • data object

      Example: {"books":[{"title":"Space Book","url":"books.books/spacebook"},{"title":"Earth Book","url":"books.books/earthbook"}]}

    • html_body string

      Example: "<!doctype html>\n<html>\n <body>\n <h1>Hello {{ contact.first_name }}!</h1>\n </body>\n</html>\n"

    • html_content object

      Map of named HTML content slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • id string

      Campaign ID

      Example: "mc_12345"

    • inserted_at string

      Example: "2026-11-04T12:44:26.537051Z"

    • json_body object

      Example: {"blocks":[{"data":{"text":"Hello, I am a block campaign!"},"id":"ff0011","type":"paragraph"}]}

    • mjml_body string

      Example: "<mjml>\n <mj-body>\n <mj-section>\n <mj-column>\n <mj-text>Hello I’m an MJML campaign!</mj-text>\n </mj-column>\n </mj-section>\n </mj-body>\n</mjml>\n"

    • mjml_content object

      Map of named MJML content slots.

      Example: {"main":"<mj-text>Hi {{ contact.first_name }}!</mj-text>"}

    • preview_text string

      Example: "Hello, I am a preview campaign!"

    • scheduled_for string

      Example: "2026-11-04T12:44:26.537048Z"

    • segment_id string

      Example: "sgm_12345"

    • sender_id string

      Example: "ms_12345"

    • sent_at string

      Example: "2026-11-04T12:44:26.537035Z"

    • settings object
    • subject string

      Example: "🚀 Our Space Book is Now Available!"

    • template_id string
    • text_body string

      Example: "Hey {{ contact.first_name }}, are you excited for our Space Book?\n\n[…]\n\n## All Books by Acme Space Corp:\n{% for book in campaign.data.books %}\n - {{ book.title }}: [More info]({{ book.url }})\n{% endfor %}\n"

    • text_content object

      Map of named text content slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • updated_at string

      Example: "2026-11-04T12:44:26.537064Z"

patch /api/v1/campaigns/{id}

Update Campaign

Parameters

Name In Type Required Description
id path string yes Campaign ID

Request body

  • data object
    • data object

      Example: {"books":[{"title":"Space Book","url":"books.books/spacebook"},{"title":"Earth Book","url":"books.books/earthbook"}]}

    • html_body string

      Example: "<!doctype html>\n<html>\n <body>\n <h1>Hello {{ contact.first_name }}!</h1>\n </body>\n</html>\n"

    • html_content object

      Map of named HTML content slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • json_body object

      Example: {"blocks":[{"data":{"text":"Hello, I am a block campaign!"},"id":"ff0011","type":"paragraph"}]}

    • mjml_body string

      Example: "<mjml>\n <mj-body>\n <mj-section>\n <mj-column>\n <mj-text>Hello I’m an MJML campaign!</mj-text>\n </mj-column>\n </mj-section>\n </mj-body>\n</mjml>\n"

    • mjml_content object

      Map of named MJML content slots.

      Example: {"main":"<mj-text>Hi {{ contact.first_name }}!</mj-text>"}

    • preview_text string

      Example: "Hello, I am a preview campaign!"

    • segment_id string

      Example: "sgm_12345"

    • sender_id string

      Example: "ms_12345"

    • settings object
    • subject string

      Example: "🚀 Our Space Book is Now Available!"

    • template_id string
    • text_body string

      Example: "Hey {{ contact.first_name }}, are you excited for our Space Book?\n\n[…]\n\n## All Books by Acme Space Corp:\n{% for book in campaign.data.books %}\n - {{ book.title }}: [More info]({{ book.url }})\n{% endfor %}\n"

    • text_content object

      Map of named text content slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

Responses

200 Campaign response

  • data object
    • data object

      Example: {"books":[{"title":"Space Book","url":"books.books/spacebook"},{"title":"Earth Book","url":"books.books/earthbook"}]}

    • html_body string

      Example: "<!doctype html>\n<html>\n <body>\n <h1>Hello {{ contact.first_name }}!</h1>\n </body>\n</html>\n"

    • html_content object

      Map of named HTML content slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • id string

      Campaign ID

      Example: "mc_12345"

    • inserted_at string

      Example: "2026-11-04T12:44:26.537051Z"

    • json_body object

      Example: {"blocks":[{"data":{"text":"Hello, I am a block campaign!"},"id":"ff0011","type":"paragraph"}]}

    • mjml_body string

      Example: "<mjml>\n <mj-body>\n <mj-section>\n <mj-column>\n <mj-text>Hello I’m an MJML campaign!</mj-text>\n </mj-column>\n </mj-section>\n </mj-body>\n</mjml>\n"

    • mjml_content object

      Map of named MJML content slots.

      Example: {"main":"<mj-text>Hi {{ contact.first_name }}!</mj-text>"}

    • preview_text string

      Example: "Hello, I am a preview campaign!"

    • scheduled_for string

      Example: "2026-11-04T12:44:26.537048Z"

    • segment_id string

      Example: "sgm_12345"

    • sender_id string

      Example: "ms_12345"

    • sent_at string

      Example: "2026-11-04T12:44:26.537035Z"

    • settings object
    • subject string

      Example: "🚀 Our Space Book is Now Available!"

    • template_id string
    • text_body string

      Example: "Hey {{ contact.first_name }}, are you excited for our Space Book?\n\n[…]\n\n## All Books by Acme Space Corp:\n{% for book in campaign.data.books %}\n - {{ book.title }}: [More info]({{ book.url }})\n{% endfor %}\n"

    • text_content object

      Map of named text content slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • updated_at string

      Example: "2026-11-04T12:44:26.537064Z"

delete /api/v1/campaigns/{id}

Delete Campaign

Parameters

Name In Type Required Description
id path string yes Campaign ID

Responses

204 Campaign was deleted successfully or didn’t exist.

post /api/v1/campaigns/{id}/actions/schedule

Schedule Campaign

Parameters

Name In Type Required Description
id path string yes Campaign ID

Request body

  • data object
    • scheduled_for string

      Example: "2026-11-04T12:44:26.537048Z"

Responses

200 Campaign response

  • data object
    • data object

      Example: {"books":[{"title":"Space Book","url":"books.books/spacebook"},{"title":"Earth Book","url":"books.books/earthbook"}]}

    • html_body string

      Example: "<!doctype html>\n<html>\n <body>\n <h1>Hello {{ contact.first_name }}!</h1>\n </body>\n</html>\n"

    • html_content object

      Map of named HTML content slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • id string

      Campaign ID

      Example: "mc_12345"

    • inserted_at string

      Example: "2026-11-04T12:44:26.537051Z"

    • json_body object

      Example: {"blocks":[{"data":{"text":"Hello, I am a block campaign!"},"id":"ff0011","type":"paragraph"}]}

    • mjml_body string

      Example: "<mjml>\n <mj-body>\n <mj-section>\n <mj-column>\n <mj-text>Hello I’m an MJML campaign!</mj-text>\n </mj-column>\n </mj-section>\n </mj-body>\n</mjml>\n"

    • mjml_content object

      Map of named MJML content slots.

      Example: {"main":"<mj-text>Hi {{ contact.first_name }}!</mj-text>"}

    • preview_text string

      Example: "Hello, I am a preview campaign!"

    • scheduled_for string

      Example: "2026-11-04T12:44:26.537048Z"

    • segment_id string

      Example: "sgm_12345"

    • sender_id string

      Example: "ms_12345"

    • sent_at string

      Example: "2026-11-04T12:44:26.537035Z"

    • settings object
    • subject string

      Example: "🚀 Our Space Book is Now Available!"

    • template_id string
    • text_body string

      Example: "Hey {{ contact.first_name }}, are you excited for our Space Book?\n\n[…]\n\n## All Books by Acme Space Corp:\n{% for book in campaign.data.books %}\n - {{ book.title }}: [More info]({{ book.url }})\n{% endfor %}\n"

    • text_content object

      Map of named text content slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • updated_at string

      Example: "2026-11-04T12:44:26.537064Z"

post /api/v1/campaigns/{id}/actions/send

Deliver Campaign

Parameters

Name In Type Required Description
id path string yes Campaign ID

Responses

202 Campaign delivery queued

  • data object
    • campaign_id string

      Campaign ID

      Example: "mc_12345"

    • delivery_queued true

      This indicates that the delivery of the campaign will be processed asynchronously.

      Note: If the campaign is invalid (e.g. missing a sender) or if your account has insufficient credits, the campaign will not be delivered regardless of the response from the endpoint.