Mastodon Posts by user API
API health
- 24h health
- Normal
- 24h average time
- —
- Healthy / normal
- Available
- Limited
- Mostly down
Last 24 hours
Last 30 days
Pull the posts of one Mastodon account, given as a handle or user@instance in username, with like, boost and reply counts, language and a flag marking boosts. Same-named accounts on other instances stay separate, and the full history is not guaranteed.
Mastodon Posts by user follows one account on a Mastodon server, named in username as user@instance, and returns its public posts. Each row carries the post text with HTML removed, its link, like, boost and reply counts, the language, whether the row is a boost, the publish time, the hosting instance, and the author's name, handle and profile link. Journalists, open-source maintainers and researchers use it to follow what an account publishes on the fediverse: tracking institutions and projects that post on Mastodon, studying which posts get boosted, or building a dataset for language research.
Write the server into the value, as in Mastodonusername or instance, a bare name is looked up on mastodon.social and may reach a different person than you meant. reblog_count counts boosts of a post and comment_count counts replies, and a null like_count or comment_count means the number was not disclosed rather than zero.
Price $1.39 per 1,000 requests ($0.001389 per call). Failed calls and empty results are not charged. Synchronous. For slow jobs add "mode": "async" to the body, take the job_id and poll.
AI prompt
Paste this into your AI assistant. It already holds this endpoint's parameters, response fields and an example request, so the assistant can ask what you need and then write the scraper.
Please help me write a data collection script with the EveryInfra Mastodon Posts by user endpoint (mastodon/user_posts).
Endpoint contract:
- Request: POST https://api.everyinfra.com/api/v1/social with the header Authorization: Bearer <API key>. Read the key from the EVERYINFRA_API_KEY environment variable and never hard-code it.
- In the request body, set platform to mastodon and action to user_posts, and put the parameters inside params.
- Required parameters:
- username: Specifies the Mastodon account handle or full user@instance format, with an optional leading @ symbol.
- Optional parameters:
- instance: Selects a Mastodon instance domain without a scheme or path. Timeline defaults to fosstodon.org and other actions default to mastodon.social.
- limit: The most rows to return in this call, an integer from 1 to 100. The default applies when you leave it out, and a call can return fewer rows. Larger values return 422 before any charge. (default: 20)
- Returns a list of records. Main fields of each record: id, url, text, author_name, author_username, author_url, instance, like_count, reblog_count, comment_count, language, is_reblog; 15 fields in total, full list at https://api.everyinfra.com/api/v1/social/catalog?platform=mastodon.
- Example request body:
{
"platform": "mastodon",
"action": "user_posts",
"params": {
"username": "<USERNAME>@mastodon.social"
}
}
- Price: $1.39 per 1,000 requests; failed and empty results are not charged.
- For dozens or hundreds of targets, add "mode": "async" to the body: you get a job_id at once and poll GET https://api.everyinfra.com/api/v1/jobs/{job_id} for the result.
- On 422, fix the request using the suggested parameter names and allowed values in the error; on 429 or 503, wait for Retry-After and try again.
Before writing code, ask me which targets I need, how many, which fields, and what output format I want; then confirm the plan and the rough cost with me.Request parameters
| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
Authorization | header | string | Yes | - | Bearer followed by your API key. Create it in the console; never put it in a URL or a code repository. |
platform | body | string | Yes | mastodon | Platform identifier, fixed value. |
action | body | string | Yes | user_posts | Capability identifier, fixed value. |
username | body.params | Not declared | Yes | - | Specifies the Mastodon account handle or full user@instance format, with an optional leading @ symbol. Providing a short handle without specifying an instance defaults to mastodon.social, and identical usernames across different instances represent distinct accounts. |
instance | body.params | Not declared | No | - | Selects a Mastodon instance domain without a scheme or path. Timeline defaults to fosstodon.org and other actions default to mastodon.social. An explicit instance takes precedence over the domain in username, so keep the two values consistent. |
limit | body.params | integer (1–100) | No | 20 | The most rows to return in this call, an integer from 1 to 100. The default applies when you leave it out, and a call can return fewer rows. Larger values return 422 before any charge. |
Code samples
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
-H "Authorization: Bearer $EVERYINFRA_API_KEY" \
-H 'Content-Type: application/json' \
--data-raw '{
"platform": "mastodon",
"action": "user_posts",
"params": {
"username": "<USERNAME>@mastodon.social"
}
}'[OpenAPI definition (JSON)]Samples read the key from the EVERYINFRA_API_KEY environment variable; copied code never contains your key.
Response example
There is no real sample for these example parameters yet: this shows the response shape and fields from the contract, with … as placeholders. It is not the result of a real call.
{
"id": "req_…",
"platform": "mastodon",
"action": "user_posts",
"results": [
{
"id": …,
"url": …,
"text": …,
"author_name": …,
"author_username": …,
"author_url": …,
"instance": …,
"like_count": …,
"reblog_count": …,
"comment_count": …,
"language": …,
"is_reblog": …,
"posted_at": …,
"platform": …,
"media_urls": …,
"hashtags": …
}
],
"count": …,
"billing": {
"charged": …,
"charged_usd": …,
"balance_after_usd": …,
…
},
"quota": { … }
}Response fields
Business data is in results. The table lists the fields a record can contain; values the platform does not show are never made up.
| Field | Meaning |
|---|---|
id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
url | Link to the record on the platform. |
text | Body text with HTML removed, returned in full and never cut short (on a few platforms the list results themselves carry only an excerpt; the platform's field notes say so). |
author_name | Author's display name. |
author_username | Author's username (@handle), usually usable in URLs. |
author_url | Link to the author's profile on the platform. |
instance | Keeps the platform's own meaning |
like_count | Likes. null means the platform or this capability does not disclose it; it is not 0. |
reblog_count | Keeps the platform's own meaning |
comment_count | Comments. null means not disclosed, not 0. |
language | Content language code (for example zh, en) as judged by the platform; it can be wrong. |
is_reblog | Keeps the platform's own meaning |
posted_at | Publish time in ISO 8601, UTC (for example 2026-08-07T12:34:56+00:00). Non-standard strings from the platform are passed through as is, so parse defensively. null means the platform does not disclose it. |
platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |
media_urls | Keeps the platform's own meaning |
hashtags | Hashtags in the text, in order of appearance; absent when there are none. |
FAQ
What is a reblog?
A reblog, also called a boost, is Mastodon's repost: an account sharing someone else's post with its own followers. Rows where is_reblog is true are boosts rather than the account's own writing, so drop them when you analyze what it says; reblog_count on a post is how often others boosted it.
Can I filter posts by language?
Yes, after the call. language is a code such as en or de that the platform assigns to each post, and that judgment can be wrong. Spot-check a sample against text before you drop rows by language, or run your own detection when precision matters.
How do I get the account's profile details?
Use the Mastodon Details capability with the same username and instance. It returns the display name, the full handle in @user@instance form and the hosting server; the handle is unique across the fediverse, so it is a sound key for joining posts to accounts.
Errors and billing
- 401
- Missing or invalid key. Authentication runs before parameter checks, so unauthenticated requests never see the parameter schema.
- 422
- Wrong parameter name or value. The error lists the parameters and allowed values this capability accepts and the closest match; it happens before any charge.
- 402
- Insufficient balance. Top up first.
- 429
- The account's per-minute request limit was reached (all of its API keys count together; a key's own lower limit applies first). Wait for Retry-After and try again; a rate package in the console raises the limit.
- 503
- Could not complete right now. Any charge for the call goes back to your balance automatically, and the billing receipt in the response states the actual outcome, including when it is not yet known. Do not resend blindly.
- 200 empty
- The request completed without data and is not charged (billing.reason = empty_result_refunded).
Official references
Used only to check objects and terms. They do not imply authorization or endorsement of EveryInfra by the platform.
- Mastodon WebFinger: Account Handles Require Domain Resolution ↗
Official documentation explicitly states that @user@example.com and @user@example.org are distinct accounts, defined by both username and domain. This document clarifies account identification rules and does not imply that this gateway returns all official Account metadata.
Checked 2026-09-04