SocialHub.AI
Developer Center · Open Extensibility

Custom Objects API

A workspace can define its own structured business objects — repair jobs, appointments, complaints — with fields, records, list/form UI and segmentation, all without code. This API lets your integrations read those objects' schemas and read or write their records. The object is defined in-app first; the API works against what already exists.

Step 1 — discover

List object types, then read their schema

Authenticate with a Bearer fl_live_ key holding objects:read. GET /api/v2/objects returns the object types this workspace exposes — only published, API-visible objects are returned; drafts and API-hidden objects never leak. GET /api/v2/objects/{type} returns one object's self-describing field schema (key, type, options, required) so you can render a form or map records without hard-coding anything. An unknown, draft, hidden or cross-workspace type returns 404.

# what object types exist here?
curl https://flash.socialhub.ai/api/v2/objects \
  -H "Authorization: Bearer fl_live_..."
# { "data": [ { "type": "repair_jobs", "label": "Repair Jobs", ... } ] }

# what does one look like?
curl https://flash.socialhub.ai/api/v2/objects/repair_jobs \
  -H "Authorization: Bearer fl_live_..."
# { "data": {
#     "type": "repair_jobs", "label": "Repair Jobs",
#     "fields": [
#       { "key": "cf_status",  "type": "enum", "required": true,
#         "options": ["Received","In Progress","Completed"] },
#       { "key": "cf_item",    "type": "text" },
#       { "key": "member_ref", "type": "member_ref" }
#     ]
# } }
Step 2 — read records

List, filter, sort & paginate

GET /api/v2/objects/{type}/records returns records for an object (scope objects:read). Page with limit (max 200) and offset; order with sortBy (created_desc, created_asc, updated_desc, title_asc); free-text search; filter to a member with memberId; and filter any field with f_<fieldKey>=<value>. A single record is GET /api/v2/objects/{type}/records/{recordId}.

curl "https://flash.socialhub.ai/api/v2/objects/repair_jobs/records\
?f_cf_status=In%20Progress&sortBy=updated_desc&limit=50" \
  -H "Authorization: Bearer fl_live_..."

# { "data": [ { "id": "rec_...", "data": { "cf_status": "In Progress",
#               "cf_item": "Sole replacement", "member_ref": "mbr_..." } } ],
#   "total": 12 }
Step 3 — write records

Create, update & delete

Writes need the objects:write scope. The data object is validated against the object's field schema — required fields, types, enum options and member references are all checked, and unknown keys are rejected. A fail-closed, per-key write-rate guard sits in front of every write, so a leaked key can't flood the table.

# create
curl -X POST https://flash.socialhub.ai/api/v2/objects/repair_jobs/records \
  -H "Authorization: Bearer fl_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "data": {
    "cf_status": "Received",
    "cf_item": "Sole replacement",
    "member_ref": "mbr_..."
  } }'
# 201 { "data": { "id": "rec_...", "data": { ... } } }

PATCH …/records/{recordId} is a partial update by default (merged field-by-field, so concurrent patches never clobber each other). Send a field as null to remove it, or { "replace": true } to overwrite the whole record. DELETE …/records/{recordId} soft-deletes.

# partial update — only touch cf_status
curl -X PATCH https://flash.socialhub.ai/api/v2/objects/repair_jobs/records/rec_... \
  -H "Authorization: Bearer fl_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "data": { "cf_status": "Completed" } }'

# delete
curl -X DELETE https://flash.socialhub.ai/api/v2/objects/repair_jobs/records/rec_... \
  -H "Authorization: Bearer fl_live_..."