TweetSmash API
Use this skill to work directly with the TweetSmash REST API using current endpoint evidence. Reuse documentation already verified in this task; refresh it when missing, stale, or contradicted by the API. Read references/api-reference.md before choosing an endpoint. Read references/bookmarks-filters.md only when bookmark filtering is required.
Procedures
Step 1: Validate Credentials and Scope
- Confirm that a TweetSmash API key is available before making requests. Prefer
TWEETSMASH_API_KEY in the shell environment.
- Read
references/api-reference.md to confirm the current endpoint, required headers, rate limits, and status codes.
- If the task requires bookmark filtering or pagination, read
references/bookmarks-filters.md.
Step 2: Build the Request
- Use
Authorization: Bearer $TWEETSMASH_API_KEY on every request.
- Use
Content-Type: application/json for all examples in this skill. Keep the base URL as https://api.tweetsmash.com/v1.
- If the task fetches bookmarks with filters, execute
python3 <tweetsmash-api-dir>/scripts/build-bookmarks-url.py with the needed flags to generate a correctly encoded URL.
- If the task adds labels, start from
assets/add-labels-body.json and fill in tweet_ids plus either label_id or label_name.
- If the task removes labels, start from
assets/remove-labels-body.json and fill in tweet_ids plus label_name.
Step 3: Execute the Correct Endpoint
- Fetch bookmarks with
GET /bookmarks. Use the URL from scripts/build-bookmarks-url.py when filters, search, or cursors are present.
- List labels with
GET /labels when the task needs current label IDs, label names, or usage counts.
- Add labels with
POST /labels/add when the task needs to organize one or more bookmarked tweets.
- Remove labels with
POST /labels/remove when the task needs to clean up or reclassify bookmarked tweets.
- Use cURL for quick execution or translate the same request into the caller’s runtime only after the endpoint and payload are confirmed.
Step 4: Verify the Response
- Confirm that the response JSON contains
"status": true before reporting success.
- For bookmark reads, inspect
meta.next_cursor, meta.limit, and meta.total_count when pagination matters.
- For label mutations, confirm the success message matches the intended action.
- If the task depends on label existence and the mutation response does not establish it, call
GET /labels to verify the resulting state.
Step 5: Return a Usable Result
- Summarize the request method, endpoint, and effective filters or payload fields that were used.
- Return the response body or a structured summary, depending on the caller’s requested output format.
- If follow-up pagination is possible, expose
meta.next_cursor so the next request can continue from the prior page.
Error Handling
- If authentication fails with
401, confirm that the bearer token is present, non-empty, and taken from the correct TweetSmash account.
- If the API returns
402, stop and report that the current plan does not permit the requested API access.
- If the API returns
429, stop issuing requests and honor Retry-After or current rate-limit headers. The bundled reference records a historical limit; do not treat it as universal or retry in a tight loop.
- If a bookmark query becomes hard to assemble by hand, rerun
python3 <tweetsmash-api-dir>/scripts/build-bookmarks-url.py --help and rebuild the URL instead of manually concatenating query strings.
- If a label mutation is ambiguous, list labels first with
GET /labels and then rerun the mutation using the confirmed label identifier or label name.
1---2name: tweetsmash-api3description: Integrate TweetSmash REST bookmark retrieval, filtering, pagination, and label management into scripts or tools. Excludes browser automation, other Twitter/X APIs, and marketing copy.4---5# TweetSmash API67Use this skill to work directly with the TweetSmash REST API using current endpoint evidence. Reuse documentation already verified in this task; refresh it when missing, stale, or contradicted by the API. Read `references/api-reference.md` before choosing an endpoint. Read `references/bookmarks-filters.md` only when bookmark filtering is required.89## Procedures1011**Step 1: Validate Credentials and Scope**121. Confirm that a TweetSmash API key is available before making requests. Prefer `TWEETSMASH_API_KEY` in the shell environment.132. Read `references/api-reference.md` to confirm the current endpoint, required headers, rate limits, and status codes.143. If the task requires bookmark filtering or pagination, read `references/bookmarks-filters.md`.1516**Step 2: Build the Request**171. Use `Authorization: Bearer $TWEETSMASH_API_KEY` on every request.182. Use `Content-Type: application/json` for all examples in this skill. Keep the base URL as `https://api.tweetsmash.com/v1`.193. If the task fetches bookmarks with filters, execute `python3 <tweetsmash-api-dir>/scripts/build-bookmarks-url.py` with the needed flags to generate a correctly encoded URL.204. If the task adds labels, start from `assets/add-labels-body.json` and fill in `tweet_ids` plus either `label_id` or `label_name`.215. If the task removes labels, start from `assets/remove-labels-body.json` and fill in `tweet_ids` plus `label_name`.2223**Step 3: Execute the Correct Endpoint**241. Fetch bookmarks with `GET /bookmarks`. Use the URL from `scripts/build-bookmarks-url.py` when filters, search, or cursors are present.252. List labels with `GET /labels` when the task needs current label IDs, label names, or usage counts.263. Add labels with `POST /labels/add` when the task needs to organize one or more bookmarked tweets.274. Remove labels with `POST /labels/remove` when the task needs to clean up or reclassify bookmarked tweets.285. Use cURL for quick execution or translate the same request into the caller’s runtime only after the endpoint and payload are confirmed.2930**Step 4: Verify the Response**311. Confirm that the response JSON contains `"status": true` before reporting success.322. For bookmark reads, inspect `meta.next_cursor`, `meta.limit`, and `meta.total_count` when pagination matters.333. For label mutations, confirm the success message matches the intended action.344. If the task depends on label existence and the mutation response does not establish it, call `GET /labels` to verify the resulting state.3536**Step 5: Return a Usable Result**371. Summarize the request method, endpoint, and effective filters or payload fields that were used.382. Return the response body or a structured summary, depending on the caller’s requested output format.393. If follow-up pagination is possible, expose `meta.next_cursor` so the next request can continue from the prior page.4041## Error Handling4243* If authentication fails with `401`, confirm that the bearer token is present, non-empty, and taken from the correct TweetSmash account.44* If the API returns `402`, stop and report that the current plan does not permit the requested API access.45* If the API returns `429`, stop issuing requests and honor `Retry-After` or current rate-limit headers. The bundled reference records a historical limit; do not treat it as universal or retry in a tight loop.46* If a bookmark query becomes hard to assemble by hand, rerun `python3 <tweetsmash-api-dir>/scripts/build-bookmarks-url.py --help` and rebuild the URL instead of manually concatenating query strings.47* If a label mutation is ambiguous, list labels first with `GET /labels` and then rerun the mutation using the confirmed label identifier or label name.