> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# How do I distinguish a peer's own X posts, quotes, replies and reposts?

> Define the research scope, verify authorship and repost evidence, and retain exclusions and unknown rows instead of mistaking interaction counts for post types.

To find posts written by an X account, fetch the account's timeline with `twitter.web.fetch_user_post_tweet` and keep the records whose author ID matches the target account and that have no `retweeted_tweet` object. Keep replies and quote posts written by the target account when relevant, and label each row's type during review.

## Decide how each content role serves the research

| Situation                                | Research value                                        | Treatment                                                                                   |
| ---------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| The target's own product post            | The target's wording, features or activities          | Preserve text and source, then review business relevance.                                   |
| The target adds its own quote commentary | The target's expression alongside someone else's work | The filter can retain the quote post; separate the target's words from the quoted original. |
| The target replies to someone            | Qualifications or communication style                 | Retain the reply role, not a standalone announcement; inspect parent context if necessary.  |
| The target reposts another author's work | Redistribution behavior, not authorship               | Exclude from this subset while retaining raw observations.                                  |
| Author is absent or does not match       | Attribution remains unsupported                       | Exclude from the confirmed subset without guessing.                                         |

Being reposted many times is different from being a repost. Likes, repost counts and quote counts are engagement measures; a value above zero does not establish content type.

## When is strict filtering useful?

Use `own_posts.py` when you already have an independently verified account ID and need to keep other authors out of a conclusion. With only a handle and no trusted ID, use the [account-observation workflow](/guides/x-account-updates), which retains sources and unknowns without claiming strict attribution. Verify the account again after an identity change.

`own_posts.py` does not resolve unknown accounts and does not establish authorship beyond the supplied evidence. If a saved response unexpectedly omits a repost marker, the script cannot authenticate the row's type independently. The exact claim of `own_posts.py` is “matching author and no repost object in the saved response”.

## How should a teammate understand inclusions and exclusions?

Hand over `selected-posts.csv`/JSON together with `observations.json`, which holds the exclusions and unknowns. State the account, the pages, the observation times, the retained roles and the unresolved conditions. A clean-looking table does not show every original post the account ever published.

“Last two weeks” or “top three by engagement” needs a separate date and metric policy; `own_posts.py` applies no date or engagement ranking. For a study of product announcements only, review unrelated replies and other content manually and record each reason. Author matching is not a business-relevance review.

The sections below cover the account identity, the input manifest and the raw-page filter. Reuse saved pages first: local filtering makes no calls, fetches no other page and publishes nothing.

## Use our account route, not another service's tabs

Inspect `data:twitter.web.fetch_user_post_tweet`. The current action accepts `screen_name` or integer `rest_id`, plus an optional `cursor`. If both identities are sent, `rest_id` wins. `twitter.web.fetch_user_post_tweet` has **no tab parameter**; do not send tab=posts/replies/media. `data.timeline` holds the page, `data.next_cursor` continues the timeline, and `data.pinned` is separate.

The documented `retweeted_tweet` holds the original post of a repost. `retweets` is the number of reposts a post received, so a popular self-authored post with `retweets` > 0 is not automatically a repost. `quotes` is also an engagement count, not a flag that marks the row as a quote post. A quote post authored by the selected account stays in the selected set when the quote post has no `retweeted_tweet` object; `own_posts.py` does not infer quote status from the count. `reply_to` is the handle being replied to, not the parent post ID. Replies by the matching author stay included and visibly labeled; the selected set is not a dedicated Replies tab.

## Which account identity can the strict helper use?

`own_posts.py` supports two identity routes:

* **ID route:** when the verified account ID is within `9007199254740991`, request the account as integer `rest_id`.
* **Handle route:** when the ID is beyond that safe numeric range, request **screen_name only** and keep the independently verified author ID as a string in the local manifest. Never send the large ID as an integer, and never place both identities in params.

The handle route avoids a numeric request parameter. The handle route does not repair old rounded requests and does not resolve an unknown handle automatically.

For the handle route, record `verified_author_rest_id` and `identity_evidence` outside params. `identity_evidence` should identify a previously checked account record and the record's verification time, not merely “the first row in this response.” A nonempty evidence description is a provenance requirement, not automatic authentication. Keep the evidence private if the evidence contains internal account records. Every page must use the same handle, the exact expected ID and the same evidence record. After a handle rename or reassignment, start a new verified run; do not merge the pages.

If you only have a handle and no verified ID, use the [account observation guide](/guides/x-account-updates) without strict attribution. In the inspected timelines, author names and handles were null, so neither the query handle nor a guessed `data.user` field establishes each row's author. `own_posts.py` does not resolve unknown handles.

## Save pages, then filter locally

