Documentation Index
Fetch the complete documentation index at: https://docs.nulldrop.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Installation
npm i @nulldrop/sdk
# or
yarn add @nulldrop/sdk
Quick start
import { NullDropClient } from '@nulldrop/sdk'
const client = new NullDropClient({ apiKey: process.env.NULLDROP_API_KEY! })
// upload
const fileInput = document.querySelector('input[type=file]') as HTMLInputElement
const uploaded = await client.upload(fileInput.files![0])
console.log(uploaded.id, uploaded.downloadUrl)
// list
const list = await client.listFiles({ page: 1, limit: 10 })
// get
const details = await client.getFile(uploaded.id)
// delete
await client.deleteFile(uploaded.id)
Configuration
new NullDropClient({
apiKey: 'nd_...', // required (falls back to env NULLDROP_API_KEY)
baseUrl: 'https://nulldrop.xyz', // optional (default)
apiVersion: 'v1', // optional (default v1)
timeout: 15000, // ms, optional
retryAttempts: 3, // optional
debug: false // SDK logs, optional
})
API
upload(file: File): Promise<FluentUploadResult> – uploads a file (multipart/form-data; field file), returns id, downloadUrl, shareUrl, uploadedAt, etc.
listFiles({ page?, limit? })
getFile(id: string)
deleteFile(id: string)
getDownloadUrl(id: string)
getShareUrl(id: string)
getFileCount()
Types (short)
type UploadResponse = {
success: boolean
data: {
id: string
filename: string
size: number
mimeType: string
downloadUrl: string
shareUrl: string
uploadedAt: string
}
}
Errors & rate limits
- Limit headers:
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.
- Common error codes:
UNAUTHORIZED, RATE_LIMITED, NO_FILE, INVALID_FILE_TYPE, FILE_TOO_LARGE, STORAGE_LIMIT_EXCEEDED.
REST API examples
See the REST API details (OpenAPI, cURL/JS examples).