X guide
How can an AI agent extract information from an X post and return JSON?
Send an X post URL, a prompt, and a JSON Schema to mamitsu. It reads the post text and attached media, then returns the information you need as structured JSON.
The request tells mamitsu what to understand
Give it a URL, a prompt, and a schema.
The X URL selects one post. The prompt describes the information to extract. The schema turns the result into a stable JSON shape for your application. The mamitsu API reference documents these as the required url, prompt, and schema fields.
This example asks mamitsu to extract information from the content, not just return post metadata.
curl https://usemamitsu.com/api/v1/extract \
-H "Authorization: Bearer $XTRAKT_USER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://x.com/example/status/123456789",
"prompt": "Extract the main claims and named entities from this post. Include claims stated in the text or clearly shown in attached media. Do not add claims that are not supported by the post.",
"schema": {
"type": "object",
"properties": {
"claims": {
"type": "array",
"description": "The main factual or opinion claims made in the post",
"items": {
"type": "object",
"properties": {
"claim": {
"type": "string",
"description": "A concise statement of the claim"
},
"support": {
"type": [
"string",
"null"
],
"description": "The text or visible media detail that supports the claim, or null when no clear support is available"
}
},
"required": [
"claim",
"support"
],
"additionalProperties": false
}
},
"named_entities": {
"type": "array",
"description": "People, organizations, products, places, or other named entities in the post",
"items": {
"type": "string"
}
}
},
"required": [
"claims",
"named_entities"
],
"additionalProperties": false
}
}'Extract the main claims and named entities from this post. Include claims stated in the text or clearly shown in attached media. Do not add claims that are not supported by the post.The result contains your data and the source
Your JSON comes back under data.
A successful response returns the object shaped by your schema and identifies the source provider and URL that were processed.
The example values are illustrative. Check the values that matter before using them in a customer-facing or automated workflow.
{
"type": "object",
"properties": {
"claims": {
"type": "array",
"description": "The main factual or opinion claims made in the post",
"items": {
"type": "object",
"properties": {
"claim": {
"type": "string",
"description": "A concise statement of the claim"
},
"support": {
"type": ["string", "null"],
"description": "The text or visible media detail that supports the claim, or null when no clear support is available"
}
},
"required": ["claim", "support"],
"additionalProperties": false
}
},
"named_entities": {
"type": "array",
"description": "People, organizations, products, places, or other named entities in the post",
"items": { "type": "string" }
}
},
"required": ["claims", "named_entities"],
"additionalProperties": false
}{
"extraction_id": "ext_example",
"data": {
"claims": [
{
"claim": "Example claim from the post",
"support": "The post states the claim directly."
}
],
"named_entities": ["Example organization"]
},
"source": {
"provider": "x",
"url": "https://x.com/example/status/123456789"
}
}How mamitsu reads the source
mamitsu reads the post and its attached media
An X post is more than a text string. The mamitsu homepage describes the workflow as watching frames, hearing audio, and reading the caption, while the API reference specifies that X extraction includes the post text and attached media. mamitsu can interpret:
- The post text, including the context around a link or attachment.
- Photos and GIFs, including visible text and objects.
- Attached videos, including frames and audio where the content provides them.
This is content understanding, not only retrieval
A post metadata pipeline can return text, author details, and engagement fields. mamitsu's extract workflow is designed for the next step: interpret the post and its attached media against your prompt, then return the result in the schema your application requested. That is useful when the information you need is visible in a photo, video, or GIF rather than stated in the post text.
Keep the result honest
Allow missing facts instead of forcing guesses.
Posts can be short, ambiguous, or media-heavy. Make a field nullable when the post may not contain the information. The mamitsu API reference documents nullable values for details that do not appear in the source. For claims, keep the source text or visible evidence in your own workflow when the result will drive a decision.
{
"type": ["string", "null"],
"description": "The value, or null when the source does not state it"
}Build the edge cases into your agent
Know which URLs and limits apply.
Public posts and videos work. A request times out after 90 seconds, and X videos over 6 minutes in total return url_video_too_long. Private, removed, or blocked posts return an error instead of data. Useful error codes include unsupported_url, url_source_inaccessible, invalid_schema, and extraction_failed. The request body can be up to 64 KB. Schemas can be up to 16 KB, 8 levels deep, and 200 nodes.
x.com/handle/status/idtwitter.com/handle/status/id
X is one input to the same mamitsu workflow used for TikTok, Instagram, and YouTube. Your agent sends a URL, a prompt, and a schema. mamitsu interprets the content available at that URL and returns the requested JSON with a source record.
Back to API referenceSources
The extraction endpoint is POST /api/v1/extract. Read the API reference for the complete schema and error-code list.