Skip to content

docs(social): optional posts depth param on both social scrape endpoints#258

Merged
sweetmantech merged 5 commits into
mainfrom
feat/social-scrape-posts-param
Jul 2, 2026
Merged

docs(social): optional posts depth param on both social scrape endpoints#258
sweetmantech merged 5 commits into
mainfrom
feat/social-scrape-posts-param

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Contract PR for recoupable/chat#1836 — merge before the api implementation PR (docs → api).

  • POST /api/socials/{id}/scrape: new optional posts query param (integer, 1–100, default 1).
  • POST /api/artist/socials/scrape: new optional posts body field (same shape) on ArtistSocialsScrapeRequest.
  • Scraper Results (GET /api/apify/runs/{runId}): data example now shows an X tweet item (with likeCount/retweetCount/replyCount/quoteCount/bookmarkCount/viewCount) and a YouTube video item (viewCount/likes/commentsCount) alongside the Instagram profile item, and the description explains the per-platform item shapes.

Semantics documented: posts applies to X/Twitter and YouTube; other platforms ignore it; omitted → legacy single-item profile snapshot (existing behavior unchanged).

Verification

  • Both OpenAPI files re-parse (json.load) after the edit; diff is additive (59 insertions / 4 deletions across the two files).
  • Field semantics match the planned api implementation exactly (Twitter maxItems, YouTube maxResults/maxResultsShorts).

🤖 Generated with Claude Code


Summary by cubic

Adds an optional posts depth to both social scrape endpoints to include recent posts with engagement metrics. X/Twitter returns the latest N timeline items (incl. retweets/replies) and YouTube returns up to N videos + N Shorts; omit to get the legacy single-item profile snapshot; other platforms ignore it.

  • New Features

    • POST /api/socials/{id}/scrape: posts query param (integer 1–100).
    • POST /api/artist/socials/scrape: posts body field on ArtistSocialsScrapeRequest (same shape).
  • Refactors

    • Removed schema default for posts (use example: 10) and tightened endpoint copy; responses now point to the Scraper Results API and the artist scrape notes a runId per social profile.
    • Expanded examples to include Instagram latestPosts plus X and YouTube items; moved api-reference/artist/socials-scrape into the Social group.

Written for commit be26ce7. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added an optional posts setting to social scraping APIs (min: 1, max: 100) to return recent post/video data with engagement metrics on supported platforms.
  • Documentation
    • Updated artist socials scrape documentation to clarify scrape-job triggering and per-social runId results behavior.
    • Expanded per-platform posts behavior (X/Twitter, YouTube, Instagram) and documented legacy snapshot behavior when posts is omitted.
    • Refreshed scrape completion response examples and guidance for scraper-type-specific dataset shapes.
    • Moved the artist socials scrape API reference entry in the docs navigation.

Documents the new `posts` parameter (integer, 1-100, default 1) on
POST /api/socials/{id}/scrape (query) and POST /api/artist/socials/scrape
(body field), which controls how many recent posts the Apify run dataset
returns with per-post engagement metrics (X/Twitter tweets incl. viewCount;
YouTube videos and Shorts). Also expands the Scraper Results example with
X and YouTube dataset items alongside the Instagram profile item.

Contract for recoupable/chat#1836; the api implementation follows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Jul 2, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
recoup-docs 🟢 Ready View Preview Jul 2, 2026, 12:38 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates the OpenAPI docs for artist and social scrape endpoints to add an optional posts setting, clarify response data shape, and move the artist scrape docs entry into the Social Media navigation group.

Changes

Social scrape posts documentation

Layer / File(s) Summary
Artist scrape posts option
api-reference/openapi/releases.json, docs.json
Updates the artist scrape endpoint description and request schema with an optional posts field and removes that page from the Artists navigation group.
Social scrape posts parameter and response docs
api-reference/openapi/social.json, docs.json
Updates the social scrape endpoint description and query parameter, revises the completed response data description and example payload, and adds that page to the Social navigation group.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main docs change: adding an optional posts parameter to both social scrape endpoints.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/social-scrape-posts-param

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
api-reference/openapi/releases.json (1)

