Skip to content
Developers
Open app

Create a folder

POST
/v1/folders
const url = 'https://api.focal.inc/v1/folders';
const options = {
method: 'POST',
headers: {
'Idempotency-Key': 'looker-sync-2027-03-04-0001',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: '{"space_id":"6916bc3d-e1ab-425b-ac25-eefada01a9a2","name":"Spring 2027","parent_id":"eec32c6e-5ea9-4ea0-a34d-94363d51ba0b"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}

Create a folder in a space’s media library — at the top level, or inside an existing folder via parent_id (which must be a live folder in the same space). Returns the created folder.

Required scope: media:write. Rate-limit cost: 10. An Idempotency-Key header is required.

Idempotency-Key
required
string
<= 255 characters

Example

looker-sync-2027-03-04-0001

Client-generated key (≤255 chars) for safe retries. A retry with the same key replays the original response instead of re-applying the write; reusing a key with a different body → 400, an in-flight key → 409. Required on POST; optional on PATCH/DELETE. A UUID v4 is recommended — generate one per logical write and reuse it only for retries of that write.

Media typeapplication/json
object
space_id
required

The space to create the folder in.

string format: uuid

Example

6916bc3d-e1ab-425b-ac25-eefada01a9a2
name
required

Display name of the folder. 1–255 characters.

string
>= 1 characters <= 255 characters

Example

Spring 2027
parent_id

Id of an existing folder in the same space to create the folder inside; omit (or pass null) for a top-level folder.

string format: uuid
nullable

Example

eec32c6e-5ea9-4ea0-a34d-94363d51ba0b

Created

Media typeapplication/json
object
data
required
object
kind
required
string
Allowed values: folder
id
required
string format: uuid
name
required
string
parent_id
required

Parent folder id; null for a top-level (root) folder.

string format: uuid
nullable
space_id
required
string format: uuid
total_media_count
required

Number of media in this folder and all its descendants (archived excluded).

integer
organization_id
required
string format: uuid
created_at
required
string format: date-time
updated_at
required
string format: date-time
html_url
required

Browser URL that opens this folder in the Focal web app’s library. Hand this to users as a clickable link.

string

Example

{
"data": {
"kind": "folder",
"id": "80539d38-3a8e-48f8-929b-8c0e9a22ab43",
"name": "Spring 2027",
"parent_id": "eec32c6e-5ea9-4ea0-a34d-94363d51ba0b",
"space_id": "6916bc3d-e1ab-425b-ac25-eefada01a9a2",
"total_media_count": 14,
"organization_id": "b46d9033-24b2-4441-87ad-2151088fde01",
"created_at": "2027-03-04T10:15:00Z",
"updated_at": "2027-03-06T14:42:00Z",
"html_url": "https://app.focal.inc/spaces/6916bc3d-e1ab-425b-ac25-eefada01a9a2/library?folder=80539d38-3a8e-48f8-929b-8c0e9a22ab43"
}
}

The request was malformed (invalid cursor, unknown type, validation failure, etc.). error.code is bad_request.

Media typeapplication/json

Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.

object
error
required
object
code
required
string
Allowed values: unauthenticated forbidden not_found bad_request conflict rate_limited internal_error
message
required
string
details
Array<object>
object
field
string
issue
required
string

Example

{
"error": {
"code": "bad_request",
"message": "Invalid request body",
"details": [
{
"field": "space_id",
"issue": "Invalid UUID"
}
]
}
}

Missing, invalid, or disabled token. error.code is unauthenticated.

Media typeapplication/json

Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.

object
error
required
object
code
required
string
Allowed values: unauthenticated forbidden not_found bad_request conflict rate_limited internal_error
message
required
string
details
Array<object>
object
field
string
issue
required
string

Example

{
"error": {
"code": "unauthenticated",
"message": "Bearer token is missing or invalid"
}
}

The token doesn’t have the scope this endpoint requires. error.code is forbidden.

Media typeapplication/json

Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.

object
error
required
object
code
required
string
Allowed values: unauthenticated forbidden not_found bad_request conflict rate_limited internal_error
message
required
string
details
Array<object>
object
field
string
issue
required
string

Example

{
"error": {
"code": "forbidden",
"message": "Token doesn't have the required scope"
}
}

Resource doesn’t exist or is outside the token’s space allow-list. The two cases share a response shape so a restricted token can’t probe for the existence of out-of-scope spaces. error.code is not_found.

Media typeapplication/json

Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.

object
error
required
object
code
required
string
Allowed values: unauthenticated forbidden not_found bad_request conflict rate_limited internal_error
message
required
string
details
Array<object>
object
field
string
issue
required
string

Example

{
"error": {
"code": "not_found",
"message": "Not found"
}
}

The request conflicts with the current state. Most commonly a concurrent request carrying the same Idempotency-Key is still in flight. error.code is conflict.

Media typeapplication/json

Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.

object
error
required
object
code
required
string
Allowed values: unauthenticated forbidden not_found bad_request conflict rate_limited internal_error
message
required
string
details
Array<object>
object
field
string
issue
required
string

Example

{
"error": {
"code": "conflict",
"message": "A request with this Idempotency-Key is already being processed"
}
}

Rate limit exceeded. error.code is rate_limited. Wait the number of seconds in the Retry-After header before retrying. Quotas are per-token; see the “Rate limiting” section at the top of this document.

Media typeapplication/json

Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.

object
error
required
object
code
required
string
Allowed values: unauthenticated forbidden not_found bad_request conflict rate_limited internal_error
message
required
string
details
Array<object>
object
field
string
issue
required
string

Example

{
"error": {
"code": "rate_limited",
"message": "Rate limit of 1000 units per 60s exceeded (this request cost 5)"
}
}
Retry-After
integer
Example
12

Seconds to wait before retrying.