diff --git a/SOURCE-PROVENANCE.json b/SOURCE-PROVENANCE.json index 6d7ee41a..2d2cb4e5 100644 --- a/SOURCE-PROVENANCE.json +++ b/SOURCE-PROVENANCE.json @@ -1,6 +1,6 @@ { "repository": "recoupable/marketing", - "commit": "c52d2a5bf5670109da6350f01aede45957c1b978", + "commit": "a6fd468f8bd2c2de8472c0ee6c13cf4bd550e5a0", "sourceDirectory": "content/docs/source", "files": [ { @@ -536,7 +536,7 @@ { "path": "api-reference/openapi/social.json", "sourcePath": "content/docs/source/api-reference/openapi/social.json", - "sha256": "49c837327886827b5bc33ae4daac76f12473ecf4a6f75cc073656e9247ba73ca" + "sha256": "dfda1239843c4e110d24e4ca05c45a9e7124513415f53ea241a8a8c008cf6bd7" }, { "path": "api-reference/openapi/templates.json", @@ -688,6 +688,11 @@ "sourcePath": "content/docs/source/api-reference/publishing/list.mdx", "sha256": "3857ddd70fe560668d6adeffedfb8ec90af507aa82485ad196c9307430e50d5c" }, + { + "path": "api-reference/publishing/stats.mdx", + "sourcePath": "content/docs/source/api-reference/publishing/stats.mdx", + "sha256": "89b68eaa4ec17166fe99bb15afc2dbd6d40523f99817f5481b5120e358ceb596" + }, { "path": "api-reference/pulses/list.mdx", "sourcePath": "content/docs/source/api-reference/pulses/list.mdx", @@ -1166,7 +1171,7 @@ { "path": "llms-full.txt", "sourcePath": "content/docs/source/llms-full.txt", - "sha256": "590a6dd9a2e10b44a981f322a1047fd336906a3de0e2680ec0f35ce10b6baeb1" + "sha256": "3b75c4ddb284674d74ad14ed9d77f9617aea355643e4c1090cc1baec683578c0" }, { "path": "llms.txt", @@ -1229,7 +1234,7 @@ "sha256": "df08b22bdc866daaf6adfbdfaafac47859f1281449841990d0e2af499a1e2d7d" } ], - "navigationSha256": "f6aa36d99ea011ba47a7ea23874c76c1037c349cbe2bb70f5a505f9cebfc4621", + "navigationSha256": "06d8646887b528e6cb886f22eac6cf86906539d56b462980b654f55aa77821ef", "hostSpecific": [ "docs.json theme, colors, navbar, footer, logo and host settings" ], diff --git a/api-reference/openapi/social.json b/api-reference/openapi/social.json index 40090002..8f86e4b4 100644 --- a/api-reference/openapi/social.json +++ b/api-reference/openapi/social.json @@ -1749,6 +1749,136 @@ } } } + }, + "/api/posts/{id}/stats": { + "get": { + "operationId": "getPostsByIdStats", + "summary": "Get post stats", + "x-recoup-availability": "pending", + "description": "Pending API release. The platform's own analytics for one post published with [Create Post](/api-reference/publishing/create), read live through the same connection that published it. Currently LinkedIn company-page posts only; other platforms and LinkedIn personal (member) posts return 422. Each call is a fresh read and `as_of` records when it happened. Each successful read costs $0.001 (1,000 credits), charged to the caller after LinkedIn returns the numbers. Credits are checked first; a request that fails (4xx/5xx) is not charged.", + "security": [ + { + "apiKeyAuth": [] + }, + { + "bearerAuth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + }, + "description": "The post's id, from [Create Post](/api-reference/publishing/create)." + } + ], + "responses": { + "200": { + "description": "The post's current stats.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostStatsResponse" + } + } + } + }, + "400": { + "description": "`id` is not a valid uuid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "402": { + "description": "Insufficient credits: the account has less than the $0.001 a read costs. Returned after the 400/401/403/404/409/422 checks and before LinkedIn is called, so nothing is read and nothing is charged.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SocialInsufficientCreditsResponse" + } + } + } + }, + "403": { + "description": "Access denied to this post's account.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "404": { + "description": "No post with that id.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "409": { + "description": "The post cannot be read yet. Either it is not published (its status is not `posted` or it has no `post_url`; error `Post is not published yet, so it has no stats`), or the platform is not connected for the post's account (error `linkedin is not connected for this account`). This is checked before 422, so an unpublished post on any platform returns 409.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "422": { + "description": "Stats are not supported for this post. Only LinkedIn company-page posts are supported today. Errors: `Stats are not available for posts yet` (any other platform), `Stats are available for LinkedIn company-page posts only` (a LinkedIn personal post), `post_url does not name a LinkedIn post`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "502": { + "description": "The platform rejected the stats read, for example because the connection lacks analytics access (error `LinkedIn rejected the stats read for this post`).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + } + } + } } }, "components": { @@ -3839,6 +3969,121 @@ } } }, + "PostStats": { + "type": "object", + "required": [ + "post_id", + "platform", + "post_url", + "impressions", + "unique_impressions", + "clicks", + "likes", + "comments", + "shares", + "engagement", + "as_of" + ], + "properties": { + "post_id": { + "type": "string", + "format": "uuid", + "description": "The post's id.", + "example": "3f8e2c1a-5b7d-4e9f-a1c2-6d4b8e0f2a91" + }, + "platform": { + "type": "string", + "description": "The platform the post was published to.", + "example": "linkedin" + }, + "post_url": { + "type": "string", + "description": "The live post's URL.", + "example": "https://www.linkedin.com/feed/update/urn:li:share:7389012345678901248" + }, + "impressions": { + "type": [ + "integer", + "null" + ], + "description": "Times the post was shown. `null` when the platform does not report it.", + "example": 412 + }, + "unique_impressions": { + "type": [ + "integer", + "null" + ], + "description": "Distinct members the post was shown to. `null` when the platform does not report it.", + "example": 287 + }, + "clicks": { + "type": [ + "integer", + "null" + ], + "description": "Clicks on the post's content, company name or logo. `null` when the platform does not report it.", + "example": 19 + }, + "likes": { + "type": [ + "integer", + "null" + ], + "description": "Likes (reactions). `null` when the platform does not report it.", + "example": 14 + }, + "comments": { + "type": [ + "integer", + "null" + ], + "description": "Comments. `null` when the platform does not report it.", + "example": 3 + }, + "shares": { + "type": [ + "integer", + "null" + ], + "description": "Reposts. `null` when the platform does not report it.", + "example": 2 + }, + "engagement": { + "type": [ + "number", + "null" + ], + "description": "LinkedIn's engagement rate for the post, from 0 to 1. `null` when the platform does not report it.", + "example": 0.0922 + }, + "as_of": { + "type": "string", + "format": "date-time", + "description": "Server time of the read.", + "example": "2026-10-25T18:04:12Z" + } + } + }, + "PostStatsResponse": { + "type": "object", + "required": [ + "status", + "stats" + ], + "properties": { + "status": { + "type": "string", + "enum": [ + "success" + ], + "description": "Status of the request" + }, + "stats": { + "$ref": "#/components/schemas/PostStats" + } + } + }, "PostListResponse": { "type": "object", "properties": { diff --git a/api-reference/publishing/stats.mdx b/api-reference/publishing/stats.mdx new file mode 100644 index 00000000..39bd4c20 --- /dev/null +++ b/api-reference/publishing/stats.mdx @@ -0,0 +1,8 @@ +--- +title: 'Get Post Stats' +openapi: "/api-reference/openapi/social.json GET /api/posts/{id}/stats" +--- + +## Data coverage + +LinkedIn reports organic activity only, within a rolling 12-month window; a post older than 12 months returns what LinkedIn still holds. diff --git a/docs.json b/docs.json index 4eb81e10..8d51f11a 100644 --- a/docs.json +++ b/docs.json @@ -478,6 +478,7 @@ "api-reference/publishing/create", "api-reference/publishing/list", "api-reference/publishing/get", + "api-reference/publishing/stats", "api-reference/publishing/cancel" ] } diff --git a/llms-full.txt b/llms-full.txt index fcd72f16..e950985d 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -64464,6 +64464,376 @@ This operation requires one of the security alternatives in the specification be ``` +# Get Post Stats + +Source: https://recoupable.dev/docs/api-reference/publishing/stats + +Get post stats + +## Data coverage + +LinkedIn reports organic activity only, within a rolling 12-month window; a post older than 12 months returns what LinkedIn still holds. + +## GET /api/posts/{id}/stats + +Full OpenAPI specification: https://recoupable.dev/docs/spec/social.json + +## Authentication + +This operation requires one of the security alternatives in the specification below. Security scheme definitions are included where present in the published specification. + +[Authentication guide](https://recoupable.dev/docs/authentication) + +## Operation and referenced schemas + +```json +{ + "openapi": "3.1.0", + "info": { + "title": "Recoup API - Social", + "description": "API documentation for the Recoup platform - an AI agent platform for the music industry", + "license": { + "name": "MIT" + }, + "version": "1.0.0" + }, + "servers": [ + { + "url": "https://api.recoupable.dev" + } + ], + "paths": { + "/api/posts/{id}/stats": { + "get": { + "operationId": "getPostsByIdStats", + "summary": "Get post stats", + "x-recoup-availability": "pending", + "description": "Pending API release. The platform's own analytics for one post published with [Create Post](https://recoupable.dev/docs/api-reference/publishing/create), read live through the same connection that published it. Currently LinkedIn company-page posts only; other platforms and LinkedIn personal (member) posts return 422. Each call is a fresh read and `as_of` records when it happened. Each successful read costs $0.001 (1,000 credits), charged to the caller after LinkedIn returns the numbers. Credits are checked first; a request that fails (4xx/5xx) is not charged.", + "security": [ + { + "apiKeyAuth": [] + }, + { + "bearerAuth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + }, + "description": "The post's id, from [Create Post](https://recoupable.dev/docs/api-reference/publishing/create)." + } + ], + "responses": { + "200": { + "description": "The post's current stats.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostStatsResponse" + } + } + } + }, + "400": { + "description": "`id` is not a valid uuid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "402": { + "description": "Insufficient credits: the account has less than the $0.001 a read costs. Returned after the 400/401/403/404/409/422 checks and before LinkedIn is called, so nothing is read and nothing is charged.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SocialInsufficientCreditsResponse" + } + } + } + }, + "403": { + "description": "Access denied to this post's account.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "404": { + "description": "No post with that id.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "409": { + "description": "The post cannot be read yet. Either it is not published (its status is not `posted` or it has no `post_url`; error `Post is not published yet, so it has no stats`), or the platform is not connected for the post's account (error `linkedin is not connected for this account`). This is checked before 422, so an unpublished post on any platform returns 409.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "422": { + "description": "Stats are not supported for this post. Only LinkedIn company-page posts are supported today. Errors: `Stats are not available for posts yet` (any other platform), `Stats are available for LinkedIn company-page posts only` (a LinkedIn personal post), `post_url does not name a LinkedIn post`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + }, + "502": { + "description": "The platform rejected the stats read, for example because the connection lacks analytics access (error `LinkedIn rejected the stats read for this post`).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostErrorResponse" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "PostStatsResponse": { + "type": "object", + "required": [ + "status", + "stats" + ], + "properties": { + "status": { + "type": "string", + "enum": [ + "success" + ], + "description": "Status of the request" + }, + "stats": { + "$ref": "#/components/schemas/PostStats" + } + } + }, + "PostErrorResponse": { + "type": "object", + "required": [ + "status", + "error" + ], + "properties": { + "status": { + "type": "string", + "enum": [ + "error" + ], + "description": "Always `error`" + }, + "missing_fields": { + "type": "array", + "description": "JSON path segments to the first field that failed validation, e.g. `[\"description\"]`", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + } + }, + "error": { + "type": "string", + "description": "Human-readable error message" + } + } + }, + "SocialInsufficientCreditsResponse": { + "type": "object", + "description": "Returned (402) when the account lacks credits for the request. Nothing is charged and no Stripe object is created. Credits must be bought explicitly via [`POST /api/credits/sessions`](https://recoupable.dev/docs/api-reference/credits/sessions-create). Examples: a scrape of one profile with posts=20 requires $0.25; one post through Create Post requires $0.01.", + "properties": { + "error": { + "type": "string", + "enum": [ + "insufficient_credits" + ] + }, + "remaining_credits": { + "type": "integer", + "example": 0 + }, + "required_credits": { + "type": "integer", + "example": 250000 + }, + "billingUrl": { + "type": "string", + "description": "Static link to the Recoup app, where a human can save a card and buy credits. It is a constant, not a freshly minted Stripe Checkout Session, so a credit-gated endpoint that keeps returning 402 creates nothing. To buy credits programmatically, call [`POST /api/credits/sessions`](https://recoupable.dev/docs/api-reference/credits/sessions-create).", + "example": "https://app.recoupable.dev" + } + }, + "required": [ + "error", + "remaining_credits", + "required_credits", + "billingUrl" + ] + }, + "PostStats": { + "type": "object", + "required": [ + "post_id", + "platform", + "post_url", + "impressions", + "unique_impressions", + "clicks", + "likes", + "comments", + "shares", + "engagement", + "as_of" + ], + "properties": { + "post_id": { + "type": "string", + "format": "uuid", + "description": "The post's id.", + "example": "3f8e2c1a-5b7d-4e9f-a1c2-6d4b8e0f2a91" + }, + "platform": { + "type": "string", + "description": "The platform the post was published to.", + "example": "linkedin" + }, + "post_url": { + "type": "string", + "description": "The live post's URL.", + "example": "https://www.linkedin.com/feed/update/urn:li:share:7389012345678901248" + }, + "impressions": { + "type": [ + "integer", + "null" + ], + "description": "Times the post was shown. `null` when the platform does not report it.", + "example": 412 + }, + "unique_impressions": { + "type": [ + "integer", + "null" + ], + "description": "Distinct members the post was shown to. `null` when the platform does not report it.", + "example": 287 + }, + "clicks": { + "type": [ + "integer", + "null" + ], + "description": "Clicks on the post's content, company name or logo. `null` when the platform does not report it.", + "example": 19 + }, + "likes": { + "type": [ + "integer", + "null" + ], + "description": "Likes (reactions). `null` when the platform does not report it.", + "example": 14 + }, + "comments": { + "type": [ + "integer", + "null" + ], + "description": "Comments. `null` when the platform does not report it.", + "example": 3 + }, + "shares": { + "type": [ + "integer", + "null" + ], + "description": "Reposts. `null` when the platform does not report it.", + "example": 2 + }, + "engagement": { + "type": [ + "number", + "null" + ], + "description": "LinkedIn's engagement rate for the post, from 0 to 1. `null` when the platform does not report it.", + "example": 0.0922 + }, + "as_of": { + "type": "string", + "format": "date-time", + "description": "Server time of the read.", + "example": "2026-10-25T18:04:12Z" + } + } + } + }, + "securitySchemes": { + "apiKeyAuth": { + "type": "apiKey", + "in": "header", + "name": "x-api-key", + "description": "Your Recoup API key. [Learn more](https://recoupable.dev/docs/quickstart#api-keys)." + }, + "bearerAuth": { + "type": "http", + "scheme": "bearer" + } + } + } +} +``` + + # Cancel Post Source: https://recoupable.dev/docs/api-reference/publishing/cancel