Create an attribute
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");curl_easy_setopt(hnd, CURLOPT_URL, "https://api.focal.inc/v1/media-attributes");
struct curl_slist *headers = NULL;headers = curl_slist_append(headers, "Idempotency-Key: looker-sync-2027-03-04-0001");headers = curl_slist_append(headers, "Authorization: Bearer <token>");headers = curl_slist_append(headers, "Content-Type: application/json");curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"space_id\": \"6916bc3d-e1ab-425b-ac25-eefada01a9a2\", \"name\": \"Campaign\", \"type\": \"text\", \"multiple\": true, \"hide_from_guests\": false, \"options\": [ { \"name\": \"Spring Launch\", \"description\": \"Assets for the Spring 2027 launch campaign.\" } ], \"allow_create\": false, \"show_in_library\": true, \"autofill\": { \"prompt\": \"Pick the campaign this asset belongs to, based on its content and filename.\", \"allowed_media_types\": [ \"videos\" ], \"name_only\": false } }");
CURLcode ret = curl_easy_perform(hnd);using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://api.focal.inc/v1/media-attributes"), Headers = { { "Idempotency-Key", "looker-sync-2027-03-04-0001" }, { "Authorization", "Bearer <token>" }, }, Content = new StringContent("{ \"space_id\": \"6916bc3d-e1ab-425b-ac25-eefada01a9a2\", \"name\": \"Campaign\", \"type\": \"text\", \"multiple\": true, \"hide_from_guests\": false, \"options\": [ { \"name\": \"Spring Launch\", \"description\": \"Assets for the Spring 2027 launch campaign.\" } ], \"allow_create\": false, \"show_in_library\": true, \"autofill\": { \"prompt\": \"Pick the campaign this asset belongs to, based on its content and filename.\", \"allowed_media_types\": [ \"videos\" ], \"name_only\": false } }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.focal.inc/v1/media-attributes"
payload := strings.NewReader("{ \"space_id\": \"6916bc3d-e1ab-425b-ac25-eefada01a9a2\", \"name\": \"Campaign\", \"type\": \"text\", \"multiple\": true, \"hide_from_guests\": false, \"options\": [ { \"name\": \"Spring Launch\", \"description\": \"Assets for the Spring 2027 launch campaign.\" } ], \"allow_create\": false, \"show_in_library\": true, \"autofill\": { \"prompt\": \"Pick the campaign this asset belongs to, based on its content and filename.\", \"allowed_media_types\": [ \"videos\" ], \"name_only\": false } }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "looker-sync-2027-03-04-0001") req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.focal.inc/v1/media-attributes")) .header("Idempotency-Key", "looker-sync-2027-03-04-0001") .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{ \"space_id\": \"6916bc3d-e1ab-425b-ac25-eefada01a9a2\", \"name\": \"Campaign\", \"type\": \"text\", \"multiple\": true, \"hide_from_guests\": false, \"options\": [ { \"name\": \"Spring Launch\", \"description\": \"Assets for the Spring 2027 launch campaign.\" } ], \"allow_create\": false, \"show_in_library\": true, \"autofill\": { \"prompt\": \"Pick the campaign this asset belongs to, based on its content and filename.\", \"allowed_media_types\": [ \"videos\" ], \"name_only\": false } }")) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{ \"space_id\": \"6916bc3d-e1ab-425b-ac25-eefada01a9a2\", \"name\": \"Campaign\", \"type\": \"text\", \"multiple\": true, \"hide_from_guests\": false, \"options\": [ { \"name\": \"Spring Launch\", \"description\": \"Assets for the Spring 2027 launch campaign.\" } ], \"allow_create\": false, \"show_in_library\": true, \"autofill\": { \"prompt\": \"Pick the campaign this asset belongs to, based on its content and filename.\", \"allowed_media_types\": [ \"videos\" ], \"name_only\": false } }");Request request = new Request.Builder() .url("https://api.focal.inc/v1/media-attributes") .post(body) .addHeader("Idempotency-Key", "looker-sync-2027-03-04-0001") .addHeader("Authorization", "Bearer <token>") .addHeader("Content-Type", "application/json") .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = { method: 'POST', url: 'https://api.focal.inc/v1/media-attributes', headers: { 'Idempotency-Key': 'looker-sync-2027-03-04-0001', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, data: { space_id: '6916bc3d-e1ab-425b-ac25-eefada01a9a2', name: 'Campaign', type: 'text', multiple: true, hide_from_guests: false, options: [ { name: 'Spring Launch', description: 'Assets for the Spring 2027 launch campaign.' } ], allow_create: false, show_in_library: true, autofill: { prompt: 'Pick the campaign this asset belongs to, based on its content and filename.', allowed_media_types: ['videos'], name_only: false } }};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.focal.inc/v1/media-attributes';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":"Campaign","type":"text","multiple":true,"hide_from_guests":false,"options":[{"name":"Spring Launch","description":"Assets for the Spring 2027 launch campaign."}],"allow_create":false,"show_in_library":true,"autofill":{"prompt":"Pick the campaign this asset belongs to, based on its content and filename.","allowed_media_types":["videos"],"name_only":false}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")val body = RequestBody.create(mediaType, "{ \"space_id\": \"6916bc3d-e1ab-425b-ac25-eefada01a9a2\", \"name\": \"Campaign\", \"type\": \"text\", \"multiple\": true, \"hide_from_guests\": false, \"options\": [ { \"name\": \"Spring Launch\", \"description\": \"Assets for the Spring 2027 launch campaign.\" } ], \"allow_create\": false, \"show_in_library\": true, \"autofill\": { \"prompt\": \"Pick the campaign this asset belongs to, based on its content and filename.\", \"allowed_media_types\": [ \"videos\" ], \"name_only\": false } }")val request = Request.Builder() .url("https://api.focal.inc/v1/media-attributes") .post(body) .addHeader("Idempotency-Key", "looker-sync-2027-03-04-0001") .addHeader("Authorization", "Bearer <token>") .addHeader("Content-Type", "application/json") .build()
val response = client.newCall(request).execute()use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "https://api.focal.inc/v1/media-attributes";
let payload = json!({ "space_id": "6916bc3d-e1ab-425b-ac25-eefada01a9a2", "name": "Campaign", "type": "text", "multiple": true, "hide_from_guests": false, "options": ( json!({ "name": "Spring Launch", "description": "Assets for the Spring 2027 launch campaign." }) ), "allow_create": false, "show_in_library": true, "autofill": json!({ "prompt": "Pick the campaign this asset belongs to, based on its content and filename.", "allowed_media_types": ("videos"), "name_only": false }) });
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Idempotency-Key", "looker-sync-2027-03-04-0001".parse().unwrap()); headers.insert("Authorization", "Bearer <token>".parse().unwrap()); headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::Client::new(); let response = client.post(url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request POST \ --url https://api.focal.inc/v1/media-attributes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: looker-sync-2027-03-04-0001' \ --data '{ "space_id": "6916bc3d-e1ab-425b-ac25-eefada01a9a2", "name": "Campaign", "type": "text", "multiple": true, "hide_from_guests": false, "options": [ { "name": "Spring Launch", "description": "Assets for the Spring 2027 launch campaign." } ], "allow_create": false, "show_in_library": true, "autofill": { "prompt": "Pick the campaign this asset belongs to, based on its content and filename.", "allowed_media_types": [ "videos" ], "name_only": false } }'wget --quiet \ --method POST \ --header 'Idempotency-Key: looker-sync-2027-03-04-0001' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --body-data '{ "space_id": "6916bc3d-e1ab-425b-ac25-eefada01a9a2", "name": "Campaign", "type": "text", "multiple": true, "hide_from_guests": false, "options": [ { "name": "Spring Launch", "description": "Assets for the Spring 2027 launch campaign." } ], "allow_create": false, "show_in_library": true, "autofill": { "prompt": "Pick the campaign this asset belongs to, based on its content and filename.", "allowed_media_types": [ "videos" ], "name_only": false } }' \ --output-document \ - https://api.focal.inc/v1/media-attributesAdd a custom field to a space’s media library. The type is fixed at creation (stored values are encoded per type); tags fields can be seeded with options, and every option’s id is returned so you can write values against it immediately.
Creatable types: text, number, tags, checkbox, date, link, user.
Required scope: spaces:write — the scope for a space’s own settings, deliberately separate from media:write (which writes attribute values), because reconfiguring a field reaches every media in the space.
The scope alone is not the gate. When the credential acts for a specific user (an MCP connector grant), that user must also be an organization admin or an owner of the space, or the call is rejected with 403. API tokens are exempt from that check, since only an organization admin can create one. The matching MCP tool is additionally advertised as destructive and non-idempotent, so connector hosts ask the user before each call. Rate-limit cost: 10. Requires an Idempotency-Key.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Example
looker-sync-2027-03-04-0001Client-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.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The space whose media library gets the new field.
Example
6916bc3d-e1ab-425b-ac25-eefada01a9a2Display name of the field. 1–255 characters.
Example
CampaignThe kind of field to create. Cannot be changed afterwards — stored values are encoded per type — so create a new field instead of retyping one.
Whether the field holds multiple values per media. Only tags and user fields can (400 on any other type). Switching a populated field from multiple to single is destructive — every cell keeps only its first value, across the whole space.
Example
trueHide this field from Guest users in the media player.
Example
falseInitial options, in display order. tags fields only (400 on any other type); each option’s id is generated and returned. At most 499 options per field.
object
The option’s label. Must be unique within the field (case-insensitive).
Example
Spring LaunchHelp text shown next to the option in Focal when picking tags. At most 500 characters; send an empty string to clear it.
Example
Assets for the Spring 2027 launch campaign.Whether new options may be added to this field ad hoc — both while tagging in the app and via POST /v1/media-attributes/{id}/options on the media:write scope alone. When this is false, that call needs spaces:write (plus admin/owner for a connector) instead of being rejected outright. Defaults to false on create, matching the app. tags fields only.
Example
falseSurface this field’s options as clickable suggestions in media library search. tags fields only.
Example
trueAI autofill for this field — an object to configure it, null to turn it off. text and tags fields only (400 on any other type). Enabling it requires a prompt, either in this call or already stored. Turning it on makes the AI write values across the space’s media, so treat it as a change with reach.
object
The instruction the AI follows when filling this field — e.g. “the primary call to action in this ad”. Required: autofill enabled with no instruction never runs, so this API won’t create that state (the app allows it mid-edit). Rich prompts written in the app may @mention other fields; those read back flattened to @Label text, and writing a plain string replaces the rich content. At most 4000 chars.
Example
Pick the campaign this asset belongs to, based on its content and filename.Restrict autofill to these media kinds. null (the default) runs it on everything. Use this rather than wording the prompt to opt out — a column restricted here is never queued for the wrong kind of media in the first place.
Example
[ "videos"]When true the AI sees only the media’s filename — no visual analysis, transcript, or metadata. Much cheaper and faster, and the right choice when the answer is encoded in a naming convention.
Example
falseResponses
Section titled “Responses”Created
object
object
The attribute definition id — referenced by media payloads as attributes[].attribute_id.
Display name of the field, as media payloads carry in attributes[].attribute_name.
The field’s kind — same enum as attributes[].attribute_type on media payloads. tags fields carry selectable options; fetch them via GET /v1/media-attributes/{id}. user fields hold user ids — resolve them via GET /v1/users.
Whether the field holds multiple values per media (e.g. multi-select). Mirrors attributes[].multiple.
For tags fields, the selectable options in display order. null for field types that have no options concept.
object
Stable option id — the value media payloads carry in attributes[].value for this option. Option renames keep this id; match on it rather than on name when tracking options over time.
Human-readable option label. This is the string media payloads carry in attributes[].display_value for this option.
The option’s help text, shown next to it in Focal when picking tags — what this option means, or when to use it. Empty string when unset; never null, so it’s safe to render directly. Not carried on media payloads, which reference the option by id/display_value only.
The field’s AI autofill configuration, or null when autofill is off — which is also what field types that can’t autofill (everything but text and tags) always report. For a tags field the model is additionally given each option’s name and description, so option descriptions act as per-option guidance on top of this instruction.
object
The instruction the AI follows, as plain text. A prompt written in the app with @mentions of other fields is flattened to @Label here.
The media kinds this runs on, or null for all of them.
Whether the AI sees only the filename rather than analyzing the media itself.
Example
{ "data": { "id": "846196ad-9fa2-40a8-8938-655a962220e1", "name": "Campaign", "type": "text", "multiple": true, "space_id": "6916bc3d-e1ab-425b-ac25-eefada01a9a2", "organization_id": "b46d9033-24b2-4441-87ad-2151088fde01", "created_at": "2027-03-04T10:15:00Z", "updated_at": "2027-03-06T14:42:00Z", "options": [ { "id": "80f1e4d3-cbab-42a0-a397-318f348f5f93", "name": "Spring Launch", "description": "Assets for the Spring 2027 launch campaign." } ], "autofill": { "prompt": "Pick the campaign this asset belongs to, based on its content and filename.", "allowed_media_types": [ "videos" ], "name_only": false } }}The request was malformed (invalid cursor, unknown type, validation failure, etc.). error.code is bad_request.
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
object
object
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.
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
object
object
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.
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
object
object
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.
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
object
object
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.
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
object
object
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.
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
object
object
Example
{ "error": { "code": "rate_limited", "message": "Rate limit of 1000 units per 60s exceeded (this request cost 5)" }}Headers
Section titled “Headers”Example
12Seconds to wait before retrying.