Skip to main content
POST
https://{database_hostname}
/
v1
/
upload
curl -X POST 'https://{database_hostname}/v1/upload' \
  -H 'Authorization: Bearer DATABASE_TOKEN' \
  -H 'Content-Length: FILE_SIZE' \
  --data-binary '@/path/to/database.db'
Upload a SQLite database file to a database created with seed.type = "database_upload".
This endpoint is on the database hostname (e.g., my-db-my-org.turso.io), not api.turso.tech.
You must first create a database with seed.type = "database_upload".
This endpoint requires a database token, not a platform API token. You can create a database token after creating the database.

Headers

HeaderRequiredDescription
AuthorizationYesBearer token for the database
Content-LengthYesSize of the database file in bytes
x-turso-encryption-keyNoBase64-encoded encryption key (32 bytes for 256-bit ciphers, 16 bytes for 128-bit ciphers)
x-turso-encryption-cipherNoEncryption cipher. See table below for options.

Request Body

The raw binary SQLite database file.

Database File Requirements

The SQLite database file must meet these requirements:
  • Journal mode: WAL (PRAGMA journal_mode = WAL)
  • Page size: 4096 bytes (PRAGMA page_size = 4096)
  • Auto vacuum: Disabled (PRAGMA auto_vacuum = 0)
  • Encoding: UTF-8 (PRAGMA encoding = 'UTF-8')
For encrypted databases, you must also set the reserved bytes to match the cipher:
CipherReserved Bytes
aes256gcm28
aes128gcm28
chacha20poly130528
aegis128l32
aegis128x232
aegis128x432
aegis25648
aegis256x248
aegis256x448

Responses

Success

Returns an empty response with status 200 OK on success.

Errors

StatusDescription
400Invalid database file (wrong format, settings, or corruption)
401Invalid or missing authorization token
curl -X POST 'https://{database_hostname}/v1/upload' \
  -H 'Authorization: Bearer DATABASE_TOKEN' \
  -H 'Content-Length: FILE_SIZE' \
  --data-binary '@/path/to/database.db'