# Messages

## Get all messages on an issue

> Returns all messages for the specified issue, including replies and internal notes.\
> \
> \*\*Rate limit:\*\* 20 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"GetIssueMessagesResponseBody":{"properties":{"data":{"description":"The data payload of the response.","items":{"$ref":"#/components/schemas/Message"},"type":"array"},"pagination":{"$ref":"#/components/schemas/Pagination"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Message":{"properties":{"author":{"$ref":"#/components/schemas/MessageAuthor"},"email_info":{"$ref":"#/components/schemas/EmailMessageInfo"},"file_urls":{"description":"The URLs of the files in the message, if any.","items":{"type":"string"},"type":"array"},"id":{"description":"The ID of the message.","type":"string"},"is_private":{"description":"Indicates if the message is private.","type":"boolean"},"message_html":{"description":"The HTML body of the message.","type":"string"},"source":{"description":"The source of the message.","type":"string"},"thread_id":{"description":"The ID of the thread the message belongs to. This is only set for internal notes.","type":"string"},"timestamp":{"description":"The time at which the message was created.","type":"string"}},"type":"object"},"MessageAuthor":{"properties":{"avatar_url":{"type":"string"},"contact":{"$ref":"#/components/schemas/MiniContact"},"name":{"type":"string"},"user":{"$ref":"#/components/schemas/MiniUser"}},"type":"object"},"MiniContact":{"properties":{"email":{"description":"The email of the contact.","type":"string"},"id":{"description":"The ID of the contact.","type":"string"}},"type":"object"},"MiniUser":{"properties":{"email":{"description":"The email of the user.","type":"string"},"id":{"description":"The ID of the user.","type":"string"}},"type":"object"},"EmailMessageInfo":{"properties":{"bcc_emails":{"description":"The email addresses of the BCC recipients of the message.","items":{"type":"string"},"type":"array"},"cc_emails":{"description":"The email addresses of the CC recipients of the message.","items":{"type":"string"},"type":"array"},"from_email":{"description":"The email address of the sender of the message.","type":"string"},"message_id":{"description":"MessageID is the RFC 5322 Message-ID header value for this email.","type":"string"},"to_emails":{"description":"The email addresses of the recipients of the message.","items":{"type":"string"},"type":"array"}},"type":"object"},"Pagination":{"properties":{"cursor":{"description":"The cursor for the next page of results.","type":"string"},"has_next_page":{"description":"Indicates if there is a next page of results.","type":"boolean"}},"required":["cursor","has_next_page"],"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/issues/{id}/messages":{"get":{"description":"Returns all messages for the specified issue, including replies and internal notes.\n\n**Rate limit:** 20 requests per minute","operationId":"GetIssueMessages","parameters":[{"description":"The ID of the issue to fetch messages for.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetIssueMessagesResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Get all messages on an issue","tags":["messages"]}}}}
```

## Get all threads on an issue

> Returns all threads for the specified issue.\
> \
> \*\*Rate limit:\*\* 20 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"GetIssueThreadsResponseBody":{"properties":{"data":{"description":"The data payload of the response.","items":{"$ref":"#/components/schemas/IssueThread"},"type":"array"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"IssueThread":{"description":"A thread of notes on an issue, for internal discussions not visible to the customer.\n\nThreads can be created manually through the UI or from triggers.\n\nIf a channel ID is set, this thread is being synced with a chat platform.","properties":{"channel_id":{"description":"The ID of the channel that the thread belongs to, if the thread is being synced with a chat platform.","type":"string"},"id":{"description":"The ID of the thread.","type":"string"},"issue_id":{"description":"The issue ID that the thread belongs to.","type":"string"},"name":{"description":"The name of the thread.","type":"string"},"source":{"description":"The source of the thread.","type":"string"},"thread_id":{"description":"The ID of the thread that the thread belongs to, if the thread is being synced with a chat platform. A thread ID for Slack would be the thread timestamp.","type":"string"}},"title":"IssueThread","type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/issues/{id}/threads":{"get":{"description":"Returns all threads for the specified issue.\n\n**Rate limit:** 20 requests per minute","operationId":"GetIssueThreads","parameters":[{"description":"The ID of the issue to fetch threads for.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetIssueThreadsResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Get all threads on an issue","tags":["messages"]}}}}
```

## Create a thread on an issue

> Creates a new internal thread on an issue.\
> \
> \*\*Rate limit:\*\* 20 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"CreateIssueThreadRequestBody":{"properties":{"name":{"description":"The name of the thread.","type":"string"}},"type":"object"},"CreateIssueThreadResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/IssueThread"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"IssueThread":{"description":"A thread of notes on an issue, for internal discussions not visible to the customer.\n\nThreads can be created manually through the UI or from triggers.\n\nIf a channel ID is set, this thread is being synced with a chat platform.","properties":{"channel_id":{"description":"The ID of the channel that the thread belongs to, if the thread is being synced with a chat platform.","type":"string"},"id":{"description":"The ID of the thread.","type":"string"},"issue_id":{"description":"The issue ID that the thread belongs to.","type":"string"},"name":{"description":"The name of the thread.","type":"string"},"source":{"description":"The source of the thread.","type":"string"},"thread_id":{"description":"The ID of the thread that the thread belongs to, if the thread is being synced with a chat platform. A thread ID for Slack would be the thread timestamp.","type":"string"}},"title":"IssueThread","type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/issues/{id}/threads":{"post":{"description":"Creates a new internal thread on an issue.\n\n**Rate limit:** 20 requests per minute","operationId":"CreateIssueThread","parameters":[{"description":"The ID of the issue to create a thread for.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIssueThreadRequestBody"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIssueThreadResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Create a thread on an issue","tags":["messages"]}}}}
```

## Reply to an issue

> Sends a customer-facing reply on an issue, visible to the requester.\
> \
> \*\*Rate limit:\*\* 10 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"CreateIssueReplyRequestBody":{"properties":{"attachment_urls":{"description":"An array of attachment URLs to attach to this issue.","items":{"type":"string"},"type":"array"},"body_html":{"description":"The body of the message in HTML.","type":"string"},"contact_id":{"description":"Optional contact ID to post the message as. Only one of user_id or contact_id can be provided.","type":"string"},"custom_source":{"$ref":"#/components/schemas/CustomSourceInfo"},"email_info":{"$ref":"#/components/schemas/CreateIssueReplyEmailInfo"},"message_id":{"description":"The ID of the message to reply to.","type":"string"},"user_id":{"description":"Optional user ID to post the message as. Only one of user_id or contact_id can be provided.","type":"string"}},"required":["body_html","message_id"],"type":"object"},"CustomSourceInfo":{"properties":{"created_at":{"description":"The timestamp of when the message was created in the external system. (RFC3339)","type":"string"},"external_id":{"description":"The external ID of this message in the custom system.","type":"string"},"metadata":{"additionalProperties":{"type":"object"},"description":"Arbitrary metadata to store with the message.","type":"object"}},"required":["external_id"],"title":"CustomSourceInfo contains metadata for messages on custom source issues.","type":"object"},"CreateIssueReplyEmailInfo":{"properties":{"bcc_emails":{"items":{"type":"string"},"type":"array"},"cc_emails":{"items":{"type":"string"},"type":"array"},"to_emails":{"items":{"type":"string"},"type":"array"}},"type":"object"},"CreateIssueReplyResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/CreateIssueReplyResponseData"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"CreateIssueReplyResponseData":{"properties":{"id":{"description":"The ID of the message.","type":"string"},"issue_id":{"description":"The ID of the issue.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/issues/{id}/reply":{"post":{"description":"Sends a customer-facing reply on an issue, visible to the requester.\n\n**Rate limit:** 10 requests per minute","operationId":"CreateIssueReply","parameters":[{"description":"The ID of the issue.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIssueReplyRequestBody"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIssueReplyResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Reply to an issue","tags":["messages"]}}}}
```

## Create an internal note on an issue

> Posts an internal note on an issue thread. Not visible to the requester.\
> \
> \*\*Rate limit:\*\* 10 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"CreateIssueNoteRequestBody":{"properties":{"attachment_urls":{"description":"An array of attachment URLs to attach to this issue.","items":{"type":"string"},"type":"array"},"body_html":{"description":"The body of the message in HTML.","type":"string"},"message_id":{"description":"The ID of the message to reply to. This message must be an internal note. You can find this from the GET /issues/{id}/messages endpoint. If neither thread_id nor message_id is provided, posts to the default internal thread or creates one.","type":"string"},"thread_id":{"description":"The ID of the thread to post the note to. Use the `id` field (not `thread_id`) from GET /issues/{id}/threads. If neither thread_id nor message_id is provided, posts to the default internal thread or creates one.","type":"string"},"thread_name":{"description":"Optional name for the internal thread created when neither thread_id nor message_id is provided. Ignored if posting to an existing thread.","type":"string"},"user_id":{"description":"Optional user ID to post the message as. If not provided, the API token user will be used.","type":"string"}},"required":["body_html"],"type":"object"},"CreateIssueNoteResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/CreateIssueNoteResponseData"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"CreateIssueNoteResponseData":{"properties":{"id":{"description":"The ID of the message.","type":"string"},"issue_id":{"description":"The ID of the issue.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/issues/{id}/note":{"post":{"description":"Posts an internal note on an issue thread. Not visible to the requester.\n\n**Rate limit:** 10 requests per minute","operationId":"CreateIssueNote","parameters":[{"description":"The ID of the issue.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIssueNoteRequestBody"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIssueNoteResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Create an internal note on an issue","tags":["messages"]}}}}
```

## Redact a message

> Permanently redacts a message's content. This action cannot be undone.\
> \
> \*\*Rate limit:\*\* 20 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"RedactMessageResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/Message"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Message":{"properties":{"author":{"$ref":"#/components/schemas/MessageAuthor"},"email_info":{"$ref":"#/components/schemas/EmailMessageInfo"},"file_urls":{"description":"The URLs of the files in the message, if any.","items":{"type":"string"},"type":"array"},"id":{"description":"The ID of the message.","type":"string"},"is_private":{"description":"Indicates if the message is private.","type":"boolean"},"message_html":{"description":"The HTML body of the message.","type":"string"},"source":{"description":"The source of the message.","type":"string"},"thread_id":{"description":"The ID of the thread the message belongs to. This is only set for internal notes.","type":"string"},"timestamp":{"description":"The time at which the message was created.","type":"string"}},"type":"object"},"MessageAuthor":{"properties":{"avatar_url":{"type":"string"},"contact":{"$ref":"#/components/schemas/MiniContact"},"name":{"type":"string"},"user":{"$ref":"#/components/schemas/MiniUser"}},"type":"object"},"MiniContact":{"properties":{"email":{"description":"The email of the contact.","type":"string"},"id":{"description":"The ID of the contact.","type":"string"}},"type":"object"},"MiniUser":{"properties":{"email":{"description":"The email of the user.","type":"string"},"id":{"description":"The ID of the user.","type":"string"}},"type":"object"},"EmailMessageInfo":{"properties":{"bcc_emails":{"description":"The email addresses of the BCC recipients of the message.","items":{"type":"string"},"type":"array"},"cc_emails":{"description":"The email addresses of the CC recipients of the message.","items":{"type":"string"},"type":"array"},"from_email":{"description":"The email address of the sender of the message.","type":"string"},"message_id":{"description":"MessageID is the RFC 5322 Message-ID header value for this email.","type":"string"},"to_emails":{"description":"The email addresses of the recipients of the message.","items":{"type":"string"},"type":"array"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/issues/{id}/messages/{message_id}/redact":{"post":{"description":"Permanently redacts a message's content. This action cannot be undone.\n\n**Rate limit:** 20 requests per minute","operationId":"RedactMessage","parameters":[{"description":"The ID of the issue that the message belongs to.","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"The ID of the message to redact.","in":"path","name":"message_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedactMessageResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Redact a message","tags":["messages"]}}}}
```

## Delete a message

> Permanently deletes a message from an issue and its connected external system.\
> \
> \*\*Rate limit:\*\* 10 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"DeleteMessageResponseBody":{"properties":{"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/issues/{id}/messages/{message_id}":{"delete":{"description":"Permanently deletes a message from an issue and its connected external system.\n\n**Rate limit:** 10 requests per minute","operationId":"DeleteMessage","parameters":[{"description":"The ID of the issue that the message belongs to.","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"The ID of the message to delete.","in":"path","name":"message_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteMessageResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Delete a message","tags":["messages"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.usepylon.com/pylon-docs/developer/api/api-reference/messages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
