clsw-api

Internal ClientSwing backend API — auth via X-Api-Key header

Full interactive docs at /docs  •  OpenAPI JSON at /openapi.json

Health

MethodPathDescription
GET/healthLiveness check — no auth required

GHL — Tokens

MethodPathDescription
GET/ghl/tokenRead token from DB (company_id, opt location_id, opt token_type)
POST/ghl/tokens/refreshRefresh one token (company_id, opt location_id); falls back to agency mint → 202
POST/ghl/tokens/refresh-allRefresh all ~172 location tokens (company_id) → 202
POST/ghl/tokens/mintAgency-mint a location token (company_id, location_id) → 202

GHL — Locations

MethodPathDescription
GET/ghl/locationsList all locations for a company (company_id)
GET/ghl/locationSingle location (company_id + location_id or location_name)
POST/ghl/locations/syncSync location metadata from GHL API (company_id) → 202

GHL — Media library

MethodPathDescription
GET/ghl/media/filesList files/folders (location_id, opt type, query, limit, parent_id, fetch_all)
POST/ghl/media/uploadImport URL into media library → {"fileId", "url"} (location_id, url, name, opt parent_id)
DELETE/ghl/media/fileDelete a file (location_id, file_id)
PUT/ghl/media/fileRename a file (location_id, file_id, name)
POST/ghl/media/folderCreate a folder (location_id, name, opt parent_id)
PUT/ghl/media/bulk-renameRename many files (location_id, body: [{"id","name"}])
PUT/ghl/media/bulk-deleteTrash / restore / delete many (location_id, body: ["id1",...], opt status_action)

GHL — Custom values

MethodPathDescription
GET/ghl/custom-valuesLive read-through of all custom values (location_id) → {customValues: [{id, name, key, value, folder}]}
GET/ghl/custom-valueFetch a single custom value (location_id, custom_value_id) → {customValue}
POST/ghl/custom-valuesCreate a custom value (body: {location_id, name, value}) → {customValue}
POST/ghl/custom-values/bulk-upsertCreate/update multiple custom values (body: {location_id, items: [{name, value}]}) → {created, updated, errors}
POST/ghl/custom-values/bulk-upsert-asyncEnqueue throttled bulk upsert (body: {location_id, items: [{name, value}]}) → 202 {batch_id}
POST/ghl/custom-values/bulk-delete-asyncEnqueue throttled bulk delete (body: {location_id, custom_value_ids: [str]}) → 202 {batch_id}
GET/ghl/custom-values/batches/{batch_id}Poll async batch status → batch record (404 if not found)
PUT/ghl/custom-valueUpdate a custom value (body: {location_id, custom_value_id, value, name?}) → {customValue}
DELETE/ghl/custom-valueDelete a custom value (location_id, custom_value_id)

Runware — AI image generation

MethodPathDescription
POST/runware/generateGenerate image + optionally upload to GHL → {runware_url[, file_id, ghl_url]} (prompt, name, opt location_id, model, width, height, negative_prompt, seed)

OpenAI — text + image generation

MethodPathDescription
POST/openai/textGenerate text → {"text"} (prompt, opt system_prompt, model, max_tokens, temperature)
POST/openai/imageGenerate image + optionally upload to GHL → {model, openai_url[, file_id, ghl_url]} (prompt, name, opt location_id, model, size, quality, output_format, style, background)

Executions

MethodPathDescription
GET/executionsList recent job runs (opt limit, default 50)
GET/executions/{id}Full execution detail + captured log lines
POST/executions/{id}/cancelCancel a running execution (200 cancelling / 409 / 404)

Background jobs (CLI only — not HTTP)

CommandDescription
ghl-tokenRead OAuth token from DB
ghl-locationsList location IDs + names from DB
ghl-locationFull location metadata + token from DB
ghl-mediaMedia library operations (list / upload / delete / rename / create-folder)
runware-generateGenerate an image with Runware and optionally upload it to GHL media library
openai-generate textGenerate text with OpenAI (gpt-4o-mini, gpt-4o, …)
openai-generate imageGenerate an image with OpenAI and optionally upload to GHL (gpt-image-1, dall-e-3, dall-e-2)