Docs · POST /directory
Reference · Directories

POST/directory

Creates a directory. A directory holds a task’s inputs and outputs, and is deleted with everything in it when its ttl runs out. You don’t have to create one: POST /file without a dir_id makes one for you.

Request body

Request body
ttlnumberHow long the directory lives, in seconds. 86400 (24 hours) when left out; a longer value than 604800 (7 days) is brought down to that.

The body may be left out altogether, or be {}.

Example

Request
curl https://media.logicboostkit.com/directory \
  -H "Authorization: Basic $MEDIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "ttl": 3600 }'
Response
HTTP/1.1 200 OK
X-Request-Id: job_0mv6img4ztlm392wz8t7f205

{
  "ok": true,
  "directory": {
    "id": "dir_m8papv92jrn8rx6186g8",
    "ttl": 3600
  }
}

Response fields

Response fields
okbooleantrue when the directory was created.
directory.idstringThe directory’s id: dir_ and 20 lower-case letters and digits.
directory.ttlnumberIts lifetime in seconds, as applied.

Status codes

Status codes
200The directory exists. Not charged.
400The body isn’t a JSON object, or ttl isn’t a positive number.
401The Authorization header is missing, or the key is invalid, revoked or expired.
403The account isn’t active. The error says what to do.
429More than 300 requests in a minute on this key. Wait for the number of seconds in Retry-After.

Every error has the shape {"ok": false, "error": "…"} and is never charged.