|  | 
|  | 1 | + | 
|  | 2 | +# Call to Action Template API | 
|  | 3 | + | 
|  | 4 | +## Get all CTA templates | 
|  | 5 | + | 
|  | 6 | +``` | 
|  | 7 | +GET /cta-block/all | 
|  | 8 | +``` | 
|  | 9 | + | 
|  | 10 | +Gets a list with the ids of all available CTA template blocks. | 
|  | 11 | + | 
|  | 12 | +## Get one CTA template | 
|  | 13 | + | 
|  | 14 | +``` | 
|  | 15 | +GET /cta-block/:id | 
|  | 16 | +``` | 
|  | 17 | + | 
|  | 18 | +Reading a specific CTA block does not allow for any additional parameters. It only takes the id in the request url and simply provides you with all data for this one. | 
|  | 19 | + | 
|  | 20 | +### Potential response | 
|  | 21 | + | 
|  | 22 | +```json | 
|  | 23 | +{ | 
|  | 24 | +  "name": "Newsletter Dummy CTA", | 
|  | 25 | +  "type": "form", | 
|  | 26 | +  "headline": "🥰 Next: Sign up for our Newsletter", | 
|  | 27 | +  "text": "", | 
|  | 28 | +  "fields": [ | 
|  | 29 | +    { | 
|  | 30 | +      "type": "text", | 
|  | 31 | +      "name": "email", | 
|  | 32 | +      "label": "", | 
|  | 33 | +      "required": false, | 
|  | 34 | +      "placeholder": "Email" | 
|  | 35 | +    }, | 
|  | 36 | +    { | 
|  | 37 | +      "type": "text", | 
|  | 38 | +      "name": "name", | 
|  | 39 | +      "label": "", | 
|  | 40 | +      "required": false, | 
|  | 41 | +      "placeholder": "Full Name" | 
|  | 42 | +    }, | 
|  | 43 | +    { | 
|  | 44 | +      "type": "checkbox", | 
|  | 45 | +      "name": "terms", | 
|  | 46 | +      "label": "I want to receive informative as well as promotional emails.", | 
|  | 47 | +      "required": true, | 
|  | 48 | +      "default": false | 
|  | 49 | +    } | 
|  | 50 | +  ], | 
|  | 51 | +  "url": "https://newsletter-endpoint.your-domain.com", | 
|  | 52 | +  "button_label": "Sign up", | 
|  | 53 | +  "date_created": "2024-06-27T15:36:30.988Z", | 
|  | 54 | +  "date_updated": "2025-05-06T22:18:40.306Z" | 
|  | 55 | +} | 
|  | 56 | +``` | 
|  | 57 | + | 
|  | 58 | +<br /> | 
|  | 59 | + | 
|  | 60 | +## Add a CTA template | 
|  | 61 | + | 
|  | 62 | +``` | 
|  | 63 | +POST /cta-block | 
|  | 64 | +``` | 
|  | 65 | + | 
|  | 66 | +Creating a new CTA template block requires you to at least provide the "name" and "type" fields in the body. | 
|  | 67 | + | 
|  | 68 | +```json | 
|  | 69 | +{ | 
|  | 70 | +  "name": "Name of the item", // only internal | 
|  | 71 | +  "type": "text" // options: none, text, link, share, form, | 
|  | 72 | +} | 
|  | 73 | +``` | 
|  | 74 | + | 
|  | 75 | +### Potential request with all fields | 
|  | 76 | + | 
|  | 77 | +```json | 
|  | 78 | +{ | 
|  | 79 | +  "name": "Name of the item", | 
|  | 80 | +  "type": "text", | 
|  | 81 | +  "headline": "Headline in the modal", | 
|  | 82 | +  "text": "Additional intro text", | 
|  | 83 | +  "fields": [ // see notes below for details | 
|  | 84 | +    { | 
|  | 85 | +      "type": "text", | 
|  | 86 | +      "name": "additional_info", | 
|  | 87 | +      "label": "Additional note", | 
|  | 88 | +      "required": false, | 
|  | 89 | +      "placeholder": "Type here...", | 
|  | 90 | +      "default": "Call me maybe" | 
|  | 91 | +    }, | 
|  | 92 | +    { | 
|  | 93 | +      "type": "checkbox", | 
|  | 94 | +      "name": "required_check", | 
|  | 95 | +      "label": "a required check", | 
|  | 96 | +      "required": true, | 
|  | 97 | +      "default": false | 
|  | 98 | +    } | 
|  | 99 | +  ], | 
|  | 100 | +  "url": "https://url-to.your-domain.com", // depending on the type, this is the link or endpoint for the form data | 
|  | 101 | +  "button_label": "Click me" | 
|  | 102 | +} | 
|  | 103 | +``` | 
|  | 104 | + | 
|  | 105 | +For the fields array, you can add the following types (`type`): | 
|  | 106 | +* **text**: Renders a regular text-type input field. | 
|  | 107 | +* **number**: Renders a number-type input field. | 
|  | 108 | +* **checkbox**: Renders a checkbox. | 
|  | 109 | +* **radio**: Renders a radio button. Consecutive radio fields form 1 group. | 
|  | 110 | +* **label**: Only renders the label text. If put in front of a radio group, it would turn into the radio group's label. | 
|  | 111 | +* **hidden**: Would not show up at the UI level. Can be used to transmit additional data on send. | 
|  | 112 | + | 
|  | 113 | +Besides the type, fields take the following attributes: | 
|  | 114 | +* **name**: The identifier, also used for the results' data table. | 
|  | 115 | +* **required**: true/false. | 
|  | 116 | +* **label**: The label of the field. Simple string. | 
|  | 117 | +* **placeholder**: A potential placeholder ("text", "number", and "radio" only). For "radio" fields, this is the value of the field. | 
|  | 118 | +* **default**: The default value. String for "text", "number", and "hidden". True/false for "checkbox" and "radio". | 
|  | 119 | + | 
|  | 120 | +### Potential response | 
|  | 121 | + | 
|  | 122 | +```json | 
|  | 123 | +{ | 
|  | 124 | +  "success": "CTA template created", | 
|  | 125 | +  "id": "67" | 
|  | 126 | +} | 
|  | 127 | +``` | 
|  | 128 | + | 
|  | 129 | +The id from a successful creation can be used for further processing, like using it at an event call. | 
|  | 130 | + | 
|  | 131 | +<br /> | 
|  | 132 | + | 
|  | 133 | +## Update a CTA template | 
|  | 134 | + | 
|  | 135 | +``` | 
|  | 136 | +PATCH /cta-block/:id | 
|  | 137 | +``` | 
|  | 138 | + | 
|  | 139 | +Updating a CTA template block follows the same rules as creating one. | 
|  | 140 | + | 
|  | 141 | +<br /> | 
|  | 142 | + | 
|  | 143 | +## Delete a CTA template | 
|  | 144 | + | 
|  | 145 | +``` | 
|  | 146 | +DELETE /cta-block/:id | 
|  | 147 | +``` | 
|  | 148 | + | 
|  | 149 | +Deleting a CTA template block is simple. Only provide the prokey and it gets removed. | 
|  | 150 | + | 
|  | 151 | +**Be careful with this call!** | 
|  | 152 | + | 
|  | 153 | +::: warning This does not delete events or groups! | 
|  | 154 | +They remain active, but lose their CTA functionality. | 
|  | 155 | +::: | 
0 commit comments