Reuse any responses you already saved. Three new pages take three list requests; see [BeatAPI pricing](https://beatapi.io/pricing) and record the items each page actually returned.

Create `own-post-pages.json` next to the saved raw responses. Replace every placeholder, including the illustrative account ID, with the actual request metadata. Do not reconstruct the request identity from the response afterwards.

```json
[{"action":"twitter.web.fetch_user_post_tweet","params":{"rest_id":12345},"http_status":200,"collected_at":"2026-11-16T10:00:00Z","response_file":"page-1.json"}]
```

For a **previously verified** handle/ID pair, use the manifest entry shape below. Both values are illustrative, not a verified live account; replace both values before sending a request.

```json
[{"action":"twitter.web.fetch_user_post_tweet","params":{"screen_name":"example_handle"},"verified_author_rest_id":"1234567890123456789","identity_evidence":"<verified account record and verification time>","http_status":200,"collected_at":"2026-11-16T10:00:00Z","response_file":"page-1.json"}]
```

To add a saved second page, append an entry with the same account identity, a `cursor` exactly equal to the previous response's `data.next_cursor`, the page's own request ID and the actual collection time. `own_posts.py` accepts 1–20 pages and validates a single continuous chain from the first page. The script does not fetch missing pages, repair repeated cursors or merge different accounts.

Save the script as `own_posts.py` and run `python3 own_posts.py own-post-pages.json own-post-review`:

```python
import csv,hashlib,json,pathlib,re,sys
from datetime import datetime
manifest,target=map(pathlib.Path,sys.argv[1:]);manifest_bytes=manifest.read_bytes();entries=json.loads(manifest_bytes)
if not isinstance(entries,list) or not 1<=len(entries)<=20:raise ValueError('Provide 1..20 saved direct pages')
ACTION='twitter.web.fetch_user_post_tweet';expected_cursor=None;expected_id=None;last_time=None;request_ids=set();used_cursors=set();seen={};rows=[];observations=[];sources=[];raw_files=[]
def ident(v):return isinstance(v,str) and v.isascii() and v.isdigit() and int(v)>0
def cell(v):
    text='' if v is None else str(v)
    return "'"+text if text.startswith(('=','+','-','@','\t','\r','\n')) else text
for page,e in enumerate(entries,1):
    params=e['params']
    if not isinstance(params,dict):raise ValueError('Request params must be an object')
    if e.get('action')!=ACTION or type(e.get('http_status')) is not int or e['http_status']!=200:raise ValueError('Require successful direct account pages')
    if 'screen_name' in params:
        handle=params['screen_name'];account=e.get('verified_author_rest_id');evidence=e.get('identity_evidence')
        if set(params)-{'screen_name','cursor'} or not isinstance(handle,str) or not re.fullmatch(r'[A-Za-z0-9_]{1,15}',handle):raise ValueError('Use a bare handle only, not a URL or mixed identity')
        if not ident(account) or not isinstance(evidence,str) or not evidence.strip():raise ValueError('Provide the previously verified string author ID and its identity evidence')
        identity=('screen_name',handle.lower(),account,evidence)
    else:
        account=params.get('rest_id')
        if set(params)-{'rest_id','cursor'} or type(account) is not int or not 0<account<=9007199254740991:raise ValueError('Use a verified safe-range integer rest_id')
        account=str(account);identity=('rest_id',account)
    if expected_id is None:expected_id=account;expected_identity=identity
    if identity!=expected_identity:raise ValueError('Mixed account identity or changed verification evidence')
    cursor=params.get('cursor')
    if page==1:
        if cursor not in (None,''):raise ValueError('Start this bounded run at the first page')
    elif not expected_cursor or cursor!=expected_cursor:raise ValueError('Continue with the exact preceding cursor')
    if cursor:
        if cursor in used_cursors:raise ValueError('Repeated cursor')
        used_cursors.add(cursor)
    stamp=datetime.fromisoformat(e['collected_at'].replace('Z','+00:00'))
    if stamp.utcoffset() is None or last_time is not None and stamp<last_time:raise ValueError('Use chronological timezone-aware observations')
    last_time=stamp;path=manifest.parent/e['response_file'];raw=path.read_bytes();response=json.loads(raw)
    if response.get('action')!=ACTION or response.get('status')!='succeeded' or response.get('error') is not None:raise ValueError('Unsuccessful or wrong-action response')
    rid=response.get('request_id')
    if not isinstance(rid,str) or not rid.strip() or rid in request_ids:raise ValueError('Missing or repeated request ID')
    request_ids.add(rid);data=response.get('data')
    if not isinstance(data,dict) or not isinstance(data.get('timeline'),list):raise ValueError('Expected complete direct data.timeline')
    next_cursor=data.get('next_cursor')
    if next_cursor is not None and not isinstance(next_cursor,str):raise ValueError('Invalid next cursor')
    if next_cursor and (next_cursor==cursor or next_cursor in used_cursors):raise ValueError('Cursor loop')
    expected_cursor=next_cursor;archive=f'raw-{page:03}.json';digest=hashlib.sha256(raw).hexdigest();raw_files.append((archive,raw))
    sources.append({'file':archive,'sha256':digest,'page':page,'request_id':rid,'params':params,'collected_at':e['collected_at'],'next_cursor':next_cursor,'pinned_present':data.get('pinned') is not None})
    for index,post in enumerate(data['timeline']):
        if not isinstance(post,dict) or not ident(post.get('tweet_id')):raise ValueError('Original string tweet_id required')
        author=post.get('author')
        if author is not None and not isinstance(author,dict):raise ValueError('Invalid author')
        aid=(author or {}).get('rest_id')
        if aid is not None and not ident(aid):raise ValueError('Original string author ID required')
        original=post.get('retweeted_tweet')
        if original is not None and not isinstance(original,dict):raise ValueError('Unexpected retweeted_tweet type')
        for field in ['text','created_at','reply_to']:
            if post.get(field) is not None and not isinstance(post[field],str):raise ValueError('Unexpected post text/date/reply field')
        classification='repost_object_present' if original is not None else ('author_missing' if aid is None else ('other_author' if aid!=expected_id else 'matching_author_no_repost_object'))
        signature=[aid,classification,post.get('text'),post.get('created_at'),post.get('reply_to')]
        duplicate=post['tweet_id'] in seen
        if duplicate and seen[post['tweet_id']]!=signature:raise ValueError('Conflicting identity/content for repeated post ID')
        seen[post['tweet_id']]=signature
        row={'tweet_id':post['tweet_id'],'author_rest_id':aid,'target_rest_id':expected_id,'classification':classification,'duplicate_id':duplicate,'page':page,'index':index,'text':post.get('text'),'created_at':post.get('created_at'),'reply_to':post.get('reply_to'),'reply_indicator_present':bool(post.get('reply_to')),'source_file':archive,'source_sha256':digest,'request_id':rid,'collected_at':e['collected_at']}
        observations.append(row)
        if classification=='matching_author_no_repost_object' and not duplicate:rows.append(row)
target.mkdir()
(target/'input-manifest.json').write_bytes(manifest_bytes)
for name,raw in raw_files:(target/name).write_bytes(raw)
for name,value in [('selected-posts.json',rows),('observations.json',observations),('coverage.json',{'target_rest_id':expected_id,'selected_unique_posts':len(rows),'observations':len(observations),'sources':sources,'manifest_sha256':hashlib.sha256(manifest_bytes).hexdigest(),'next_cursor':expected_cursor,'history_complete':False,'pinned_included':False,'source_identity_independently_authenticated':False,'network_calls':0})]:
    (target/name).write_text(json.dumps(value,ensure_ascii=False,indent=2),encoding='utf-8')
fields=['tweet_id','author_rest_id','text','created_at','reply_to','reply_indicator_present','source_file','request_id','collected_at']
with (target/'selected-posts.csv').open('w',encoding='utf-8-sig',newline='') as f:
    writer=csv.writer(f);writer.writerow(fields)
    for row in rows:writer.writerow([cell(row[k]) for k in fields])
print(json.dumps({'selected_unique_posts':len(rows),'observations':len(observations),'network_calls':0}))
```

## What will I receive?

* `selected-posts.csv` and JSON: unique rows whose original author ID matches the requested account and that do not carry a repost object. Text, raw publication date, reply indicator, source and collection time remain visible. Spreadsheet formula-like text is escaped in CSV; JSON keeps it exact.
* `observations.json`: every observed row, including duplicates, reposts, other authors and missing-author rows. An absent author is not silently treated as the requested account. An empty `retweeted_tweet` object still counts as a present repost object and is excluded conservatively.
* `raw-NNN.json`, input manifest and `coverage.json`: byte-preserving raw sources, hashes, page metadata, actual next cursor and the scope. Matching duplicates keep one selected row but all observations; conflicting identity/text/date/reply metadata for the same ID stops the run. Metrics changing between pages are not used to change identity.
* Pinned data stays in the raw response and is recorded as present, but is **not** appended to the selected timeline. Do not double-count a pinned post or mix an unvalidated object shape into the export.

For example, an offline fixture page built from the output contract holds one matching-author original, one matching-author quote, one matching-author reply, one repost, one other-author row and one row with a missing author. `own_posts.py` selects the first three rows.

`own_posts.py` applies no date window and no top-three engagement ranking. `created_at` keeps the original format, and `history_complete` stays false even when the last saved cursor is empty. For “last two weeks” or “best three,” define a separate time and metric policy and collect enough pages within budget; do not relabel a one-page sample as exhaustive.

Before handover, check that no selected row has a mismatched or missing author or a present repost object, that every selected ID traces to a raw page, that no existing output was overwritten, and that the run created no API call, schedule or message.

[X questions](/faq/x)