Create Email Comment
const url = 'https://example.com/%7B%7Bapp_url%7D/api/v1/workspaces/1/emails/1/email_comments';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"locale":"en-GB","parent_id":1,"body":"<p>Can we change the hero image?</p>","pin_data":{"id":"12345","component_instance_id":"12345","branch_key":"a_branch_key","coordinates":{"center_offset_x_px":0.5,"y":0.5}},"anchor":{"id":"0d3c9a52-8f0e-4a7b-9a1c-1f2e3d4c5b6a","component_instance_id":"5b2f8c1e-3d4a-4e6f-8a9b-0c1d2e3f4a5b","branch_key":"null_branch","quote":{"exact":"Shop the sale","prefix":"Ends Sunday. ","suffix":" now"}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/%7B%7Bapp_url%7D/api/v1/workspaces/1/emails/1/email_comments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "locale": "en-GB", "parent_id": 1, "body": "<p>Can we change the hero image?</p>", "pin_data": { "id": "12345", "component_instance_id": "12345", "branch_key": "a_branch_key", "coordinates": { "center_offset_x_px": 0.5, "y": 0.5 } }, "anchor": { "id": "0d3c9a52-8f0e-4a7b-9a1c-1f2e3d4c5b6a", "component_instance_id": "5b2f8c1e-3d4a-4e6f-8a9b-0c1d2e3f4a5b", "branch_key": "null_branch", "quote": { "exact": "Shop the sale", "prefix": "Ends Sunday. ", "suffix": " now" } } }'Creates a new email comment.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Workspace ID
Email ID
Request Body
Section titled “Request Body”object
A BCP 47 language tag identifying the language and region of a piece of content. Must carry both a language and a region subtag, and must be in canonical case (lowercase language, titlecase script, uppercase region) — en-GB, not en-gb or en_GB. The region may be a UN M.49 code, so en-001 (world) is valid.
Example
en-GBThe ID of the parent comment to reply to. Omit to create a top-level comment.
Example
1The content of the comment.
Example
<p>Can we change the hero image?</p>object
Example
12345Example
12345Example
a_branch_keyobject
The horizontal offset of the pin from the center of the component, in pixels.
Example
0.5The vertical position of the pin, as a percentage (0–1) from the top of the component.
Example
0.5Anchors a comment to a passage of text inside a component instance. The passage is found again in the rendered email by searching for the quote, so it survives edits elsewhere in the email.
object
Example
0d3c9a52-8f0e-4a7b-9a1c-1f2e3d4c5b6aExample
5b2f8c1e-3d4a-4e6f-8a9b-0c1d2e3f4a5bExample
null_branchobject
The highlighted text, as it appears in the rendered email.
Example
Shop the saleThe text immediately before the highlighted text, used to tell repeated passages apart.
Example
Ends Sunday.The text immediately after the highlighted text, used to tell repeated passages apart.
Example
nowResponses
Section titled “ Responses ”Successful
object
A BCP 47 language tag identifying the language and region of a piece of content. Must carry both a language and a region subtag, and must be in canonical case (lowercase language, titlecase script, uppercase region) — en-GB, not en-gb or en_GB. The region may be a UN M.49 code, so en-001 (world) is valid.
object
object
The horizontal offset of the pin from the center of the component, in pixels.
The vertical position of the pin, as a percentage (0–1) from the top of the component.
Anchors a comment to a passage of text inside a component instance. The passage is found again in the rendered email by searching for the quote, so it survives edits elsewhere in the email.
object
object
The highlighted text, as it appears in the rendered email.
The text immediately before the highlighted text, used to tell repeated passages apart.
The text immediately after the highlighted text, used to tell repeated passages apart.
A field value change suggested to address a comment.
object
A BCP 47 language tag identifying the language and region of a piece of content. Must carry both a language and a region subtag, and must be in canonical case (lowercase language, titlecase script, uppercase region) — en-GB, not en-gb or en_GB. The region may be a UN M.49 code, so en-001 (world) is valid.
The liquid variable of the field to change.
Example
{ "id": 12345, "email_id": 12345, "ai_review_id": 54321, "locale": "en-GB", "author_type": "User", "author": { "type": "User", "id": 12345, "first_name": "John", "last_name": "Smith", "profile_image_url": "https://example.com/profile.jpg" }, "parent_id": 12345, "pin_data": { "id": "12345", "component_instance_id": "12345", "branch_key": "a_branch_key", "coordinates": { "center_offset_x_px": 0.5, "y": 0.5 } }, "anchor": { "id": "0d3c9a52-8f0e-4a7b-9a1c-1f2e3d4c5b6a", "component_instance_id": "5b2f8c1e-3d4a-4e6f-8a9b-0c1d2e3f4a5b", "branch_key": "null_branch", "quote": { "exact": "Shop the sale", "prefix": "Ends Sunday. ", "suffix": " now" } }, "suggested_changes": [ { "component_instance_id": "5b2f8c1e-3d4a-4e6f-8a9b-0c1d2e3f4a5b", "branch_key": "null_branch", "locale": "en-GB", "liquid_variable": "headline", "value": "Shop the sale" } ], "body": "This is a comment", "resolved": false, "resolver_id": 12345, "resolver": { "type": "User", "id": 12345, "first_name": "John", "last_name": "Smith", "profile_image_url": "https://example.com/profile.jpg" }, "created_at": "2023-08-23T10:30:00.000Z"}Unauthorized
object
Example
{ "message": "Record not found", "code": "share_link_expired"}Forbidden
object
Example
{ "message": "Record not found", "code": "share_link_expired"}Not Found
object
Example
{ "message": "Record not found", "code": "share_link_expired"}Unprocessable Entity
object
object
Example
{ "errors": { "username": [ "Username is required.", "Username must be unique." ], "email": [ "Invalid email format." ] }}