Internal ClientSwing backend API — auth via X-Api-Key header
Full interactive docs at /docs • OpenAPI JSON at /openapi.json
| Method | Path | Description |
|---|---|---|
| GET | /health | Liveness check — no auth required |
| Method | Path | Description |
|---|---|---|
| GET | /ghl/token | Read token from DB (company_id, opt location_id, opt token_type) |
| POST | /ghl/tokens/refresh | Refresh one token (company_id, opt location_id); falls back to agency mint → 202 |
| POST | /ghl/tokens/refresh-all | Refresh all ~172 location tokens (company_id) → 202 |
| POST | /ghl/tokens/mint | Agency-mint a location token (company_id, location_id) → 202 |
| Method | Path | Description |
|---|---|---|
| GET | /ghl/locations | List all locations for a company (company_id) |
| GET | /ghl/location | Single location (company_id + location_id or location_name) |
| POST | /ghl/locations/sync | Sync location metadata from GHL API (company_id) → 202 |
| Method | Path | Description |
|---|---|---|
| GET | /ghl/media/files | List files/folders (location_id, opt type, query, limit, parent_id, fetch_all) |
| POST | /ghl/media/upload | Import URL into media library → {"fileId", "url"} (location_id, url, name, opt parent_id) |
| DELETE | /ghl/media/file | Delete a file (location_id, file_id) |
| PUT | /ghl/media/file | Rename a file (location_id, file_id, name) |
| POST | /ghl/media/folder | Create a folder (location_id, name, opt parent_id) |
| PUT | /ghl/media/bulk-rename | Rename many files (location_id, body: [{"id","name"}]) |
| PUT | /ghl/media/bulk-delete | Trash / restore / delete many (location_id, body: ["id1",...], opt status_action) |
| Method | Path | Description |
|---|---|---|
| GET | /ghl/custom-values | Live read-through of all custom values (location_id) → {customValues: [{id, name, key, value, folder}]} |
| GET | /ghl/custom-value | Fetch a single custom value (location_id, custom_value_id) → {customValue} |
| POST | /ghl/custom-values | Create a custom value (body: {location_id, name, value}) → {customValue} |
| POST | /ghl/custom-values/bulk-upsert | Create/update multiple custom values (body: {location_id, items: [{name, value}]}) → {created, updated, errors} |
| POST | /ghl/custom-values/bulk-upsert-async | Enqueue throttled bulk upsert (body: {location_id, items: [{name, value}]}) → 202 {batch_id} |
| POST | /ghl/custom-values/bulk-delete-async | Enqueue 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-value | Update a custom value (body: {location_id, custom_value_id, value, name?}) → {customValue} |
| DELETE | /ghl/custom-value | Delete a custom value (location_id, custom_value_id) |
| Method | Path | Description |
|---|---|---|
| POST | /runware/generate | Generate image + optionally upload to GHL → {runware_url[, file_id, ghl_url]} (prompt, name, opt location_id, model, width, height, negative_prompt, seed) |
| Method | Path | Description |
|---|---|---|
| POST | /openai/text | Generate text → {"text"} (prompt, opt system_prompt, model, max_tokens, temperature) |
| POST | /openai/image | Generate image + optionally upload to GHL → {model, openai_url[, file_id, ghl_url]} (prompt, name, opt location_id, model, size, quality, output_format, style, background) |
| Method | Path | Description |
|---|---|---|
| GET | /executions | List recent job runs (opt limit, default 50) |
| GET | /executions/{id} | Full execution detail + captured log lines |
| POST | /executions/{id}/cancel | Cancel a running execution (200 cancelling / 409 / 404) |
| Command | Description |
|---|---|
ghl-token | Read OAuth token from DB |
ghl-locations | List location IDs + names from DB |
ghl-location | Full location metadata + token from DB |
ghl-media | Media library operations (list / upload / delete / rename / create-folder) |
runware-generate | Generate an image with Runware and optionally upload it to GHL media library |
openai-generate text | Generate text with OpenAI (gpt-4o-mini, gpt-4o, …) |
openai-generate image | Generate an image with OpenAI and optionally upload to GHL (gpt-image-1, dall-e-3, dall-e-2) |