@mocart-io/api 1.5.0 → 1.7.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.
@@ -123,6 +123,26 @@ export type ProblemDetails = {
123
123
  * Present on `CREATIVE_NOT_PENDING` only: the status the creative is actually in, so a caller can reconcile without a second read.
124
124
  */
125
125
  currentStatus?: 'NOT_GENERATED' | 'QUEUED' | 'GENERATING' | 'PENDING' | 'APPROVED' | 'REJECTED' | 'FAILED';
126
+ /**
127
+ * Present on `CAMPAIGN_NOT_DELETABLE` when creatives are still generating: how many are `QUEUED` or `GENERATING`. Retry the delete once they settle.
128
+ */
129
+ generatingCount?: number;
130
+ /**
131
+ * Present on `CAMPAIGN_NOT_DELETABLE` when the campaign is still being created (`still_being_created`): retry shortly.
132
+ */
133
+ reason?: string;
134
+ /**
135
+ * Present on `LIMIT_EXCEEDED` only: the plan limit that was reached.
136
+ */
137
+ limitKey?: string;
138
+ /**
139
+ * Present on `LIMIT_EXCEEDED` only: what the plan allows.
140
+ */
141
+ limit?: number;
142
+ /**
143
+ * Present on `LIMIT_EXCEEDED` only: what the account already holds.
144
+ */
145
+ current?: number;
126
146
  };
127
147
  export type Creative = {
128
148
  /**
@@ -261,6 +281,20 @@ export type Asset = {
261
281
  * Asset creation time as an ISO-8601 string; `null` only for a legacy doc lacking a coercible one.
262
282
  */
263
283
  createdAt: string | null;
284
+ /**
285
+ * Your own key/value labels for the asset. ABSENT until the asset has at least one key.
286
+ */
287
+ metadata?: {
288
+ [key: string]: unknown;
289
+ };
290
+ /**
291
+ * Free-text note on the asset (at most 500 characters). ABSENT until the asset has a non-empty note.
292
+ */
293
+ notes?: string;
294
+ /**
295
+ * When the asset was deleted, as an ISO-8601 string (`null` on a live one). ABSENT on a default read; present on a read opted in with `?showDeleted=true`, and on the `DELETE` response.
296
+ */
297
+ deletedAt?: string | null;
264
298
  };
265
299
  export type AssetList = {
266
300
  /**
@@ -299,6 +333,16 @@ export type Campaign = {
299
333
  * Campaign creation time as an ISO-8601 string; `null` only for a legacy doc lacking a coercible one.
300
334
  */
301
335
  createdAt: string | null;
336
+ /**
337
+ * The partner's own string map (Stripe-style `metadata`), present ONLY when it holds at least one key — ABSENT otherwise, so a campaign that never had metadata reads exactly as before. Set it on `POST /campaigns` or `PATCH /campaigns/{id}`.
338
+ */
339
+ metadata?: {
340
+ [key: string]: unknown;
341
+ };
342
+ /**
343
+ * When the campaign was deleted, as an ISO-8601 string; `null` when it is live. PRESENT ONLY when the read opted in with `?showDeleted=true`, and on the `DELETE` response. ABSENT on every other read, so a default response is byte-identical to before this field existed.
344
+ */
345
+ deletedAt?: string | null;
302
346
  };
303
347
  export type CampaignList = {
304
348
  /**
@@ -472,6 +516,62 @@ export type UpdateCreativeRequest = {
472
516
  [key: string]: string | null;
473
517
  };
474
518
  };
519
+ export type UpdateAssetRequest = {
520
+ /**
521
+ * Shortlist the asset (`true`) or take it off the shortlist.
522
+ */
523
+ favorited?: boolean;
524
+ /**
525
+ * Free-text note, at most 500 characters. `""` clears it.
526
+ */
527
+ notes?: string;
528
+ /**
529
+ * Merged into the asset metadata: a string sets a key, `null` deletes it, an unmentioned key is untouched.
530
+ */
531
+ metadata?: {
532
+ [key: string]: string | null;
533
+ };
534
+ };
535
+ export type CreateCampaignRequest = {
536
+ /**
537
+ * The campaign name — 1 to 200 characters after trimming.
538
+ */
539
+ name: string;
540
+ /**
541
+ * The id of one of the account's brands.
542
+ */
543
+ brandId: string;
544
+ /**
545
+ * What the campaign produces: `STATIC` (images), `VIDEO`, `3D` or `PLAYABLE`.
546
+ */
547
+ assetType: 'VIDEO' | '3D' | 'STATIC' | 'PLAYABLE';
548
+ /**
549
+ * The output aspect ratio, e.g. `1:1` or `9:16`. A `VIDEO` campaign accepts only the video ratios.
550
+ */
551
+ format: '1:1' | '2:3' | '3:2' | '3:4' | '4:3' | '4:5' | '5:4' | '9:16' | '16:9' | '21:9';
552
+ /**
553
+ * The products the campaign covers — at least one, each one of the brand's own products. One empty creative is opened per product.
554
+ */
555
+ productIds: Array<string>;
556
+ /**
557
+ * Your own string map, stored on the campaign and returned as `metadata`. Up to 50 keys; a value is a string, never `null` here (`null` only deletes a key on `PATCH`).
558
+ */
559
+ metadata?: {
560
+ [key: string]: string;
561
+ };
562
+ };
563
+ export type UpdateCampaignRequest = {
564
+ /**
565
+ * The new campaign name — 1 to 200 characters after trimming.
566
+ */
567
+ name?: string;
568
+ /**
569
+ * Your own string map. Merged into the stored map key by key: a string sets the key, `null` deletes it, an unmentioned key is untouched. `{}` changes nothing.
570
+ */
571
+ metadata?: {
572
+ [key: string]: string | null;
573
+ };
574
+ };
475
575
  export type RunCompletionEstimate = {
476
576
  /**
477
577
  * `createdAt + durationSeconds`, as an ISO 8601 UTC instant.
@@ -1155,6 +1255,10 @@ export type ListAssetsData = {
1155
1255
  * Optional TRUE-ONLY shortlist filter: pass `true` to return only shortlisted (favorited) assets; omit for all. Any non-`true` value is ignored (no filter). Combinable with `type` and `status`.
1156
1256
  */
1157
1257
  favorited?: boolean;
1258
+ /**
1259
+ * Pass `true` to include deleted resources; each one then carries a `deletedAt` timestamp (`null` on a live one). Any other value, or omitting it, keeps deleted resources hidden and the response exactly as it was before this parameter existed.
1260
+ */
1261
+ showDeleted?: 'true';
1158
1262
  };
