{"openapi":"3.1.0","info":{"title":"Drupload API","description":"Programmatic access to Drupload — upload, organize, share, and analyze files at scale.\n\n**Base path:** All documented endpoints live under `/v1/…`. The same routes are also reachable without the `/v1` prefix for backward compatibility, but new integrations should always use `/v1` to remain stable across future breaking changes.\n\n**Authentication:** Most endpoints accept either an API key (`X-API-Key: drp_…`, generated from /dashboard/api-keys — requires Creator/Business plan) or a session JWT (`Authorization: Bearer …`).\n\n**Rate limiting:** every response includes `X-RateLimit-*` headers. Exceeding your quota returns HTTP 429 with a `Retry-After` hint.\n\n**Errors:** every 4xx/5xx response follows the shape `{ error: { code, message, details? } }`.","version":"1.0.0","contact":{"name":"Drupload support","url":"https://drupload.net/contact","email":"support@drupload.net"},"license":{"name":"Proprietary"}},"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Create one at https://drupload.net/dashboard/api-keys — requires Creator or Business plan."},"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Session token issued by `/auth/login`."},"guestToken":{"type":"apiKey","in":"header","name":"X-Guest-Token","description":"Auto-issued token for anonymous guest sessions."}},"schemas":{}},"paths":{"/health":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/upload/initiate":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/upload/sign-part":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/upload/complete":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/upload/abort":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/upload/put-part":{"put":{"responses":{"200":{"description":"Default Response"}}}},"/upload/remote":{"post":{"summary":"Import a file from a remote URL (PRO+)","tags":["Upload"],"description":"The server fetches the URL and pipes the body directly into storage — the client doesn't need to download then re-upload. Ideal for mirroring releases, moving files from Dropbox/Drive, or importing public mods. Private IPs and loopback hosts are blocked at the DNS level. Size is enforced against the caller's plan limit.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/download":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/direct":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/dl":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/preview":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/visibility":{"patch":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/settings":{"patch":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/slug":{"patch":{"summary":"Set or update a custom vanity slug (PRO+)","tags":["Files"],"description":"Replace the default 8-char share ID with a human-readable slug like `my-cool-mod`. Both the new slug and the original share ID keep routing to the file. Requires Pro, Creator or Business plan.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"summary":"Remove the custom vanity slug","tags":["Files"],"description":"Revert to the default 8-char share ID. The slug becomes available for other files to claim.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/versions":{"get":{"summary":"List stored past versions of a file","tags":["Files"],"description":"Returns every FileVersion for this share, newest first. Each row includes the original name, size, mime type, and version number. Only the file owner can read versions.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/versions/promote":{"post":{"summary":"Promote a freshly-uploaded file as the new current version","tags":["Files"],"description":"Snapshots the current payload into FileVersion and swaps in the payload referenced by `fileId`. The shareId, custom slug, download counters, folder assignment, and expiry settings are all preserved. Upload the replacement through the normal upload flow first, then pass the resulting fileId here.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/versions/{versionId}/restore":{"post":{"summary":"Restore a past version as the current payload","tags":["Files"],"description":"Snapshots the current payload as a new FileVersion (so restore itself is reversible), then swaps in the target version and consumes its row. Download URLs do not change.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true},{"schema":{"type":"string"},"in":"path","name":"versionId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/versions/{versionId}":{"delete":{"summary":"Delete a stored past version","tags":["Files"],"description":"Permanently removes the version's R2 object and its database row. This is destructive — use restore first if you're unsure.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true},{"schema":{"type":"string"},"in":"path","name":"versionId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/versions/{versionId}/diff":{"get":{"summary":"Fetch text contents of current + past version for diffing","tags":["Files"],"description":"Returns the raw text of both the current payload and the target version so the UI can render a side-by-side diff. Restricted to mime types starting with `text/` or `application/json` and payloads under 1 MB — binary or oversized files return 415.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true},{"schema":{"type":"string"},"in":"path","name":"versionId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/versions/{versionId}/download":{"get":{"summary":"Get a presigned download URL for a past version","tags":["Files"],"description":"Returns a short-lived signed URL that serves the archived payload of a specific version. Only the file owner can download past versions.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true},{"schema":{"type":"string"},"in":"path","name":"versionId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/auth/register":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/auth/verify-email":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/auth/login":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/auth/forgot-password":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/auth/reset-password":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/api-keys":{"post":{"summary":"Create an API key","tags":["API Keys"],"description":"Generates a new programmatic access key. The raw key is returned **once** in the response and cannot be retrieved again. Requires Creator or Business plan.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"get":{"summary":"List my API keys","tags":["API Keys"],"description":"Returns all keys belonging to the authenticated user, including revoked ones.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api-keys/{id}":{"delete":{"summary":"Revoke an API key","tags":["API Keys"],"description":"Immediately revokes the key — any subsequent request presenting it will fail with 401.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/premium/assets":{"post":{"summary":"Mark a file as a premium asset (admin scope)","tags":["Premium"],"description":"Flips `isPremium=true` on a file you own and optionally sets a maximum download count. Premium files can only be downloaded via a signed, single-use token from `/premium/generate-link`. Requires the `admin` scope on your API key.","security":[{"apiKey":[]}],"responses":{"200":{"description":"Default Response"}}}},"/premium/generate-link":{"post":{"summary":"Generate a single-use download token (admin scope)","tags":["Premium"],"description":"Returns a JWT valid for 4 hours that a recipient can redeem exactly once via `GET /premium/redeem/:token`. Enforces `maxDownloads` set on the asset. Requires the `admin` scope on your API key.","security":[{"apiKey":[]}],"responses":{"200":{"description":"Default Response"}}}},"/premium/redeem/{token}":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/deep-scan":{"post":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/guest":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/me":{"get":{"summary":"Current user profile","tags":["User"],"security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"patch":{"summary":"Update display name","tags":["User"],"security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"delete":{"responses":{"200":{"description":"Default Response"}}}},"/me/stats":{"get":{"summary":"Usage summary (files, folders, storage, downloads)","tags":["User"],"security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/me/stats/timeseries":{"get":{"summary":"Daily uploads / downloads / bytes over N days","tags":["User"],"security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/me/password":{"patch":{"responses":{"200":{"description":"Default Response"}}}},"/me/resend-verification":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/me/upgrade":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/me/reset-token":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/me/files":{"get":{"summary":"List the caller's files (optionally filtered by folder)","tags":["Files"],"security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/unsubscribe/{token}":{"post":{"summary":"Opt out of marketing emails (one-click)","tags":["User"],"description":"Flips the user's `marketingEmailsOptOut` flag. Transactional mail (password reset, webhook alerts) still delivers. Safe to call twice.","parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/team":{"get":{"summary":"Get the caller's team workspace","tags":["User"],"description":"Returns the team the caller belongs to, including pooled members and pending invites. Solo users get null.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Create a team workspace","tags":["User"],"description":"Creates a Business team workspace owned by the caller. Only one team per owner. BUSINESS plan required.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"delete":{"summary":"Delete your team workspace","tags":["User"],"description":"Owner-only. All members are detached; their files stay with them.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/team/invites":{"post":{"summary":"Invite a teammate by email","tags":["User"],"description":"Sends an invitation email with a 7-day accept link. Owner-only. Pending invites count against the seat cap.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/team/invites/{id}":{"delete":{"summary":"Revoke a pending invite","tags":["User"],"security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/team/accept/{token}":{"post":{"summary":"Accept a team invite","tags":["User"],"description":"Session-authenticated callers only. Attaches the caller to the team. Consumes the invite so the link can't be reused.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/team/members/{userId}":{"delete":{"summary":"Remove a teammate","tags":["User"],"security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/team/leave":{"post":{"summary":"Leave your team","tags":["User"],"description":"Members only. Owners must delete the team instead.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/team/transfer-ownership":{"post":{"summary":"Transfer team ownership to a member","tags":["User"],"description":"Hand the unique owner slot to an existing seated member. The previous owner stays on the team as a regular member. If the new owner isn't on a BUSINESS plan, the team silently loses BUSINESS perks — pool logic falls back to each member's personal tier.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/affiliate":{"get":{"summary":"Affiliate dashboard snapshot","tags":["User"],"description":"Returns the caller's affiliate code (if enrolled), cumulative earnings by status, number of referred users, and the last 100 earning rows. Also reports the platform commission rate and payout minimum.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/affiliate/enable":{"post":{"summary":"Enroll in the affiliate program","tags":["User"],"description":"Lazily generates a unique referral code for the caller and returns it. Subsequent calls return the same code. Guest accounts are rejected — sign up first.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/affiliate/payout-request":{"post":{"summary":"Request a payout for pending earnings","tags":["User"],"description":"Marks every PENDING earning for the caller as REQUESTED. An operator ships the payout manually and flips the rows to PAID. Requires the cumulative pending amount to meet the configured minimum.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/folders":{"post":{"responses":{"200":{"description":"Default Response"}}},"get":{"responses":{"200":{"description":"Default Response"}}}},"/folders/{id}":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}},"patch":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/folders/{id}/visibility":{"patch":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/files/{fileId}/move":{"patch":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"fileId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/folders/{id}/download":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/f/{shareId}":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/folders/{id}/share":{"post":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/batch/delete":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/batch/move":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/batch/visibility":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/webhooks":{"post":{"responses":{"200":{"description":"Default Response"}}},"get":{"responses":{"200":{"description":"Default Response"}}}},"/webhooks/{id}":{"patch":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}},"delete":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/webhooks/{id}/deliveries":{"get":{"summary":"List recent webhook delivery attempts","tags":["Webhooks"],"description":"Returns the last 50 delivery attempts (successes and failures) for a webhook. Each row includes HTTP status, duration, truncated response body, and error message where applicable.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/webhooks/{id}/deliveries/{deliveryId}/retry":{"post":{"summary":"Retry a failed webhook delivery","tags":["Webhooks"],"description":"Replays the original payload against the webhook URL. The new attempt is recorded as a fresh WebhookDelivery row so you can see both the original failure and the retry outcome.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"deliveryId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/webhooks/{id}/test":{"post":{"summary":"Send a test ping to verify the webhook URL works","tags":["Webhooks"],"description":"Dispatches a synthetic `FILE_UPLOADED` event so you can confirm the consumer is reachable and authorized. The attempt shows up in the delivery log tagged with X-Drupload-Test: 1.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/me/download-stats":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/me/analytics/access":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/me/analytics/overview":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/files/{shareId}/analytics":{"get":{"parameters":[{"schema":{"type":"string"},"in":"path","name":"shareId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/me/usage":{"get":{"summary":"Current quota & tier snapshot","tags":["User"],"description":"Returns the caller's storage, rolling 30-day traffic, file count and rate-limit ceiling — all in a single call. Works with either an API key or a session token.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/2fa/setup":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/2fa/verify":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/2fa/disable":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/2fa/status":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/payments/plans":{"get":{"summary":"List subscription plans and available cryptocurrencies","tags":["Payments"],"description":"Public endpoint — returns every tier configuration and the first 15 accepted crypto currencies. Used by the pricing page.","responses":{"200":{"description":"Default Response"}}}},"/payments/create":{"post":{"summary":"Start a crypto checkout","tags":["Payments"],"description":"Creates a NowPayments payment intent for the specified tier and billing cycle. Returns the pay address and crypto amount. Poll /payments/status/:id to watch it finish.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/payments/status/{id}":{"get":{"summary":"Poll a payment's status","tags":["Payments"],"description":"Checks both our database and NowPayments for the latest status. Auto-finalises payments that expired locally without completing so the UI doesn't hang on 'waiting' forever.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/payments/{id}/cancel":{"post":{"summary":"Cancel a pending payment","tags":["Payments"],"description":"Flips a WAITING or CONFIRMING payment to FAILED locally so the UI can offer a fresh checkout. NowPayments invoices expire on their own — cancellation here is purely our-side bookkeeping.","security":[{"apiKey":[]},{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/payments/history":{"get":{"summary":"List the caller's recent payments","tags":["Payments"],"description":"Last 20 payments, newest first.","security":[{"apiKey":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/auth/discord":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/auth/discord/start":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/auth/discord/callback":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/auth/discord/2fa":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/auth/discord/link":{"post":{"responses":{"200":{"description":"Default Response"}}},"delete":{"responses":{"200":{"description":"Default Response"}}}}},"servers":[{"url":"https://drupload.net/api/v1","description":"Production (v1)"},{"url":"http://localhost:3001/v1","description":"Local dev (v1)"}],"tags":[{"name":"Files","description":"Metadata, downloads, deletion, visibility"},{"name":"Upload","description":"Multipart and single-part uploads"},{"name":"Folders","description":"Hierarchical organization"},{"name":"Batch","description":"Bulk operations on files"},{"name":"Premium","description":"Token-gated downloads and premium assets"},{"name":"Analytics","description":"Per-file and aggregate download analytics (Creator+)"},{"name":"Webhooks","description":"Event subscriptions"},{"name":"API Keys","description":"Manage your programmatic access keys"},{"name":"User","description":"Current user profile, stats, quotas"},{"name":"Auth","description":"Login, register, 2FA, password reset"},{"name":"Payments","description":"NowPayments crypto subscription flow"},{"name":"Admin","description":"Platform administration (ADMIN role only)"}]}