ugcinc 4.19.1 → 4.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -43,7 +43,7 @@ if (res.ok) {
43
43
 
44
44
  - `client.accounts`: list, create, update, troubleshoot, quarantine/release, and manage account lifecycle
45
45
  - `client.posts`: create video/slideshow posts, update them, retry failures, and preview schedule conflicts
46
- - `client.media`: upload media, create media records, manage tags/names, and work with social audio
46
+ - `client.media`: upload media, create media records, search profile-picture candidates, search images and videos by keyword (`media.imageSearch`, cursor-paged), manage tags/names, and work with social audio
47
47
  - `client.stats`: fetch account/post analytics, daily aggregates, top performers, and refresh stats
48
48
  - `client.org`: manage organizations, API keys, and integration keys
49
49
  - `client.billing`: inspect subscription state and handle account deactivation, replacements, and refunds
@@ -74,6 +74,20 @@ if (posts.ok) {
74
74
  }
75
75
  ```
76
76
 
77
+ ## Posting failure quick reference
78
+
79
+ `posts.getStatus()` returns `failure`; both `getPosts()` and `getPostsPage()` include it on each post. It is `null` when there is no current posting issue. A successful lookup still returns HTTP 200 even if the post failed.
80
+
81
+ ```typescript
82
+ const result = await client.posts.getStatus({ postId: "post_123" });
83
+ if (result.ok && result.data.failure) {
84
+ const { code, message, recovery, next_action } = result.data.failure;
85
+ console.log(code, message, recovery, next_action);
86
+ }
87
+ ```
88
+
89
+ See the posting failure reference below for recovery states and messages.
90
+
77
91
  ## Pagination
78
92
 
79
93
  `accounts.getAccounts()` and `posts.getPosts()` support keyset pagination via `limit`/`cursor`.
@@ -93,6 +107,28 @@ do {
93
107
  } while (cursor);
94
108
  ```
95
109
 
110
+ For interactive tables, `posts.getPostsPage()` keeps filtering and sorting on the server and
111
+ returns page-scoped latest stats plus `totalCount`, organization-wide `postTags`,
112
+ `anyHasTitle`, and `matchingAccountIds`. It supports caption/title/account search; platform,
113
+ post type, status, account, account-tag, post-tag, social-audio, and phone-type filters; and
114
+ sorting by account, status, title, caption, tag, audio presence, scheduled time, or engagement:
115
+
116
+ ```typescript
117
+ const page = await client.posts.getPostsPage({
118
+ search: "launch",
119
+ statuses: ["complete"],
120
+ postTags: ["fall-campaign"],
121
+ sortBy: "views",
122
+ sortDirection: "desc",
123
+ limit: 200,
124
+ });
125
+
126
+ if (page.ok) {
127
+ console.log(page.data.posts, page.data.stats, page.data.totalCount);
128
+ const next = page.data.nextCursor;
129
+ }
130
+ ```
131
+
96
132
  ## Caption Overlays
97
133
 
98
134
  Video posts can carry text overlays to display on the video. Pass `captionOverlays` to
@@ -144,6 +180,28 @@ await client.posts.createVideo({
144
180
  await client.posts.updatePost({ postId: "post_123", post_tag: "campaign-august" });
145
181
  ```
146
182
 
183
+ When a post fails, its category is appended to the tag as `fail reason: <fail_category>` (for
184
+ example `campaign-july fail reason: device_error`), so a post list shows why without a status call
185
+ per post. The suffix is removed again when the post is retried.
186
+
187
+ ## Backup Audio
188
+
189
+ A post can carry a second sound. If the platform refuses the primary sound at posting time, the
190
+ backup becomes the post's `social_audio_id`, the post is re-attempted once, ` switched to backup
191
+ audio` is appended to its `tag`, and `backup_audio_used_at` is set. With no backup left the post
192
+ fails as `audio_unavailable` and is not retried. Set it with `backupSocialAudioId` on
193
+ `posts.createVideo()`, `posts.createSlideshow()`, `posts.createDraft()`, and `posts.updatePost()`
194
+ (`null` clears it on update).
195
+
196
+ ```typescript
197
+ await client.posts.createSlideshow({
198
+ accountId: "acc_123",
199
+ imageUrls: ["https://example.com/img1.jpg"],
200
+ socialAudioId: "audio_primary",
201
+ backupSocialAudioId: "audio_fallback",
202
+ });
203
+ ```
204
+
147
205
  ## Useful Exports
148
206
 
149
207
  - `UGCClient` for API access
@@ -162,6 +220,33 @@ For the full endpoint reference, all method signatures, data structures, and wor
162
220
 
163
221
  MIT
164
222
 
223
+ ## Posting failure reference
224
+
225
+ The same `failure` object is returned by status and list responses. It contains a stable `code`, a fixed `message`, a `recovery` state, and `next_action`.
226
+
227
+ | Recovery | Meaning |
228
+ |---|---|
229
+ | `retry_pending` | The existing post is waiting for another attempt; no execution time is guaranteed. |
230
+ | `waiting` | The existing post is paused until a publishing issue is resolved. |
231
+ | `verifying_publication` | Publication is being checked before another attempt is allowed. |
232
+ | `stopped` | No automatic recovery is indicated. Follow `next_action`. |
233
+
234
+ `next_action` is `wait`, `change_audio`, `change_audio_or_contact_support`, or `contact_support`. When it is `wait`, do not submit another copy. Account and publishing operations are handled by the service; these messages never ask customers to manage them.
235
+
236
+ | Code | Message |
237
+ |---|---|
238
+ | `AUDIO_UNAVAILABLE` | The selected sound is unavailable. Choose another sound and retry. |
239
+ | `BACKUP_AUDIO_RETRY_PENDING` | The selected sound was unavailable. Your post is waiting to be retried with its backup sound. |
240
+ | `AUDIO_RETRY_PENDING` | The selected sound could not be loaded. Your post is waiting to be retried. |
241
+ | `AUDIO_PREPARATION_FAILED` | The selected sound could not be prepared for this post. Choose another sound or contact support before retrying. |
242
+ | `PUBLISHING_RETRY_PENDING` | Publishing was temporarily interrupted. Your post is waiting to be retried. No action is needed. |
243
+ | `PUBLISHING_BLOCKED` | A publishing issue prevented this post from proceeding. Contact support for help with this post. |
244
+ | `POST_PROCESSING_FAILED` | A processing error prevented this posting attempt from completing. Contact support before retrying. |
245
+ | `PUBLICATION_CHECK_IN_PROGRESS` | We’re checking whether your post published. Please wait before submitting it again to avoid a duplicate. |
246
+ | `PUBLICATION_UNCONFIRMED` | We couldn’t confirm whether your post published. Contact support before submitting it again to avoid a duplicate. |
247
+ | `POST_RETRY_PENDING` | The previous posting attempt did not complete. Your post is waiting to be retried. No action is needed. |
248
+ | `POST_FAILED` | The posting attempt failed, but we couldn’t determine the cause. Contact support before submitting it again. |
249
+
165
250
  ### Render a supplied Remotion composition
166
251
 
167
252
  `remotion-composition` accepts a TSX module whose default export is a React
@@ -196,11 +281,84 @@ status/logs to inspect failures and the returned video for preview.
196
281
  Server integrations can also call `submitRemotionCompositionRenderJob` and
197
282
  `getRenderJobStatus` with the configured render-worker origin.
198
283
 
199
- ### Remotion composition PNG output
284
+ ## Social reference acquisition
285
+
286
+ Quick reference:
287
+
288
+ ```ts
289
+ const page = await client.media.listProfilePosts({ url: profileUrl, limit: 20 });
290
+ const post = await client.media.downloadSocialPost({ url: postUrl });
291
+ ```
292
+
293
+ `media.listProfilePosts({url, limit?, cursor?})` calls `POST /media/social/list-profile-posts`.
294
+ Supported profiles are TikTok and Instagram. Limit defaults to 20 (1–50). Results include
295
+ `profile`, `posts`, `nextCursor`, `coverage` and `warnings`. Pass `nextCursor` back with
296
+ the same profile URL. Cursors expire after one hour and belong to the authenticated
297
+ organization. Short pages may still have a cursor. Instagram combines posts and reels;
298
+ ordering follows those feeds, not a guaranteed chronological snapshot. `exhausted`
299
+ means the available feeds ended, not that all historical posts are visible. Thumbnail
300
+ URLs are upstream references and may expire. Listing does not import media.
301
+
302
+ `media.downloadSocialPost({url})` calls `POST /media/social/download-post` until the
303
+ checkpointed import finishes. Inputs are TikTok video/photo or Instagram post/reel
304
+ URLs, including supported share redirects. The raw HTTP endpoint returns `processing`
305
+ while another continuation is needed; call it again with the same URL. The SDK/tool
306
+ handles these calls. Imports have `complete`, `partial` or `failed` status, ordered
307
+ `assets`, `failedAssets`, post metadata, sound attribution, provenance and an owned
308
+ JSON `manifestUrl`. Assets contain owned URLs, media IDs, SHA-256 hashes, probed
309
+ format/dimensions/duration and embedded audio presence. A successful API response can
310
+ contain a partial/failed import; check `data.status` and `data.failedAssets`.
311
+
312
+ Repeat a partial/failed import to retry missing assets. Successful imports are reused
313
+ within the organization while their records/files remain available; import state is
314
+ retained for 30 days. Original downloaded video bytes/audio are preserved. Photo
315
+ carousels stay ordered images: this does not generate a slideshow video or download
316
+ an attributed full music track. Absent metadata is null. Supported acquired formats
317
+ are JPEG/PNG/WebP images and MP4/WebM video, limited to 50 assets, 100 MB per asset
318
+ and 30 minutes per video. Limits are checked before accepting an asset. No guarantee
319
+ of original upload quality or watermark removal is made.
320
+
321
+ Both operations require an organization and `content:analyze` for scoped keys.
322
+ Errors may include `errorCode` and `retryable`. Existing scraper credit/rate safeguards
323
+ apply. Storage/provider errors do not imply that a post or profile was deleted.
324
+
325
+ ## Video inspection
326
+
327
+ ```ts
328
+ const frames = await client.media.extractFrames({url: videoUrl, timestampsMs: [0, 1500, 3000]});
329
+ const scenes = await client.media.detectScenes({url: videoUrl});
330
+ // Recover a pending job without submitting another analysis:
331
+ const status = await client.media.getMediaAnalysis({jobId});
332
+ ```
200
333
 
201
- The `remotion-composition` workflow node accepts `outputType: "image"` to render
202
- the first composition frame as a PNG. Its output port becomes `image`; video
203
- remains the default for existing workflows. Pass sound assets separately for
204
- photo posts because PNG files contain no audio. The public render helper
205
- `submitRemotionCompositionRenderJob({...composition, outputType: "image"})`
206
- supports the same option.
334
+ These methods use authenticated `POST /media/analysis/extract-frames`,
335
+ `POST /media/analysis/detect-scenes` and `POST /media/analysis/status`.
336
+ They require an organization and `content:analyze`. Agent tools are `extract_frames`,
337
+ `detect_scenes` and the supporting `get_media_analysis` status operation.
338
+
339
+ Extraction accepts either `timestampsMs` (1–48 values, including timestamps from other
340
+ analysis results) or `range: {startMs,endMs,intervalMs}` (end exclusive, maximum 48
341
+ samples). `selection` is `nearest` (default; ties choose the earlier frame), `before`
342
+ or `after`. Times are milliseconds from the first displayed video frame. Out-of-range
343
+ requests fail; `after` fails if no later frame exists. Returned frames include requested
344
+ and actual times, original integer PTS as a string, decoded frame index, dimensions
345
+ and owned PNG URL. Rotation and sample aspect ratio are applied; outputs fit within
346
+ 1280 pixels on each axis without upscaling. `contactSheet` defaults to true and returns
347
+ a labeled sheet with cell boxes linked to the individual images. Duplicate requests
348
+ retain their order and may reference the same decoded frame.
349
+
350
+ Scene detection reuses the existing adaptive and brightness/pHash detector and returns
351
+ source-time ranges, frame indices and detector settings. It does not export split MP4s.
352
+ Ranges end exclusively. The last scene ends at video duration; its endPts is null when
353
+ there is no following frame. Boundaries are detector estimates, especially for fades,
354
+ not a guarantee of semantic scenes or an exact creative edit point.
355
+
356
+ Both operations run as bounded worker jobs. SDK/tool calls make up to 180 status polls, spaced two seconds apart;
357
+ check `data.status`: pending/processing includes `jobId` for subsequent status calls,
358
+ completed includes `result`, and failed includes an explicit error. A successful HTTP
359
+ response does not imply job completion. Status handles belong to their organization
360
+ and expire after seven days. Each submission analyzes the current source bytes rather
361
+ than caching by URL. Results include source SHA-256, encoded/display dimensions,
362
+ rotation, time base, source starting PTS, decoded frame count and an owned manifest.
363
+ Video URLs must be public HTTPS sources. Limits: 100 MB, 30 minutes, 4096 pixels per
364
+ encoded dimension, 120,000 decoded frames. Unsupported/malformed media fails explicitly.
@@ -333,18 +333,18 @@ export declare const nodeDefinitions: {
333
333
  __TOutputs: import("./screenshot-animation").ScreenshotAnimationNodeOutputs;
334
334
  };
335
335
  readonly 'remotion-composition': NodeDefinition<"remotion-composition", "generator", {
336
+ width: number;
337
+ height: number;
336
338
  source: string;
337
339
  outputMode: "per-input" | "single";
338
340
  selectionMode: null;
339
341
  outputType: "video" | "image";
340
342
  inputs: {
341
- type: "number" | "boolean" | "object" | "video" | "audio" | "image" | "text";
343
+ type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
342
344
  id: string;
343
345
  isArray: boolean;
344
346
  required: boolean;
345
347
  }[];
346
- width: number;
347
- height: number;
348
348
  fps: number;
349
349
  durationInFrames: number;
350
350
  inputProps: Record<string, unknown>;
@@ -4,35 +4,35 @@ type Outputs = {
4
4
  output: VideoValue;
5
5
  };
6
6
  declare const defaults: {
7
+ width: number;
8
+ height: number;
7
9
  source: string;
8
10
  outputMode: "per-input" | "single";
9
11
  selectionMode: null;
10
12
  outputType: "video" | "image";
11
13
  inputs: {
12
- type: "number" | "boolean" | "object" | "video" | "audio" | "image" | "text";
14
+ type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
13
15
  id: string;
14
16
  isArray: boolean;
15
17
  required: boolean;
16
18
  }[];
17
- width: number;
18
- height: number;
19
19
  fps: number;
20
20
  durationInFrames: number;
21
21
  inputProps: Record<string, unknown>;
22
22
  };
23
23
  declare const _default: import("./types").NodeDefinition<"remotion-composition", "generator", {
24
+ width: number;
25
+ height: number;
24
26
  source: string;
25
27
  outputMode: "per-input" | "single";
26
28
  selectionMode: null;
27
29
  outputType: "video" | "image";
28
30
  inputs: {
29
- type: "number" | "boolean" | "object" | "video" | "audio" | "image" | "text";
31
+ type: "number" | "boolean" | "object" | "video" | "image" | "audio" | "text";
30
32
  id: string;
31
33
  isArray: boolean;
32
34
  required: boolean;
33
35
  }[];
34
- width: number;
35
- height: number;
36
36
  fps: number;
37
37
  durationInFrames: number;
38
38
  inputProps: Record<string, unknown>;
package/dist/base.js CHANGED
@@ -52,6 +52,8 @@ class BaseClient {
52
52
  ok: false,
53
53
  code: rawData.code,
54
54
  message: rawData.message ?? 'Request failed',
55
+ ...(typeof rawData.errorCode === 'string' ? { errorCode: rawData.errorCode } : {}),
56
+ ...(typeof rawData.retryable === 'boolean' ? { retryable: rawData.retryable } : {}),
55
57
  };
56
58
  }
57
59
  }
package/dist/index.d.ts CHANGED
@@ -85,3 +85,6 @@ export type { SelectionMode, ExhaustionBehavior, SelectionConfig, SelectionState
85
85
  export type { SuccessResponse, ErrorResponse, ApiResponse, } from './types';
86
86
  export type { CropBoundary, CropAxisConfig, DynamicCropConfig, BorderRadiusConfig, VerticalAnchor, HorizontalAnchor, HorizontalSelfAnchor, VerticalSelfAnchor, RelativePositionConfigX, RelativePositionConfigY, } from './render/types';
87
87
  export type { PublicPostFailureCode, PublicPostRecovery, PublicPostNextAction, PublicPostFailure } from './post-failure';
88
+ export type { ListProfilePostsParams, ListProfilePostsResult, DownloadSocialPostParams, DownloadSocialPostResult, SocialReferencePost, SocialReferenceAsset } from './social-acquisition';
89
+ export type { ExtractFramesParams, DetectScenesParams, FramesResult, ScenesResult, MediaAnalysisResult, MediaAnalysisJob } from "./media-analysis";
90
+ export { extractFramesSchema, detectScenesSchema, mediaAnalysisStatusSchema, mediaAnalysisResultSchema } from "./media-analysis";
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.hasMissingTriggerError = exports.getPortErrorsForNode = exports.getErrorNodeIds = exports.validateWorkflow = exports.getCapturedNodes = exports.getNodesDownstreamOfSet = exports.getDownstreamNodes = exports.checkCrossContextViolation = exports.getForEachContext = exports.getConnectedSource = exports.cleanupStaleConnections = exports.removeNodeConnections = exports.removeConnection = exports.addConnection = exports.deriveConnections = exports.createNode = exports.getOutputSchema = exports.getNodeByType = exports.getAllNodes = exports.getInputPreviewValue = exports.computeAllNodePortsWithPreviews = exports.computeAllNodePorts = exports.computePortsWithPreviews = exports.computePortsForNode = exports.areTypesCompatible = exports.parseRemotionPropsJson = exports.REMOTION_COMPOSITION_IMPORTS = exports.remotionCompositionPortSchema = exports.remotionCompositionNodeSchema = exports.remotionCompositionSchema = exports.submitIMessageDmRenderJob = exports.submitInstagramDmRenderJob = exports.submitAutoCaptionRenderJob = exports.submitRemotionCompositionRenderJob = exports.submitScreenshotAnimationRenderJob = exports.submitSceneSplitJob = exports.submitDeduplicationJob = exports.getRenderJobStatus = exports.submitVideoRenderJob = exports.submitImageRenderJob = exports.BillingClient = exports.CommentsClient = exports.MediaClient = exports.AutomationsClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
9
9
  exports.parseOpenAPIOutputPath = exports.parseOpenAPIInputs = exports.mapOpenAPIType = exports.nodeConfigToCaptionStyle = exports.HttpMethods = exports.prepareImageComposerInput = exports.substituteVariables = exports.processTemplate = exports.extractTemplateVariables = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.getModelDurations = exports.getModelAspectRatios = exports.ALL_VIDEO_MODELS = exports.getAvailableInputModes = exports.hasReferenceVariant = exports.getReferenceModelId = exports.hasFirstLastFrameVariant = exports.getFirstLastFrameModelId = exports.hasImageToVideoVariant = exports.getImageToVideoModelId = exports.isImageToVideoModel = exports.IMAGE_ASPECT_RATIOS = exports.ALL_IMAGE_MODELS = exports.getEditModelId = exports.isEditModel = exports.getCapturedSourceNodeTypes = exports.getFlowControlNodeTypes = exports.getAllNodeDefinitions = exports.getNodeDefinition = exports.isPortType = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = exports.extractWorkflowConfig = exports.generateNodeName = exports.shuffleNodePreview = exports.getPreviewValue = exports.removePreviewForConnection = exports.updatePreviewMapForConnection = exports.computePreviewMap = exports.computeAllNodePreviews = exports.resolveNodePreview = exports.getWorkflowOutputSchema = exports.hasMissingTerminalError = void 0;
10
- exports.prepareVideoComposerInput = exports.formatDateTag = exports.outputFieldsToZod = exports.outputFieldToZod = exports.LLMProviders = exports.applyLogicOperator = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToString = exports.indexExpressionToIndexes = exports.resolveUnknownPath = exports.getOutputTypeFromCategory = void 0;
10
+ exports.mediaAnalysisResultSchema = exports.mediaAnalysisStatusSchema = exports.detectScenesSchema = exports.extractFramesSchema = exports.prepareVideoComposerInput = exports.formatDateTag = exports.outputFieldsToZod = exports.outputFieldToZod = exports.LLMProviders = exports.applyLogicOperator = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToString = exports.indexExpressionToIndexes = exports.resolveUnknownPath = exports.getOutputTypeFromCategory = void 0;
11
11
  // =============================================================================
12
12
  // Client Exports
13
13
  // =============================================================================
@@ -174,3 +174,8 @@ var save_to_media_1 = require("./automations/nodes/save-to-media");
174
174
  Object.defineProperty(exports, "formatDateTag", { enumerable: true, get: function () { return save_to_media_1.formatDateTag; } });
175
175
  var video_composer_1 = require("./automations/nodes/video-composer");
176
176
  Object.defineProperty(exports, "prepareVideoComposerInput", { enumerable: true, get: function () { return video_composer_1.prepareVideoComposerInput; } });
177
+ var media_analysis_1 = require("./media-analysis");
178
+ Object.defineProperty(exports, "extractFramesSchema", { enumerable: true, get: function () { return media_analysis_1.extractFramesSchema; } });
179
+ Object.defineProperty(exports, "detectScenesSchema", { enumerable: true, get: function () { return media_analysis_1.detectScenesSchema; } });
180
+ Object.defineProperty(exports, "mediaAnalysisStatusSchema", { enumerable: true, get: function () { return media_analysis_1.mediaAnalysisStatusSchema; } });
181
+ Object.defineProperty(exports, "mediaAnalysisResultSchema", { enumerable: true, get: function () { return media_analysis_1.mediaAnalysisResultSchema; } });