2109-2116: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider adding an example for the new posts property.

Sibling properties in this schema (e.g., artist_account_id) and elsewhere in the spec (e.g., CreateTaskRequest fields) include an example value. Adding one here (e.g., "example": 10) keeps the new field consistent with the rest of the schema and helps consumers/doc renderers show a sample value.

✏️ Suggested addition
           "posts": {
             "type": "integer",
             "minimum": 1,
             "maximum": 100,
             "default": 1,
+            "example": 10,
             "description": "Maximum number of recent posts to include in each scrape dataset, with per-post engagement metrics. Applies to X/Twitter (tweets with like, retweet, reply, quote, bookmark, and view counts) and YouTube (videos and Shorts with view, like, and comment counts). Other platforms ignore this field. When omitted, each scrape returns the legacy profile snapshot (a single latest item)."
           }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/openapi/releases.json` around lines 2109 - 2116, The new posts
property in the releases schema is missing an example, unlike nearby fields such
as artist_account_id and other request schemas. Update the posts entry in the
OpenAPI JSON to include a representative example value consistent with its
integer range, so schema consumers and docs renderers show a sample for this
field.
api-reference/openapi/social.json (1)

1036-1082: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider clarifying that item types don't co-occur in a single run.

The example array now shows an Instagram profile item, a tweet item, and a YouTube video item together. Since each /api/socials/{id}/scrape run targets a single social profile (one platform), a real response would only ever contain items of one type. The data description at Line 1035 already states structure "varies depending on the scraper type," which largely mitigates this, but an explicit note (e.g., "a single run returns items of only one of these shapes, shown together here for illustration") would remove any ambiguity for API consumers building parsers against this contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/openapi/social.json` around lines 1036 - 1082, Clarify the
mixed example in the social API schema: the example array in the `social.json`
response shows Instagram, tweet, and YouTube item shapes together, but a single
`/api/socials/{id}/scrape` run only returns one scraper type. Update the example
or its surrounding description so it explicitly states that `data` items are
mutually exclusive per run and the different shapes are shown only for
illustration, using the existing `data`/`example` schema section as the place to
adjust.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@api-reference/openapi/releases.json`:
- Around line 2109-2116: The new posts property in the releases schema is
missing an example, unlike nearby fields such as artist_account_id and other
request schemas. Update the posts entry in the OpenAPI JSON to include a
representative example value consistent with its integer range, so schema
consumers and docs renderers show a sample for this field.

In `@api-reference/openapi/social.json`:
- Around line 1036-1082: Clarify the mixed example in the social API schema: the
example array in the `social.json` response shows Instagram, tweet, and YouTube
item shapes together, but a single `/api/socials/{id}/scrape` run only returns
one scraper type. Update the example or its surrounding description so it
explicitly states that `data` items are mutually exclusive per run and the
different shapes are shown only for illustration, using the existing
`data`/`example` schema section as the place to adjust.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 55c7f842-c4f8-4317-9235-5f547682ace4

📥 Commits

Reviewing files that changed from the base of the PR and between 767caa0 and b720585.

📒 Files selected for processing (2)
  • api-reference/openapi/releases.json
  • api-reference/openapi/social.json

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

Verified against the api#741 preview: on YouTube the depth applies per
content type (up to N videos + N Shorts per dataset); on X/Twitter it
returns the account's latest N timeline items including retweets and
replies. Documented both so callers size posts accordingly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sweetmantech

Copy link
Copy Markdown
Collaborator Author

Reconciled against live preview verification of recoupable/api#741 (second commit): YouTube posts depth applies per content type (up to N videos + N Shorts per dataset), and X/Twitter returns the account's latest N timeline items including retweets and replies. Both descriptions updated in social.json + releases.json; files re-parse. Live dataset evidence in the api#741 verification comment.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread api-reference/openapi/social.json
Comment thread api-reference/openapi/releases.json Outdated
"/api/artist/socials/scrape": {
"post": {
"description": "Trigger scrape jobs for all social profiles linked to an artist. Provide an artist_account_id, and the API will look up the artist's socials and invoke a scraping job for each social profile. Each scrape returns Apify run metadata so you can poll for status and retrieve results.",
"description": "Trigger scrape jobs for all social profiles linked to an artist. Provide an artist_account_id, and the API will look up the artist's socials and invoke a scraping job for each social profile. Each scrape returns Apify run metadata so you can poll for status and retrieve results. Pass `posts` to include recent posts with engagement metrics in each run's dataset (X/Twitter and YouTube; Instagram profile scrapes always include `latestPosts`).",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KISS - keep the descriptions simple.

Suggested change
"description": "Trigger scrape jobs for all social profiles linked to an artist. Provide an artist_account_id, and the API will look up the artist's socials and invoke a scraping job for each social profile. Each scrape returns Apify run metadata so you can poll for status and retrieve results. Pass `posts` to include recent posts with engagement metrics in each run's dataset (X/Twitter and YouTube; Instagram profile scrapes always include `latestPosts`).",
"description": "Trigger scrape jobs for all social profiles linked to an artist. Returns a runId you can poll for status and retrieve results at [endpoint with hyperlink].",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 68fe330 — simplified to: 'Trigger scrape jobs for all social profiles linked to an artist. Returns a runId per social profile that you can poll for status and results via the Apify Scraper Results API.' (kept 'per social profile' since the response is an array, one run per platform).

Comment thread api-reference/openapi/social.json Outdated
"/api/socials/{id}/scrape": {
"post": {
"description": "Trigger a social profile scraping job for a given social profile. Use the [Get Artist Socials](/api-reference/artists/socials) endpoint first to retrieve the social profile id values. The response returns Apify run metadata for polling status and retrieving results via the [Apify Scraper Results API](/api-reference/apify/scraper).",
"description": "Trigger a social profile scraping job for a given social profile. Use the [Get Artist Socials](/api-reference/artists/socials) endpoint first to retrieve the social profile id values. The response returns Apify run metadata for polling status and retrieving results via the [Apify Scraper Results API](/api-reference/apify/scraper). Pass `posts` to include recent posts with engagement metrics in the run's dataset (X/Twitter and YouTube; Instagram profile scrapes always include `latestPosts`).",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KISS

Suggested change
"description": "Trigger a social profile scraping job for a given social profile. Use the [Get Artist Socials](/api-reference/artists/socials) endpoint first to retrieve the social profile id values. The response returns Apify run metadata for polling status and retrieving results via the [Apify Scraper Results API](/api-reference/apify/scraper). Pass `posts` to include recent posts with engagement metrics in the run's dataset (X/Twitter and YouTube; Instagram profile scrapes always include `latestPosts`).",
"description": "Trigger a social profile scraping job for a given social profile. Use the [Get Artist Socials](/api-reference/artists/socials) endpoint first to retrieve the social profile id values. The response returns run metadata for polling status and retrieving results via the [Apify Scraper Results API](/api-reference/apify/scraper).",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 68fe330 — reverted to the terse original ('returns run metadata … via the Apify Scraper Results API'); the posts sentence now lives only on the param description.

Comment thread api-reference/openapi/social.json Outdated
"additionalProperties": true
},
"description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type (Instagram Profile, Instagram Comments, etc.)",
"description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type. Instagram profile scrapes return a profile item with a `latestPosts` array; X/Twitter scrapes return one tweet item per post (with engagement metrics including `viewCount`); YouTube scrapes return one video item per post. Use the `posts` parameter on the scrape endpoints to control how many post items are returned.",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KISS

Suggested change
"description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type. Instagram profile scrapes return a profile item with a `latestPosts` array; X/Twitter scrapes return one tweet item per post (with engagement metrics including `viewCount`); YouTube scrapes return one video item per post. Use the `posts` parameter on the scrape endpoints to control how many post items are returned.",
"description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type.",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 68fe330 — reverted to the simple two-sentence description; the example array still shows the three item shapes.

…ault, move nav

- Endpoint + data descriptions reverted to terse originals per review; the
  posts param description remains the single place carrying platform detail
- Removed "default": 1 from both posts schemas (cubic P1): the backend
  distinguishes omitted (legacy snapshot, YouTube Shorts excluded) from
  posts=1 (Shorts included), so a schema default would mislead SDK
  generators; added example: 10 instead
- Moved api-reference/artist/socials-scrape into the Social Media tab's
  Social group next to social/scrape

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="api-reference/openapi/social.json">

<violation number="1" location="api-reference/openapi/social.json:1035">
P2: The `ApifyScraperCompletedResponse.data` description was generalized from explicit per-platform shape guidance to a generic sentence, even though the schema remains polymorphic (`items: { type: object, additionalProperties: true }`). While the examples array now includes all three platform types, the normative description is the primary contract consumers rely on for parsing expectations. Consider restoring the per-platform shape semantics in the description alongside the expanded examples.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

"additionalProperties": true
},
"description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type (Instagram Profile, Instagram Comments, etc.)",
"description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type.",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The ApifyScraperCompletedResponse.data description was generalized from explicit per-platform shape guidance to a generic sentence, even though the schema remains polymorphic (items: { type: object, additionalProperties: true }). While the examples array now includes all three platform types, the normative description is the primary contract consumers rely on for parsing expectations. Consider restoring the per-platform shape semantics in the description alongside the expanded examples.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At api-reference/openapi/social.json, line 1035:

<comment>The `ApifyScraperCompletedResponse.data` description was generalized from explicit per-platform shape guidance to a generic sentence, even though the schema remains polymorphic (`items: { type: object, additionalProperties: true }`). While the examples array now includes all three platform types, the normative description is the primary contract consumers rely on for parsing expectations. Consider restoring the per-platform shape semantics in the description alongside the expanded examples.</comment>

<file context>
@@ -1032,7 +1032,7 @@
               "additionalProperties": true
             },
-            "description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type. Instagram profile scrapes return a profile item with a `latestPosts` array; X/Twitter scrapes return one tweet item per post (with engagement metrics including `viewCount`); YouTube scrapes return one video item per post. Use the `posts` parameter on the scrape endpoints to control how many post items are returned.",
+            "description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type.",
             "example": [
               {
</file context>
Suggested change
"description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type.",
"description": "Array of dataset items returned by the scraper. The structure of each item varies depending on the scraper type. Instagram profile scrapes return a profile item with a `latestPosts` array. X/Twitter scrapes return one tweet item per post with engagement metrics including `likeCount`, `retweetCount`, `replyCount`, `quoteCount`, `bookmarkCount`, and `viewCount`. YouTube scrapes return one video item per post with `viewCount`, `likes`, and `commentsCount`. Use the `posts` parameter on the scrape endpoints to control how many post items are returned."

Comment thread api-reference/openapi/releases.json Outdated
Comment thread api-reference/openapi/social.json Outdated
@sweetmantech sweetmantech merged commit 615cf5d into main Jul 2, 2026
2 of 3 checks passed
sweetmantech added a commit to recoupable/api that referenced this pull request Jul 2, 2026
Adds an optional `posts` parameter (integer, 1-100, default: legacy
single-item snapshot) to POST /api/socials/{id}/scrape (query param) and
POST /api/artist/socials/scrape (body field), threaded through
scrapeProfileUrl/scrapeProfileUrlBatch into the platform actor inputs:

- Twitter (apidojo/twitter-scraper-lite): maxItems = posts ?? 1 — returns
  the last N tweets with engagement metrics incl. viewCount (impressions)
- YouTube (streamers/youtube-scraper): maxResults = posts ?? 1 and
  maxResultsShorts = posts ?? 0 — a requested depth includes Shorts,
  which the legacy snapshot explicitly excluded
- Other platforms accept and ignore the param (Instagram profile scrapes
  already bundle latestPosts)

Omitting posts produces the exact same actor inputs as before, so existing
profile-snapshot callers and their Apify cost profile are unchanged.

Implements recoupable/chat#1836; contract documented in recoupable/docs#258.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant