> ## Documentation Index
> Fetch the complete documentation index at: https://www.dropfans.io/developers/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /api/external/vault/video-upload/complete — Finish a video upload (step 3 of 3)

> Registers a finished TUS upload as a vault item and kicks moderation.

- Source: https://www.dropfans.io/developers/reference/complete-video-upload
- Section: API reference
- OpenAPI: https://www.dropfans.io/developers/openapi.json

Registers a finished TUS upload as a vault item and kicks moderation.

**Idempotent**: a retried completion for an already-registered video returns the existing item instead of creating a duplicate — retry freely. **409 means "not finished yet, retry"**: the CDN can lag a few seconds after the TUS client reports done, so on a 409 back off (2s, 5s, 10s, 30s) and call again with the same body.

The item starts `PENDING` and finalizes asynchronously (the NSFW pipeline plus transcoding). Poll [video-status](https://www.dropfans.io/developers/reference/video-status.md) with the `bunnyStreamId` to know when the video is playable, and the vault list for moderation.

## Authentication

`Authorization: Bearer dpfn_...` — an API key generated in the creator's dashboard (Vault → API Connect). One key = one creator. Missing or invalid keys return 401 `{"error":"Unauthorized","code":"unauthorized"}`.

## Request body (application/json)

| Field | Type | Required | Description |
|---|---|---|---|
| `videoId` | string | yes | The `videoId` from step 1. |
| `originalName` | string | yes | Same file name you sent in step 1. |
| `completionToken` | string | yes | The token from step 1 (valid 8h). Proves this key started the upload. |
| `folderId` | string \\| null |  | Optional folder — silently ignored if you don’t own it. |

Example — Register the uploaded video:

```json
{
  "videoId": "c2f7f9e2-1111-4222-b333-4d55e6f7a8b9",
  "originalName": "teaser.mp4",
  "completionToken": "eyJ…"
}
```

## Responses

### 200

Registered (or already registered — idempotent).

| Field | Type | Required | Description |
|---|---|---|---|
| `success` | boolean | yes | Always true. |
| `item` | VideoVaultItem | yes | The new video vault item, starting PENDING. |

```json
{
  "success": true,
  "item": {
    "id": "clxv9z8y70002item",
    "fileName": "teaser.mp4",
    "filePath": "https://vz-example.b-cdn.net/c2f7f9e2-…/playlist.m3u8?token=…",
    "thumbnailPath": "https://vz-example.b-cdn.net/c2f7f9e2-…/thumbnail.jpg?token=…",
    "fileType": "video",
    "fileSize": 52428800,
    "bunnyStreamId": "c2f7f9e2-1111-4222-b333-4d55e6f7a8b9",
    "moderationStatus": "PENDING",
    "moderationTags": [],
    "createdAt": "2026-08-01T10:20:00.000Z",
    "aiEnhanced": false
  }
}
```

## Errors

| Status | Body | When |
|---|---|---|
| 400 | `{"error":"Missing required fields: videoId and originalName"}` | Either field absent or blank. |
| 401 | `{"error":"Unauthorized","code":"unauthorized"}` | Missing or invalid API key. |
| 403 | `{"error":"Invalid or expired upload token — please retry the upload"}` | The completionToken is wrong, for another key, or older than 8h — start over from step 1. |
| 409 | `{"error":"The video upload has not finished — please retry."}` | The CDN has not finished receiving the bytes — back off and retry the same call. |
| 413 | `{"error":"Video too large. Max 500MB."}` | The stored byte count exceeds the cap — the upload is discarded. |
| 500 | `{"error":"Failed to register the uploaded video"}` | Registration failed — retry later. |

## Notes

This item shape adds `moderationStatus`, `moderationTags` and `aiEnhanced` (and omits `durationSeconds`) compared to the plain upload endpoint. `filePath` here is signed for ~1 hour only.

## Rate limiting

Per-key fixed windows by tier (Personal 60/min · 5,000/day; approved apps 300/min · 50,000/day; Dropfans-operated integrations exempt). Read the live values from X-RateLimit-Tier, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset and their -Day variants; a 429 carries Retry-After and `{"error":"Rate limit exceeded","code":"rate_limited"}`. See [Rate limits](https://www.dropfans.io/developers/concepts/rate-limits.md).

## Code samples

### curl

```bash
curl -X POST "https://www.dropfans.io/api/external/vault/video-upload/complete" \
  -H "Authorization: Bearer $DROPFANS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "videoId": "c2f7f9e2-1111-4222-b333-4d55e6f7a8b9",
  "originalName": "teaser.mp4",
  "completionToken": "eyJ…"
}'
```

### Node

```javascript
// Step 2 happens in your client with a TUS library (npm i tus-js-client),
// then step 3 registers the finished upload.
import * as tus from 'tus-js-client';
import { readFile } from 'node:fs/promises';

const creds = await ( // step 1
  await fetch('https://www.dropfans.io/api/external/vault/video-upload', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.DROPFANS_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ originalName: 'teaser.mp4' }),
  })
).json();

const file = await readFile('teaser.mp4');
await new Promise((resolve, reject) => {   // step 2 — raw bytes straight to the CDN
  new tus.Upload(file, {
    endpoint: creds.tusEndpoint,
    headers: {
      AuthorizationSignature: creds.signature,
      AuthorizationExpire: String(creds.expires),
      VideoId: creds.videoId,
      LibraryId: creds.libraryId,
    },
    metadata: { filetype: 'video/mp4', title: 'teaser.mp4' },
    onError: reject,
    onSuccess: resolve,
  }).start();
});

// step 3 — 409 means "not finished yet": back off and retry the same call
for (const waitMs of [0, 2000, 5000, 10000, 30000]) {
  if (waitMs) await new Promise((r) => setTimeout(r, waitMs));
  const res = await fetch(
    'https://www.dropfans.io/api/external/vault/video-upload/complete',
    {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.DROPFANS_API_KEY}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        videoId: creds.videoId,
        originalName: 'teaser.mp4',
        completionToken: creds.completionToken,
      }),
    },
  );
  if (res.status !== 409) {
    console.log(await res.json());
    break;
  }
}
```

### Python

```python
import os
import requests

res = requests.post(
    "https://www.dropfans.io/api/external/vault/video-upload/complete",
    headers={"Authorization": f"Bearer {os.environ['DROPFANS_API_KEY']}"},
    json={
        "videoId": "c2f7f9e2-1111-4222-b333-4d55e6f7a8b9",
        "originalName": "teaser.mp4",
        "completionToken": "eyJ…",
    },
)
print(res.json())
```

## OpenAPI

```json
{
  "method": "POST",
  "path": "/api/external/vault/video-upload/complete",
  "operationId": "completeVideoUpload",
  "tags": [
    "vault"
  ],
  "summary": "Finish a video upload (step 3 of 3)",
  "description": "Registers a finished TUS upload as a vault item and kicks moderation.\n\n**Idempotent**: a retried completion for an already-registered video returns the existing item instead of creating a duplicate — retry freely. **409 means \"not finished yet, retry\"**: the CDN can lag a few seconds after the TUS client reports done, so on a 409 back off (2s, 5s, 10s, 30s) and call again with the same body.\n\nThe item starts `PENDING` and finalizes asynchronously (the NSFW pipeline plus transcoding). Poll [video-status](https://www.dropfans.io/developers/reference/video-status.md) with the `bunnyStreamId` to know when the video is playable, and the vault list for moderation.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "videoId": {
              "type": "string",
              "description": "The `videoId` from step 1.",
              "example": "c2f7f9e2-1111-4222-b333-4d55e6f7a8b9"
            },
            "originalName": {
              "type": "string",
              "description": "Same file name you sent in step 1.",
              "example": "teaser.mp4"
            },
            "completionToken": {
              "type": "string",
              "description": "The token from step 1 (valid 8h). Proves this key started the upload."
            },
            "folderId": {
              "type": [
                "string",
                "null"
              ],
              "description": "Optional folder — silently ignored if you don’t own it."
            }
          },
          "required": [
            "videoId",
            "originalName",
            "completionToken"
          ]
        },
        "examples": {
          "complete": {
            "summary": "Register the uploaded video",
            "value": {
              "videoId": "c2f7f9e2-1111-4222-b333-4d55e6f7a8b9",
              "originalName": "teaser.mp4",
              "completionToken": "eyJ…"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Registered (or already registered — idempotent).",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "success": {
                "type": "boolean",
                "description": "Always true.",
                "example": true
              },
              "item": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "The new vault item id.",
                    "example": "clxv9z8y70002item"
                  },
                  "fileName": {
                    "type": "string",
                    "description": "The `originalName` you sent.",
                    "example": "teaser.mp4"
                  },
                  "filePath": {
                    "type": "string",
                    "description": "Signed playback URL, valid ~1 hour. For a long-lived URL, re-list the vault later."
                  },
                  "thumbnailPath": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Signed Stream thumbnail (600px wide)."
                  },
                  "fileType": {
                    "type": "string",
                    "description": "Always \"video\" here.",
                    "enum": [
                      "video"
                    ]
                  },
                  "fileSize": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "description": "Byte count Bunny reported for the finished upload.",
                    "example": 52428800
                  },
                  "bunnyStreamId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The Stream GUID — poll POST /api/external/vault/video-status with it while the video transcodes."
                  },
                  "moderationStatus": {
                    "type": "string",
                    "description": "Starts PENDING — the NSFW pipeline finalizes it asynchronously. The item only appears in the default vault list once APPROVED.",
                    "enum": [
                      "PENDING",
                      "APPROVED",
                      "REJECTED",
                      "FLAGGED"
                    ]
                  },
                  "moderationTags": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "Moderation label."
                    },
                    "description": "Always empty at creation (moderation has not run yet)."
                  },
                  "createdAt": {
                    "type": "string",
                    "description": "Creation time.",
                    "format": "date-time"
                  },
                  "aiEnhanced": {
                    "type": "boolean",
                    "description": "True when the account is AI-labelled — every upload from such an account is force-marked AI."
                  }
                },
                "required": [
                  "id",
                  "fileName",
                  "filePath",
                  "fileType",
                  "moderationStatus",
                  "moderationTags",
                  "createdAt",
                  "aiEnhanced"
                ]
              }
            },
            "required": [
              "success",
              "item"
            ]
          },
          "example": {
            "success": true,
            "item": {
              "id": "clxv9z8y70002item",
              "fileName": "teaser.mp4",
              "filePath": "https://vz-example.b-cdn.net/c2f7f9e2-…/playlist.m3u8?token=…",
              "thumbnailPath": "https://vz-example.b-cdn.net/c2f7f9e2-…/thumbnail.jpg?token=…",
              "fileType": "video",
              "fileSize": 52428800,
              "bunnyStreamId": "c2f7f9e2-1111-4222-b333-4d55e6f7a8b9",
              "moderationStatus": "PENDING",
              "moderationTags": [],
              "createdAt": "2026-08-01T10:20:00.000Z",
              "aiEnhanced": false
            }
          }
        }
      }
    },
    "400": {
      "description": "Either field absent or blank.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message describing what went wrong.",
                "example": "Vault item not found"
              }
            },
            "required": [
              "error"
            ]
          },
          "example": {
            "error": "Missing required fields: videoId and originalName"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid API key.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, rate_limited, username_required.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "Unauthorized",
            "code": "unauthorized"
          }
        }
      }
    },
    "403": {
      "description": "The completionToken is wrong, for another key, or older than 8h — start over from step 1.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message describing what went wrong.",
                "example": "Vault item not found"
              }
            },
            "required": [
              "error"
            ]
          },
          "example": {
            "error": "Invalid or expired upload token — please retry the upload"
          }
        }
      }
    },
    "409": {
      "description": "The CDN has not finished receiving the bytes — back off and retry the same call.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message describing what went wrong.",
                "example": "Vault item not found"
              }
            },
            "required": [
              "error"
            ]
          },
          "example": {
            "error": "The video upload has not finished — please retry."
          }
        }
      }
    },
    "413": {
      "description": "The stored byte count exceeds the cap — the upload is discarded.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message describing what went wrong.",
                "example": "Vault item not found"
              }
            },
            "required": [
              "error"
            ]
          },
          "example": {
            "error": "Video too large. Max 500MB."
          }
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded for the current minute or day window. Wait Retry-After seconds and retry.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "Retry-After": {
          "description": "Seconds to wait before retrying (sent with 429s).",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, rate_limited, username_required.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "Rate limit exceeded",
            "code": "rate_limited"
          }
        }
      }
    },
    "500": {
      "description": "Registration failed — retry later.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message describing what went wrong.",
                "example": "Vault item not found"
              }
            },
            "required": [
              "error"
            ]
          },
          "example": {
            "error": "Failed to register the uploaded video"
          }
        }
      }
    }
  },
  "x-codeSamples": [
    {
      "lang": "cURL",
      "label": "curl",
      "source": "curl -X POST \"https://www.dropfans.io/api/external/vault/video-upload/complete\" \\\n  -H \"Authorization: Bearer $DROPFANS_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"videoId\": \"c2f7f9e2-1111-4222-b333-4d55e6f7a8b9\",\n  \"originalName\": \"teaser.mp4\",\n  \"completionToken\": \"eyJ…\"\n}'"
    },
    {
      "lang": "JavaScript",
      "label": "Node",
      "source": "// Step 2 happens in your client with a TUS library (npm i tus-js-client),\n// then step 3 registers the finished upload.\nimport * as tus from 'tus-js-client';\nimport { readFile } from 'node:fs/promises';\n\nconst creds = await ( // step 1\n  await fetch('https://www.dropfans.io/api/external/vault/video-upload', {\n    method: 'POST',\n    headers: {\n      Authorization: `Bearer ${process.env.DROPFANS_API_KEY}`,\n      'Content-Type': 'application/json',\n    },\n    body: JSON.stringify({ originalName: 'teaser.mp4' }),\n  })\n).json();\n\nconst file = await readFile('teaser.mp4');\nawait new Promise((resolve, reject) => {   // step 2 — raw bytes straight to the CDN\n  new tus.Upload(file, {\n    endpoint: creds.tusEndpoint,\n    headers: {\n      AuthorizationSignature: creds.signature,\n      AuthorizationExpire: String(creds.expires),\n      VideoId: creds.videoId,\n      LibraryId: creds.libraryId,\n    },\n    metadata: { filetype: 'video/mp4', title: 'teaser.mp4' },\n    onError: reject,\n    onSuccess: resolve,\n  }).start();\n});\n\n// step 3 — 409 means \"not finished yet\": back off and retry the same call\nfor (const waitMs of [0, 2000, 5000, 10000, 30000]) {\n  if (waitMs) await new Promise((r) => setTimeout(r, waitMs));\n  const res = await fetch(\n    'https://www.dropfans.io/api/external/vault/video-upload/complete',\n    {\n      method: 'POST',\n      headers: {\n        Authorization: `Bearer ${process.env.DROPFANS_API_KEY}`,\n        'Content-Type': 'application/json',\n      },\n      body: JSON.stringify({\n        videoId: creds.videoId,\n        originalName: 'teaser.mp4',\n        completionToken: creds.completionToken,\n      }),\n    },\n  );\n  if (res.status !== 409) {\n    console.log(await res.json());\n    break;\n  }\n}"
    },
    {
      "lang": "Python",
      "source": "import os\nimport requests\n\nres = requests.post(\n    \"https://www.dropfans.io/api/external/vault/video-upload/complete\",\n    headers={\"Authorization\": f\"Bearer {os.environ['DROPFANS_API_KEY']}\"},\n    json={\n        \"videoId\": \"c2f7f9e2-1111-4222-b333-4d55e6f7a8b9\",\n        \"originalName\": \"teaser.mp4\",\n        \"completionToken\": \"eyJ…\",\n    },\n)\nprint(res.json())"
    }
  ],
  "x-dropfans-docs": "https://www.dropfans.io/developers/reference/complete-video-upload"
}
```

---

Previous: [Start a video upload (step 1 of 3)](https://www.dropfans.io/developers/reference/start-video-upload.md) · Next: [Check video transcoding status (batch)](https://www.dropfans.io/developers/reference/video-status.md) · All pages: [llms.txt](https://www.dropfans.io/developers/llms.txt)
