Skip to main content
DELETE
/
v1
/
files
Delete file(s) by key(s)
curl --request DELETE \
  --url http://localhost:8787/v1/files \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "keys": [
    "9bbe5ff7-dd84-4af7-a27b-8b6c59855cf4/test/out/example.png",
    "9bbe5ff7-dd84-4af7-a27b-8b6c59855cf4/test/out/example2.jpg"
  ]
}
'
{
  "success": true,
  "results": [
    {
      "key": "9bbe5ff7-dd84-4af7-a27b-8b6c59855cf4/test/out/example.png",
      "deleted": {
        "id": "223e4567-e89b-12d3-a456-426614174001",
        "key": "9bbe5ff7-dd84-4af7-a27b-8b6c59855cf4/test/out/example.png",
        "file_name": "example.png"
      }
    },
    {
      "key": "9bbe5ff7-dd84-4af7-a27b-8b6c59855cf4/test/out/example2.jpg",
      "error": "File not found"
    }
  ],
  "summary": {
    "total": 2,
    "deleted": 1,
    "errors": 1
  }
}

Authorizations

x-api-key
string
header
required

WorkOS API key for authentication

Body

application/json
keys
string[]
required

Array of file keys/paths in storage. Each key must start with a UUID that matches the organization ID.

Minimum array length: 1

File key/path in storage (must start with organization UUID)

Response

Delete operation completed (may include partial success)

success
boolean
required

Indicates if the request was processed

Example:

true

results
object[]
required

Array of results for each key. Each item may be a success object or an error object.

Successful deletion

summary
object
required

Summary of the deletion operation