Text Attachments

You can create posts with text attachments using the Threads API. Text attachments allow you to share long-form writing in a post or a reply with up to 10,000 characters and a link. They can also include emojis and style formatting.

Limitations

  • Text attachments can only be attached to text-only posts.
  • Text attachments cannot be attached to a post that has a poll.
  • If there is already a link attachment in the main post, a link attachment cannot be added in the text attachment.

Create a Post with a Text Attachment

Step 1: Create a Threads media container

You can add a text attachment to a post by making a request to the POST /{threads-user-id}/threads endpoint to create a media container with the text_attachment JSON object.

Parameters

NameDescription

plaintext

string

Required.
The text of the text attachment with a maximum of 10K characters.

link_attachment_url

URL

Optional.
The URL of a link to include in the text attachment.

text_with_styling_info

string

Optional.
The styling info be applied to the text and where it should appear.

Values: offset, length, styling_info

Note: The text styling info ranges within the text_with_styling_info field should not overlap.

Available text styles:

  • Bold
  • Italic
  • Highlight
  • Underline
  • Strikethrough

Example request

curl -i -X POST \
  -d "media_type=TEXT" \
  -d "text=<TEXT>" \
  -d "access_token=<ACCESS_TOKEN>" \
  -d "text_attachment=
    {
      "plaintext": "Lengthy plain text for the text attachment.",
      "link_attachment_url": "<LINK_URL>",
      "text_with_styling_info":[
        {
          "offset": 0,
          "length": 7,
          "styling_info":["bold","italic"]
        },
        {
          "offset": 7,
          "length": 10,
          "styling_info":["highlight"]
        }]
    }" \
"https://graph.threads.net/v1.0/<THREADS_USER_ID>/threads"

Example response

{
  "id": "<THREADS_MEDIA_CONTAINER_ID>"
}

Step 2: Publish the media container

You can publish using the returned Threads media container ID to create your Threads post with a text attachment.

Retrieve Posts with Text Attachments

Make a request to the GET /{threads-user-id}/threads or GET /{threads-media-id} endpoint with the text_attachment field to retrieve any media object(s) with text attachments.

Parameters

NameDescription

text_attachment

The text attachment for the post.

Example request

curl -i -X GET \
  -d "access_token=<ACCESS_TOKEN>" \
  -d "fields=id,text_attachment" \
"https://graph.threads.net/v1.0/<THREADS_MEDIA_ID>

Example response

{
  "id": "<THREADS_MEDIA_ID>",
  "text_attachment": {
    "plaintext": "Lengthy plaintext for the text attachment.",
    "link_attachment_url": "<LINK_URL>",
    "text_with_styling_info": [
      {
        "offset": 0,
        "length": 7,
        "styling_info":["bold","italic"]
      },
      {
        "offset": 7,
        "length": 10,
        "styling_info":["highlight"]
      }]
  }
}