1159
1263
  url: '/assets';
1160
1264
  };
@@ -1188,6 +1292,69 @@ export type ListAssetsResponses = {
1188
1292
  200: AssetList;
1189
1293
  };
1190
1294
  export type ListAssetsResponse = ListAssetsResponses[keyof ListAssetsResponses];
1295
+ export type DeleteAssetData = {
1296
+ body?: never;
1297
+ headers?: {
1298
+ /**
1299
+ * The `ETag` of the asset as you last read it. If the asset has changed since, nothing is done and the answer is `412` (`PRECONDITION_FAILED`). Omit it to act regardless; `*` matches any existing asset.
1300
+ */
1301
+ 'If-Match'?: string;
1302
+ /**
1303
+ * Optional (16–255 characters). With one, a retry of the same request returns the same answer and records nothing new; without one the request just runs.
1304
+ */
1305
+ 'Idempotency-Key'?: string;
1306
+ };
1307
+ path: {
1308
+ /**
1309
+ * Stable Mocart asset document id (the `assetId` a `GET /assets` row carries).
1310
+ */
1311
+ id: string;
1312
+ };
1313
+ query?: never;
1314
+ url: '/assets/{id}';
1315
+ };
1316
+ export type DeleteAssetErrors = {
1317
+ /**
1318
+ * Bad Request. The `Idempotency-Key` header is malformed (`INVALID_IDEMPOTENCY_KEY`).
1319
+ */
1320
+ 400: ProblemDetails;
1321
+ /**
1322
+ * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1323
+ */
1324
+ 401: ProblemDetails;
1325
+ /**
1326
+ * Forbidden. The key lacks the `assets:write` scope (`API_TOKEN_SCOPE_DENIED`).
1327
+ */
1328
+ 403: ProblemDetails;
1329
+ /**
1330
+ * Not Found (`ASSET_NOT_FOUND`). No usable asset with this id belongs to the key's account. An asset of another account, a deleted one (except for `DELETE` and `undelete`, which act on it), or one without a stored url returns this SAME uniform 404 (no-leak).
1331
+ */
1332
+ 404: ProblemDetails;
1333
+ /**
1334
+ * Conflict. A request under this key is still in progress (`IDEMPOTENCY_IN_PROGRESS`, retry after `Retry-After`); or the key was already used for a different request (`IDEMPOTENCY_KEY_REUSED`).
1335
+ */
1336
+ 409: ProblemDetails;
1337
+ /**
1338
+ * Precondition Failed (`PRECONDITION_FAILED`). `If-Match` no longer matches the asset. Nothing was changed; read it again and retry.
1339
+ */
1340
+ 412: ProblemDetails;
1341
+ /**
1342
+ * Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1343
+ */
1344
+ 429: string;
1345
+ /**
1346
+ * Service Unavailable (`WRITES_PAUSED`). Writes are paused for this account right now. Nothing was changed and the `Idempotency-Key` was not consumed, so retry the SAME request after `Retry-After`. Reads are unaffected.
1347
+ */
1348
+ 503: ProblemDetails;
1349
+ };
1350
+ export type DeleteAssetError = DeleteAssetErrors[keyof DeleteAssetErrors];
1351
+ export type DeleteAssetResponses = {
1352
+ /**
1353
+ * OK. The deleted asset, `deletedAt` set (or the replay of an earlier delete).
1354
+ */
1355
+ 200: Asset;
1356
+ };
1357
+ export type DeleteAssetResponse = DeleteAssetResponses[keyof DeleteAssetResponses];
1191
1358
  export type GetAssetByIdData = {
1192
1359
  body?: never;
1193
1360
  path: {
@@ -1196,7 +1363,12 @@ export type GetAssetByIdData = {
1196
1363
  */
1197
1364
  id: string;
1198
1365
  };
1199
- query?: never;
1366
+ query?: {
1367
+ /**
1368
+ * Pass `true` to include deleted resources; each one then carries a `deletedAt` timestamp (`null` on a live one). Any other value, or omitting it, keeps deleted resources hidden and the response exactly as it was before this parameter existed.
1369
+ */
1370
+ showDeleted?: 'true';
1371
+ };
1200
1372
  url: '/assets/{id}';
1201
1373
  };
1202
1374
  export type GetAssetByIdErrors = {
@@ -1209,7 +1381,7 @@ export type GetAssetByIdErrors = {
1209
1381
  */
1210
1382
  403: ProblemDetails;
1211
1383
  /**
1212
- * Not Found. No asset matched the identifier (`ASSET_NOT_FOUND`). A cross-tenant, soft-deleted, or non-usable (no stored url) asset id returns this SAME uniform 404 (no-leak).
1384
+ * Not Found. No asset matched the identifier (`ASSET_NOT_FOUND`). A cross-tenant, soft-deleted (without `?showDeleted=true`), or non-usable (no stored url) asset id returns this SAME uniform 404 (no-leak).
1213
1385
  */
1214
1386
  404: ProblemDetails;
1215
1387
  /**
@@ -1225,24 +1397,33 @@ export type GetAssetByIdResponses = {
1225
1397
  200: Asset;
1226
1398
  };
1227
1399
  export type GetAssetByIdResponse = GetAssetByIdResponses[keyof GetAssetByIdResponses];
1228
- export type ListCampaignsData = {
1229
- body?: never;
1230
- path?: never;
1231
- query?: {
1400
+ export type UpdateAssetData = {
1401
+ /**
1402
+ * The fields to change. The body itself may be omitted.
1403
+ */
1404
+ body: UpdateAssetRequest;
1405
+ headers?: {
1232
1406
  /**
1233
- * Opaque base64url keyset cursor from a prior page's `pagination.nextCursor`. Omit for the first page; pass it back verbatim to continue.
1407
+ * The `ETag` of the asset as you last read it. If the asset has changed since, nothing is done and the answer is `412` (`PRECONDITION_FAILED`). Omit it to act regardless; `*` matches any existing asset.
1234
1408
  */
1235
- cursor?: string;
1409
+ 'If-Match'?: string;
1236
1410
  /**
1237
- * Optional filter by campaign lifecycle status. When omitted, ALL non-deleted campaigns are returned (there is NO default status).
1411
+ * Optional (16–255 characters). With one, a retry of the same request returns the same answer and records nothing new; without one the request just runs.
1238
1412
  */
1239
- status?: 'IN_PROGRESS' | 'READY' | 'BLOCKED' | 'COMPLETED';
1413
+ 'Idempotency-Key'?: string;
1240
1414
  };
1241
- url: '/campaigns';
1415
+ path: {
1416
+ /**
1417
+ * Stable Mocart asset document id (the `assetId` a `GET /assets` row carries).
1418
+ */
1419
+ id: string;
1420
+ };
1421
+ query?: never;
1422
+ url: '/assets/{id}';
1242
1423
  };
1243
- export type ListCampaignsErrors = {
1424
+ export type UpdateAssetErrors = {
1244
1425
  /**
1245
- * Bad Request. The `cursor` query parameter is not a valid opaque keyset cursor (`INVALID_CURSOR`).
1426
+ * Bad Request. The `Idempotency-Key` header is malformed (`INVALID_IDEMPOTENCY_KEY`).
1246
1427
  */
1247
1428
  400: ProblemDetails;
1248
1429
  /**
@@ -1250,63 +1431,563 @@ export type ListCampaignsErrors = {
1250
1431
  */
1251
1432
  401: ProblemDetails;
1252
1433
  /**
1253
- * Forbidden. The token does not carry the required scope (`API_TOKEN_SCOPE_DENIED`).
1434
+ * Forbidden. The key lacks the `assets:write` scope (`API_TOKEN_SCOPE_DENIED`).
1254
1435
  */
1255
1436
  403: ProblemDetails;
1256
1437
  /**
1257
- * Unprocessable Content. A query parameter failed field validation (e.g. a non-string shape); the offending fields are enumerated in `errors[]`.
1438
+ * Not Found (`ASSET_NOT_FOUND`). No usable asset with this id belongs to the key's account. An asset of another account, a deleted one (except for `DELETE` and `undelete`, which act on it), or one without a stored url returns this SAME uniform 404 (no-leak).
1439
+ */
1440
+ 404: ProblemDetails;
1441
+ /**
1442
+ * Conflict. A request under this key is still in progress (`IDEMPOTENCY_IN_PROGRESS`, retry after `Retry-After`); or the key was already used for a different request (`IDEMPOTENCY_KEY_REUSED`).
1443
+ */
1444
+ 409: ProblemDetails;
1445
+ /**
1446
+ * Precondition Failed (`PRECONDITION_FAILED`). `If-Match` no longer matches the asset. Nothing was changed; read it again and retry.
1447
+ */
1448
+ 412: ProblemDetails;
1449
+ /**
1450
+ * Unprocessable Content (`VALIDATION_ERROR`). The body is malformed: an unknown field (`status` is never writable), `notes` over the limit, or `metadata` breaking its rules. Every offending field is listed in `errors[]`.
1258
1451
  */
1259
1452
  422: ProblemDetails;
1260
1453
  /**
1261
- * Too Many Requests. The per-token sliding window of 200 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1454
+ * Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1262
1455
  */
1263
1456
  429: string;
1457
+ /**
1458
+ * Service Unavailable (`WRITES_PAUSED`). Writes are paused for this account right now. Nothing was changed and the `Idempotency-Key` was not consumed, so retry the SAME request after `Retry-After`. Reads are unaffected.
1459
+ */
1460
+ 503: ProblemDetails;
1264
1461
  };
1265
- export type ListCampaignsError = ListCampaignsErrors[keyof ListCampaignsErrors];
1266
- export type ListCampaignsResponses = {
1462
+ export type UpdateAssetError = UpdateAssetErrors[keyof UpdateAssetErrors];
1463
+ export type UpdateAssetResponses = {
1267
1464
  /**
1268
- * OK. One keyset-paginated page of campaigns.
1465
+ * OK. The edited asset (or the replay of an earlier edit with this key).
1269
1466
  */
1270
- 200: CampaignList;
1467
+ 200: Asset;
1271
1468
  };
1272
- export type ListCampaignsResponse = ListCampaignsResponses[keyof ListCampaignsResponses];
1273
- export type GetCampaignByIdData = {
1469
+ export type UpdateAssetResponse = UpdateAssetResponses[keyof UpdateAssetResponses];
1470
+ export type ArchiveAssetData = {
1274
1471
  body?: never;
1472
+ headers: {
1473
+ /**
1474
+ * The `ETag` of the asset as you last read it. If the asset has changed since, nothing is done and the answer is `412` (`PRECONDITION_FAILED`). Omit it to act regardless; `*` matches any existing asset.
1475
+ */
1476
+ 'If-Match'?: string;
1477
+ /**
1478
+ * One unique value (16–255 characters) per logical request. A retry with the same key and request returns the same asset and records nothing new.
1479
+ */
1480
+ 'Idempotency-Key': string;
1481
+ };
1275
1482
  path: {
1276
1483
  /**
1277
- * Stable Mocart campaign document id.
1484
+ * Stable Mocart asset document id (the `assetId` a `GET /assets` row carries).
1278
1485
  */
1279
- id: string;
1486
+ assetId: string;
1280
1487
  };
1281
1488
  query?: never;
1282
- url: '/campaigns/{id}';
1489
+ url: '/assets/{assetId}/archive';
1283
1490
  };
1284
- export type GetCampaignByIdErrors = {
1491
+ export type ArchiveAssetErrors = {
1492
+ /**
1493
+ * Bad Request. The `Idempotency-Key` header is missing (`IDEMPOTENCY_KEY_REQUIRED`) or malformed (`INVALID_IDEMPOTENCY_KEY`).
1494
+ */
1495
+ 400: ProblemDetails;
1285
1496
  /**
1286
1497
  * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1287
1498
  */
1288
1499
  401: ProblemDetails;
1289
1500
  /**
1290
- * Forbidden. The token does not carry the required scope (`API_TOKEN_SCOPE_DENIED`).
1501
+ * Forbidden. The key lacks the `assets:write` scope (`API_TOKEN_SCOPE_DENIED`).
1291
1502
  */
1292
1503
  403: ProblemDetails;
1293
1504
  /**
1294
- * Not Found. No campaign matched the identifier (`CAMPAIGN_NOT_FOUND`). A cross-tenant or soft-deleted campaign id returns this SAME uniform 404 (no-leak).
1505
+ * Not Found (`ASSET_NOT_FOUND`). No usable asset with this id belongs to the key's account. An asset of another account, a deleted one (except for `DELETE` and `undelete`, which act on it), or one without a stored url returns this SAME uniform 404 (no-leak).
1295
1506
  */
1296
1507
  404: ProblemDetails;
1297
1508
  /**
1298
- * Too Many Requests. The per-token sliding window of 200 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1509
+ * Conflict. A request under this key is still in progress (`IDEMPOTENCY_IN_PROGRESS`, retry after `Retry-After`); or the key was already used for a different request (`IDEMPOTENCY_KEY_REUSED`).
1510
+ */
1511
+ 409: ProblemDetails;
1512
+ /**
1513
+ * Precondition Failed (`PRECONDITION_FAILED`). `If-Match` no longer matches the asset. Nothing was changed; read it again and retry.
1514
+ */
1515
+ 412: ProblemDetails;
1516
+ /**
1517
+ * Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1299
1518
  */
1300
1519
  429: string;
1520
+ /**
1521
+ * Service Unavailable (`WRITES_PAUSED`). Writes are paused for this account right now. Nothing was changed and the `Idempotency-Key` was not consumed, so retry the SAME request after `Retry-After`. Reads are unaffected.
1522
+ */
1523
+ 503: ProblemDetails;
1301
1524
  };
1302
- export type GetCampaignByIdError = GetCampaignByIdErrors[keyof GetCampaignByIdErrors];
1303
- export type GetCampaignByIdResponses = {
1525
+ export type ArchiveAssetError = ArchiveAssetErrors[keyof ArchiveAssetErrors];
1526
+ export type ArchiveAssetResponses = {
1304
1527
  /**
1305
- * OK. The single campaign.
1528
+ * OK. The archived asset (or the replay of an earlier archive with this key).
1306
1529
  */
1307
- 200: Campaign;
1530
+ 200: Asset;
1308
1531
  };
1309
- export type GetCampaignByIdResponse = GetCampaignByIdResponses[keyof GetCampaignByIdResponses];
1532
+ export type ArchiveAssetResponse = ArchiveAssetResponses[keyof ArchiveAssetResponses];
1533
+ export type UnarchiveAssetData = {
1534
+ body?: never;
1535
+ headers: {
1536
+ /**
1537
+ * The `ETag` of the asset as you last read it. If the asset has changed since, nothing is done and the answer is `412` (`PRECONDITION_FAILED`). Omit it to act regardless; `*` matches any existing asset.
1538
+ */
1539
+ 'If-Match'?: string;
1540
+ /**
1541
+ * One unique value (16–255 characters) per logical request. A retry with the same key and request returns the same asset and records nothing new.
1542
+ */
1543
+ 'Idempotency-Key': string;
1544
+ };
1545
+ path: {
1546
+ /**
1547
+ * Stable Mocart asset document id (the `assetId` a `GET /assets` row carries).
1548
+ */
1549
+ assetId: string;
1550
+ };
1551
+ query?: never;
1552
+ url: '/assets/{assetId}/unarchive';
1553
+ };
1554
+ export type UnarchiveAssetErrors = {
1555
+ /**
1556
+ * Bad Request. The `Idempotency-Key` header is missing (`IDEMPOTENCY_KEY_REQUIRED`) or malformed (`INVALID_IDEMPOTENCY_KEY`).
1557
+ */
1558
+ 400: ProblemDetails;
1559
+ /**
1560
+ * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1561
+ */
1562
+ 401: ProblemDetails;
1563
+ /**
1564
+ * Forbidden. The key lacks the `assets:write` scope (`API_TOKEN_SCOPE_DENIED`).
1565
+ */
1566
+ 403: ProblemDetails;
1567
+ /**
1568
+ * Not Found (`ASSET_NOT_FOUND`). No usable asset with this id belongs to the key's account. An asset of another account, a deleted one (except for `DELETE` and `undelete`, which act on it), or one without a stored url returns this SAME uniform 404 (no-leak).
1569
+ */
1570
+ 404: ProblemDetails;
1571
+ /**
1572
+ * Conflict. A request under this key is still in progress (`IDEMPOTENCY_IN_PROGRESS`, retry after `Retry-After`); or the key was already used for a different request (`IDEMPOTENCY_KEY_REUSED`).
1573
+ */
1574
+ 409: ProblemDetails;
1575
+ /**
1576
+ * Precondition Failed (`PRECONDITION_FAILED`). `If-Match` no longer matches the asset. Nothing was changed; read it again and retry.
1577
+ */
1578
+ 412: ProblemDetails;
1579
+ /**
1580
+ * Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1581
+ */
1582
+ 429: string;
1583
+ /**
1584
+ * Service Unavailable (`WRITES_PAUSED`). Writes are paused for this account right now. Nothing was changed and the `Idempotency-Key` was not consumed, so retry the SAME request after `Retry-After`. Reads are unaffected.
1585
+ */
1586
+ 503: ProblemDetails;
1587
+ };
1588
+ export type UnarchiveAssetError = UnarchiveAssetErrors[keyof UnarchiveAssetErrors];
1589
+ export type UnarchiveAssetResponses = {
1590
+ /**
1591
+ * OK. The unarchived asset (or the replay of an earlier unarchive with this key).
1592
+ */
1593
+ 200: Asset;
1594
+ };
1595
+ export type UnarchiveAssetResponse = UnarchiveAssetResponses[keyof UnarchiveAssetResponses];
1596
+ export type UndeleteAssetData = {
1597
+ body?: never;
1598
+ headers: {
1599
+ /**
1600
+ * The `ETag` of the asset as you last read it. If the asset has changed since, nothing is done and the answer is `412` (`PRECONDITION_FAILED`). Omit it to act regardless; `*` matches any existing asset.
1601
+ */
1602
+ 'If-Match'?: string;
1603
+ /**
1604
+ * One unique value (16–255 characters) per logical request. A retry with the same key and request returns the same asset and records nothing new.
1605
+ */
1606
+ 'Idempotency-Key': string;
1607
+ };
1608
+ path: {
1609
+ /**
1610
+ * Stable Mocart asset document id (the `assetId` a `GET /assets` row carries).
1611
+ */
1612
+ assetId: string;
1613
+ };
1614
+ query?: never;
1615
+ url: '/assets/{assetId}/undelete';
1616
+ };
1617
+ export type UndeleteAssetErrors = {
1618
+ /**
1619
+ * Bad Request. The `Idempotency-Key` header is missing (`IDEMPOTENCY_KEY_REQUIRED`) or malformed (`INVALID_IDEMPOTENCY_KEY`).
1620
+ */
1621
+ 400: ProblemDetails;
1622
+ /**
1623
+ * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1624
+ */
1625
+ 401: ProblemDetails;
1626
+ /**
1627
+ * Forbidden. The key lacks the `assets:write` scope (`API_TOKEN_SCOPE_DENIED`).
1628
+ */
1629
+ 403: ProblemDetails;
1630
+ /**
1631
+ * Not Found (`ASSET_NOT_FOUND`). No usable asset with this id belongs to the key's account. An asset of another account, a deleted one (except for `DELETE` and `undelete`, which act on it), or one without a stored url returns this SAME uniform 404 (no-leak).
1632
+ */
1633
+ 404: ProblemDetails;
1634
+ /**
1635
+ * Conflict. A request under this key is still in progress (`IDEMPOTENCY_IN_PROGRESS`, retry after `Retry-After`); or the key was already used for a different request (`IDEMPOTENCY_KEY_REUSED`).
1636
+ */
1637
+ 409: ProblemDetails;
1638
+ /**
1639
+ * Precondition Failed (`PRECONDITION_FAILED`). `If-Match` no longer matches the asset. Nothing was changed; read it again and retry.
1640
+ */
1641
+ 412: ProblemDetails;
1642
+ /**
1643
+ * Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1644
+ */
1645
+ 429: string;
1646
+ /**
1647
+ * Service Unavailable (`WRITES_PAUSED`). Writes are paused for this account right now. Nothing was changed and the `Idempotency-Key` was not consumed, so retry the SAME request after `Retry-After`. Reads are unaffected.
1648
+ */
1649
+ 503: ProblemDetails;
1650
+ };
1651
+ export type UndeleteAssetError = UndeleteAssetErrors[keyof UndeleteAssetErrors];
1652
+ export type UndeleteAssetResponses = {
1653
+ /**
1654
+ * OK. The restored asset (or the replay of an earlier restore with this key).
1655
+ */
1656
+ 200: Asset;
1657
+ };
1658
+ export type UndeleteAssetResponse = UndeleteAssetResponses[keyof UndeleteAssetResponses];
1659
+ export type ListCampaignsData = {
1660
+ body?: never;
1661
+ path?: never;
1662
+ query?: {
1663
+ /**
1664
+ * Opaque base64url keyset cursor from a prior page's `pagination.nextCursor`. Omit for the first page; pass it back verbatim to continue.
1665
+ */
1666
+ cursor?: string;
1667
+ /**
1668
+ * Optional filter by campaign lifecycle status. When omitted, ALL non-deleted campaigns are returned (there is NO default status).
1669
+ */
1670
+ status?: 'IN_PROGRESS' | 'READY' | 'BLOCKED' | 'COMPLETED';
1671
+ /**
1672
+ * Pass `true` to include deleted resources; each one then carries a `deletedAt` timestamp (`null` on a live one). Any other value, or omitting it, keeps deleted resources hidden and the response exactly as it was before this parameter existed.
1673
+ */
1674
+ showDeleted?: 'true';
1675
+ };
1676
+ url: '/campaigns';
1677
+ };
1678
+ export type ListCampaignsErrors = {
1679
+ /**
1680
+ * Bad Request. The `cursor` query parameter is not a valid opaque keyset cursor (`INVALID_CURSOR`).
1681
+ */
1682
+ 400: ProblemDetails;
1683
+ /**
1684
+ * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1685
+ */
1686
+ 401: ProblemDetails;
1687
+ /**
1688
+ * Forbidden. The token does not carry the required scope (`API_TOKEN_SCOPE_DENIED`).
1689
+ */
1690
+ 403: ProblemDetails;
1691
+ /**
1692
+ * Unprocessable Content. A query parameter failed field validation (e.g. a non-string shape); the offending fields are enumerated in `errors[]`.
1693
+ */
1694
+ 422: ProblemDetails;
1695
+ /**
1696
+ * Too Many Requests. The per-token sliding window of 200 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1697
+ */
1698
+ 429: string;
1699
+ };
1700
+ export type ListCampaignsError = ListCampaignsErrors[keyof ListCampaignsErrors];
1701
+ export type ListCampaignsResponses = {
1702
+ /**
1703
+ * OK. One keyset-paginated page of campaigns.
1704
+ */
1705
+ 200: CampaignList;
1706
+ };
1707
+ export type ListCampaignsResponse = ListCampaignsResponses[keyof ListCampaignsResponses];
1708
+ export type CreateCampaignData = {
1709
+ /**
1710
+ * The campaign to create. `productIds` is required and non-empty; an unknown field is a 422.
1711
+ */
1712
+ body: CreateCampaignRequest;
1713
+ headers: {
1714
+ /**
1715
+ * One unique value (16–255 characters) per logical request. A retry with the same key and request returns the same campaign and records nothing new.
1716
+ */
1717
+ 'Idempotency-Key': string;
1718
+ };
1719
+ path?: never;
1720
+ query?: never;
1721
+ url: '/campaigns';
1722
+ };
1723
+ export type CreateCampaignErrors = {
1724
+ /**
1725
+ * Bad Request. The `Idempotency-Key` header is missing (`IDEMPOTENCY_KEY_REQUIRED`) or malformed (`INVALID_IDEMPOTENCY_KEY`).
1726
+ */
1727
+ 400: ProblemDetails;
1728
+ /**
1729
+ * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1730
+ */
1731
+ 401: ProblemDetails;
1732
+ /**
1733
+ * Forbidden. The key lacks the `campaigns:write` scope (`API_TOKEN_SCOPE_DENIED`); the account's plan does not include campaigns (`TIER_REQUIRED`); or the account is at its plan's campaign or products-per-campaign limit (`LIMIT_EXCEEDED`, with `limitKey`, `limit` and `current`) — a plan limit is `403`, never `429`.
1734
+ */
1735
+ 403: ProblemDetails;
1736
+ /**
1737
+ * Conflict. a request under this key is still in progress (`IDEMPOTENCY_IN_PROGRESS`, retry after `Retry-After`); or the key was already used for a different request (`IDEMPOTENCY_KEY_REUSED`).
1738
+ */
1739
+ 409: ProblemDetails;
1740
+ /**
1741
+ * Unprocessable Content (`VALIDATION_ERROR`). The body is malformed — an unknown field, an empty `productIds`, a `VIDEO` format outside the video ratios, an invalid `metadata` — or `brandId` or a product id is not the account's own (a missing id and another account's are the same answer); every offending field is listed in `errors[]`.
1742
+ */
1743
+ 422: ProblemDetails;
1744
+ /**
1745
+ * Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1746
+ */
1747
+ 429: string;
1748
+ /**
1749
+ * Service Unavailable. Writes are paused for this account (`WRITES_PAUSED`), or too many campaigns were being created at once and this one lost the race (`SERVICE_UNAVAILABLE`). Nothing was created and the `Idempotency-Key` is still usable: retry the SAME request after `Retry-After`.
1750
+ */
1751
+ 503: ProblemDetails;
1752
+ };
1753
+ export type CreateCampaignError = CreateCampaignErrors[keyof CreateCampaignErrors];
1754
+ export type CreateCampaignResponses = {
1755
+ /**
1756
+ * Created — or the replay of an earlier create with this key.
1757
+ */
1758
+ 201: Campaign;
1759
+ };
1760
+ export type CreateCampaignResponse = CreateCampaignResponses[keyof CreateCampaignResponses];
1761
+ export type DeleteCampaignData = {
1762
+ body?: never;
1763
+ headers?: {
1764
+ /**
1765
+ * Optional. The strong `ETag` of the campaign as you last read it (`GET /campaigns/{id}`), or `*`. When the campaign has changed since, nothing is done and the answer is `412` (`PRECONDITION_FAILED`).
1766
+ */
1767
+ 'If-Match'?: string;
1768
+ /**
1769
+ * Optional (16–255 characters). With one, a retry of the same request returns the same answer and records nothing new; without one the request just runs.
1770
+ */
1771
+ 'Idempotency-Key'?: string;
1772
+ };
1773
+ path: {
1774
+ /**
1775
+ * Stable Mocart campaign document id (the `campaignId` a `GET /campaigns` row carries).
1776
+ */
1777
+ id: string;
1778
+ };
1779
+ query?: never;
1780
+ url: '/campaigns/{id}';
1781
+ };
1782
+ export type DeleteCampaignErrors = {
1783
+ /**
1784
+ * Bad Request. The `Idempotency-Key` header is malformed (`INVALID_IDEMPOTENCY_KEY`).
1785
+ */
1786
+ 400: ProblemDetails;
1787
+ /**
1788
+ * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1789
+ */
1790
+ 401: ProblemDetails;
1791
+ /**
1792
+ * Forbidden. The key lacks the `campaigns:write` scope (`API_TOKEN_SCOPE_DENIED`), or the account's plan does not include campaigns (`TIER_REQUIRED`).
1793
+ */
1794
+ 403: ProblemDetails;
1795
+ /**
1796
+ * Not Found (`CAMPAIGN_NOT_FOUND`). No campaign with this id belongs to the key's account — a campaign of another account returns this SAME uniform 404 (no-leak).
1797
+ */
1798
+ 404: ProblemDetails;
1799
+ /**
1800
+ * Conflict. The campaign holds creatives that are `QUEUED` or `GENERATING` (`CAMPAIGN_NOT_DELETABLE`, how many in `generatingCount`), or is still being created (the same code, `reason` `still_being_created`); or its previous change is still finishing (`CAMPAIGN_CASCADE_PENDING`, retry after `Retry-After`); or a request under this key is still in progress (`IDEMPOTENCY_IN_PROGRESS`, retry after `Retry-After`); or the key was already used for a different request (`IDEMPOTENCY_KEY_REUSED`).
1801
+ */
1802
+ 409: ProblemDetails;
1803
+ /**
1804
+ * Precondition Failed (`PRECONDITION_FAILED`). `If-Match` no longer matches the campaign. Nothing was changed; read it again and retry.
1805
+ */
1806
+ 412: ProblemDetails;
1807
+ /**
1808
+ * Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1809
+ */
1810
+ 429: string;
1811
+ /**
1812
+ * Service Unavailable (`WRITES_PAUSED`). Writes are paused for this account right now — nothing was changed and the `Idempotency-Key` was not consumed, so retry the SAME request after `Retry-After`. Reads are unaffected.
1813
+ */
1814
+ 503: ProblemDetails;
1815
+ };
1816
+ export type DeleteCampaignError = DeleteCampaignErrors[keyof DeleteCampaignErrors];
1817
+ export type DeleteCampaignResponses = {
1818
+ /**
1819
+ * OK. The deleted campaign, `deletedAt` set (or the replay of an earlier delete with this key).
1820
+ */
1821
+ 200: Campaign;
1822
+ };
1823
+ export type DeleteCampaignResponse = DeleteCampaignResponses[keyof DeleteCampaignResponses];
1824
+ export type GetCampaignByIdData = {
1825
+ body?: never;
1826
+ path: {
1827
+ /**
1828
+ * Stable Mocart campaign document id.
1829
+ */
1830
+ id: string;
1831
+ };
1832
+ query?: {
1833
+ /**
1834
+ * Pass `true` to include deleted resources; each one then carries a `deletedAt` timestamp (`null` on a live one). Any other value, or omitting it, keeps deleted resources hidden and the response exactly as it was before this parameter existed.
1835
+ */
1836
+ showDeleted?: 'true';
1837
+ };
1838
+ url: '/campaigns/{id}';
1839
+ };
1840
+ export type GetCampaignByIdErrors = {
1841
+ /**
1842
+ * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1843
+ */
1844
+ 401: ProblemDetails;
1845
+ /**
1846
+ * Forbidden. The token does not carry the required scope (`API_TOKEN_SCOPE_DENIED`).
1847
+ */
1848
+ 403: ProblemDetails;
1849
+ /**
1850
+ * Not Found. No campaign matched the identifier (`CAMPAIGN_NOT_FOUND`). A cross-tenant or soft-deleted (without `?showDeleted=true`) campaign id returns this SAME uniform 404 (no-leak).
1851
+ */
1852
+ 404: ProblemDetails;
1853
+ /**
1854
+ * Too Many Requests. The per-token sliding window of 200 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1855
+ */
1856
+ 429: string;
1857
+ };
1858
+ export type GetCampaignByIdError = GetCampaignByIdErrors[keyof GetCampaignByIdErrors];
1859
+ export type GetCampaignByIdResponses = {
1860
+ /**
1861
+ * OK. The single campaign.
1862
+ */
1863
+ 200: Campaign;
1864
+ };
1865
+ export type GetCampaignByIdResponse = GetCampaignByIdResponses[keyof GetCampaignByIdResponses];
1866
+ export type UpdateCampaignData = {
1867
+ /**
1868
+ * The fields to change. Every field is optional; an unknown field is a 422.
1869
+ */
1870
+ body: UpdateCampaignRequest;
1871
+ headers?: {
1872
+ /**
1873
+ * Optional. The strong `ETag` of the campaign as you last read it (`GET /campaigns/{id}`), or `*`. When the campaign has changed since, nothing is done and the answer is `412` (`PRECONDITION_FAILED`).
1874
+ */
1875
+ 'If-Match'?: string;
1876
+ /**
1877
+ * Optional (16–255 characters). With one, a retry of the same request returns the same answer and records nothing new; without one the request just runs.
1878
+ */
1879
+ 'Idempotency-Key'?: string;
1880
+ };
1881
+ path: {
1882
+ /**
1883
+ * Stable Mocart campaign document id (the `campaignId` a `GET /campaigns` row carries).
1884
+ */
1885
+ id: string;
1886
+ };
1887
+ query?: never;
1888
+ url: '/campaigns/{id}';
1889
+ };
1890
+ export type UpdateCampaignErrors = {
1891
+ /**
1892
+ * Bad Request. The `Idempotency-Key` header is malformed (`INVALID_IDEMPOTENCY_KEY`).
1893
+ */
1894
+ 400: ProblemDetails;
1895
+ /**
1896
+ * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1897
+ */
1898
+ 401: ProblemDetails;
1899
+ /**
1900
+ * Forbidden. The key lacks the `campaigns:write` scope (`API_TOKEN_SCOPE_DENIED`), or the account's plan does not include campaigns (`TIER_REQUIRED`).
1901
+ */
1902
+ 403: ProblemDetails;
1903
+ /**
1904
+ * Not Found (`CAMPAIGN_NOT_FOUND`). No campaign with this id belongs to the key's account — a campaign of another account returns this SAME uniform 404 (no-leak).
1905
+ */
1906
+ 404: ProblemDetails;
1907
+ /**
1908
+ * Conflict. a request under this key is still in progress (`IDEMPOTENCY_IN_PROGRESS`, retry after `Retry-After`); or the key was already used for a different request (`IDEMPOTENCY_KEY_REUSED`).
1909
+ */
1910
+ 409: ProblemDetails;
1911
+ /**
1912
+ * Precondition Failed (`PRECONDITION_FAILED`). `If-Match` no longer matches the campaign. Nothing was changed; read it again and retry.
1913
+ */
1914
+ 412: ProblemDetails;
1915
+ /**
1916
+ * Unprocessable Content (`VALIDATION_ERROR`). The body is malformed — an unknown field, an empty or over-long `name`, an invalid `metadata` key or value, or a merge that would leave more than 50 keys; every offending field is listed in `errors[]`.
1917
+ */
1918
+ 422: ProblemDetails;
1919
+ /**
1920
+ * Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1921
+ */
1922
+ 429: string;
1923
+ /**
1924
+ * Service Unavailable (`WRITES_PAUSED`). Writes are paused for this account right now — nothing was changed and the `Idempotency-Key` was not consumed, so retry the SAME request after `Retry-After`. Reads are unaffected.
1925
+ */
1926
+ 503: ProblemDetails;
1927
+ };
1928
+ export type UpdateCampaignError = UpdateCampaignErrors[keyof UpdateCampaignErrors];
1929
+ export type UpdateCampaignResponses = {
1930
+ /**
1931
+ * OK. The campaign after the edit (or the replay of an earlier edit with this key).
1932
+ */
1933
+ 200: Campaign;
1934
+ };
1935
+ export type UpdateCampaignResponse = UpdateCampaignResponses[keyof UpdateCampaignResponses];
1936
+ export type UndeleteCampaignData = {
1937
+ body?: never;
1938
+ headers: {
1939
+ /**
1940
+ * One unique value (16–255 characters) per logical request. A retry with the same key and request returns the same campaign and records nothing new.
1941
+ */
1942
+ 'Idempotency-Key': string;
1943
+ };
1944
+ path: {
1945
+ /**
1946
+ * Stable Mocart campaign document id (the `campaignId` a `GET /campaigns` row carries).
1947
+ */
1948
+ campaignId: string;
1949
+ };
1950
+ query?: never;
1951
+ url: '/campaigns/{campaignId}/undelete';
1952
+ };
1953
+ export type UndeleteCampaignErrors = {
1954
+ /**
1955
+ * Bad Request. The `Idempotency-Key` header is missing (`IDEMPOTENCY_KEY_REQUIRED`) or malformed (`INVALID_IDEMPOTENCY_KEY`).
1956
+ */
1957
+ 400: ProblemDetails;
1958
+ /**
1959
+ * Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (`ENTITLEMENT_LOST`). A uniform problem body is returned with a distinct `code`; no owner/condition detail (no-leak).
1960
+ */
1961
+ 401: ProblemDetails;
1962
+ /**
1963
+ * Forbidden. The key lacks the `campaigns:write` scope, the account's plan does not include campaigns, or restoring would put the account over its plan’s campaign limit (`LIMIT_EXCEEDED`, with `limitKey`, `limit` and `current`).
1964
+ */
1965
+ 403: ProblemDetails;
1966
+ /**
1967
+ * Not Found (`CAMPAIGN_NOT_FOUND`). No campaign with this id belongs to the key's account — a campaign of another account returns this SAME uniform 404 (no-leak).
1968
+ */
1969
+ 404: ProblemDetails;
1970
+ /**
1971
+ * Conflict. The campaign's previous change is still finishing (`CAMPAIGN_CASCADE_PENDING`, retry after `Retry-After`); or a request under this key is still in progress (`IDEMPOTENCY_IN_PROGRESS`, retry after `Retry-After`); or the key was already used for a different request (`IDEMPOTENCY_KEY_REUSED`).
1972
+ */
1973
+ 409: ProblemDetails;
1974
+ /**
1975
+ * Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
1976
+ */
1977
+ 429: string;
1978
+ /**
1979
+ * Service Unavailable. Writes are paused for this account (`WRITES_PAUSED`), or another campaign write raced this restore at the plan limit and it lost (`SERVICE_UNAVAILABLE`). Nothing was changed and the `Idempotency-Key` is still usable: retry the SAME request after `Retry-After`.
1980
+ */
1981
+ 503: ProblemDetails;
1982
+ };
1983
+ export type UndeleteCampaignError = UndeleteCampaignErrors[keyof UndeleteCampaignErrors];
1984
+ export type UndeleteCampaignResponses = {
1985
+ /**
1986
+ * OK. The restored campaign (or the replay of an earlier restore with this key).
1987
+ */
1988
+ 200: Campaign;
1989
+ };
1990
+ export type UndeleteCampaignResponse = UndeleteCampaignResponses[keyof UndeleteCampaignResponses];
1310
1991
  export type ListDeliveriesData = {
1311
1992
  body?: never;
1312
1993
  path?: never;