Modules

Create and manage custom data structures with the Modules API

Modules are the building blocks of your Coherence workspace. Each module represents a type of data (Contacts, Deals, Projects, etc.) with its own schema, fields, views, and relationships.

Overview

Modules act as containers for your data. Each module has:

  • Fields - Define the data structure (text, numbers, dates, references, etc.)
  • Views - Display and interact with records (list, detail, kanban, calendar)
  • References - Relationships to other modules
  • Records - Individual data entries

Module Types

TypeDescription
VendorBuilt-in modules managed by Coherence (Contacts, Deals, etc.)
TemplateInstalled from the marketplace
CustomCreated by your workspace

Endpoints Reference

Module Management

MethodEndpointDescription
GET/modulesList all modules
GET/modules/:slugGet module schema
POST/modulesCreate a module
PATCH/modules/:moduleIdUpdate a module
DELETE/modules/:moduleIdDelete a module

Field Management

MethodEndpointDescription
GET/modules/:slug/fieldsList module fields
POST/modules/:moduleId/fieldsCreate a field
PATCH/modules/:moduleId/fields/:fieldIdUpdate a field
DELETE/modules/:moduleId/fields/:fieldIdDelete a field

View Management

MethodEndpointDescription
GET/modules/:moduleId/viewsList module views
POST/modules/:moduleId/viewsCreate a view
PATCH/modules/:moduleId/views/:viewIdUpdate a view
DELETE/modules/:moduleId/views/:viewIdDelete a view

Reference Management

MethodEndpointDescription
GET/modules/:slug/referencesList module references
POST/modules/:moduleId/referencesCreate a reference
PATCH/modules/:moduleId/references/:referenceIdUpdate a reference
DELETE/modules/:moduleId/references/:referenceIdDelete a reference

List Modules

Retrieve all modules in your workspace.

GET /modules

Query Parameters

ParameterTypeDescription
visibilitystringFilter by visibility: active (default) or hidden

Request

curl -X GET "https://api.getcoherence.io/v1/modules" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "modules": [
    {
      "moduleId": "mod_abc123",
      "accountId": "acc_xyz789",
      "name": "Contacts",
      "singularName": "Contact",
      "pluralName": "Contacts",
      "slug": "contacts",
      "icon": "users",
      "status": "published",
      "isCustom": false,
      "vendorManaged": true,
      "visibility": "active",
      "origin": "vendor",
      "displayField": {
        "type": "concat",
        "fields": ["first_name", "last_name"],
        "separator": " "
      },
      "createdDateTime": "2024-01-15T10:30:00Z",
      "updatedDateTime": "2024-01-20T14:45:00Z"
    },
    {
      "moduleId": "mod_def456",
      "accountId": "acc_xyz789",
      "name": "Projects",
      "singularName": "Project",
      "pluralName": "Projects",
      "slug": "projects",
      "icon": "folder-kanban",
      "status": "published",
      "isCustom": true,
      "vendorManaged": false,
      "visibility": "active",
      "origin": "custom",
      "displayField": {
        "type": "field",
        "field": "name"
      },
      "createdDateTime": "2024-02-01T09:00:00Z",
      "updatedDateTime": "2024-02-01T09:00:00Z"
    }
  ]
}

Get Module Schema

Retrieve detailed schema for a single module including fields, views, and references.

GET /modules/:slug

Request

curl -X GET "https://api.getcoherence.io/v1/modules/contacts" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "module": {
    "moduleId": "mod_abc123",
    "name": "Contacts",
    "singularName": "Contact",
    "pluralName": "Contacts",
    "slug": "contacts",
    "icon": "users",
    "status": "published",
    "isCustom": false,
    "vendorManaged": true,
    "visibility": "active",
    "origin": "vendor",
    "displayField": {
      "type": "concat",
      "fields": ["first_name", "last_name"],
      "separator": " "
    },
    "quickCreateFields": ["first_name", "last_name", "email"],
    "config": {},
    "allowRecordActions": true,
    "isDeletable": false,
    "createdDateTime": "2024-01-15T10:30:00Z",
    "updatedDateTime": "2024-01-20T14:45:00Z"
  },
  "fields": [
    {
      "fieldId": "fld_001",
      "moduleId": "mod_abc123",
      "name": "first_name",
      "slug": "first_name",
      "label": "First Name",
      "dataType": "text",
      "isRequired": true,
      "isSystem": false,
      "sortOrder": 1,
      "config": {}
    },
    {
      "fieldId": "fld_002",
      "moduleId": "mod_abc123",
      "name": "email",
      "slug": "email",
      "label": "Email",
      "dataType": "email",
      "isRequired": false,
      "isSystem": false,
      "sortOrder": 3,
      "config": {
        "multiValue": true
      }
    }
  ],
  "views": [
    {
      "viewId": "view_001",
      "moduleId": "mod_abc123",
      "name": "All Contacts",
      "viewType": "list",
      "status": "published",
      "sortOrder": 1,
      "visibility": "account",
      "config": {}
    }
  ],
  "references": [
    {
      "referenceId": "ref_001",
      "slug": "account",
      "sourceModuleId": "mod_abc123",
      "targetModuleId": "mod_accounts",
      "relationshipType": "many_to_one",
      "targetType": "module",
      "isRequired": false,
      "cascadeDelete": false,
      "cascadeUpdate": false
    }
  ]
}

Create Module

Create a new custom module.

POST /modules

Request Body

FieldTypeRequiredDescription
namestringYesInternal name
singularNamestringYesDisplay name for single record
pluralNamestringYesDisplay name for multiple records
slugstringYesURL-friendly identifier (lowercase, hyphens only)
iconstringNoIcon name (defaults to puzzle)
displayFieldobjectNoHow to display record names
quickCreateFieldsarrayNoFields shown in quick create form
configobjectNoAdditional configuration

Display Field Options

The displayField determines how records are displayed in lists and references.

Single Field:

{
  "displayField": {
    "type": "field",
    "field": "name"
  }
}

Concatenated Fields:

{
  "displayField": {
    "type": "concat",
    "fields": ["first_name", "last_name"],
    "separator": " "
  }
}

Request

curl -X POST "https://api.getcoherence.io/v1/modules" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Projects",
    "singularName": "Project",
    "pluralName": "Projects",
    "slug": "projects",
    "icon": "folder-kanban",
    "displayField": {
      "type": "field",
      "field": "name"
    },
    "quickCreateFields": ["name", "status", "owner"]
  }'

Response

{
  "module": {
    "moduleId": "mod_new123",
    "accountId": "acc_xyz789",
    "name": "Projects",
    "singularName": "Project",
    "pluralName": "Projects",
    "slug": "projects",
    "icon": "folder-kanban",
    "status": "draft",
    "isCustom": true,
    "vendorManaged": false,
    "visibility": "active",
    "origin": "custom",
    "displayField": {
      "type": "field",
      "field": "name"
    },
    "quickCreateFields": ["name", "status", "owner"],
    "createdDateTime": "2024-02-15T10:30:00Z",
    "updatedDateTime": "2024-02-15T10:30:00Z"
  }
}

After creating a module, add fields to define its data structure before creating records.


Update Module

Update an existing module's metadata.

PATCH /modules/:moduleId

Request Body

All fields are optional. Only include fields you want to update.

FieldTypeDescription
namestringInternal name
singularNamestringSingular display name
pluralNamestringPlural display name
iconstringIcon name
displayFieldobjectRecord display configuration
quickCreateFieldsarrayQuick create form fields
configobjectAdditional configuration

Request

curl -X PATCH "https://api.getcoherence.io/v1/modules/mod_new123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "icon": "briefcase",
    "displayField": {
      "type": "concat",
      "fields": ["name", "client"],
      "separator": " - "
    }
  }'

Response

{
  "module": {
    "moduleId": "mod_new123",
    "name": "Projects",
    "singularName": "Project",
    "pluralName": "Projects",
    "slug": "projects",
    "icon": "briefcase",
    "displayField": {
      "type": "concat",
      "fields": ["name", "client"],
      "separator": " - "
    },
    "updatedDateTime": "2024-02-16T08:00:00Z"
  }
}

Delete Module

Delete a custom module and all its records.

DELETE /modules/:moduleId

Deleting a module permanently removes all records. This action cannot be undone. Vendor-managed modules cannot be deleted but can be hidden.

Request

curl -X DELETE "https://api.getcoherence.io/v1/modules/mod_new123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

HTTP 204 No Content

Hiding Modules

For vendor modules that cannot be deleted, use the hide endpoint:

curl -X POST "https://api.getcoherence.io/v1/modules/mod_abc123/hide" \
  -H "Authorization: Bearer YOUR_API_KEY"

To show a hidden module:

curl -X POST "https://api.getcoherence.io/v1/modules/mod_abc123/show" \
  -H "Authorization: Bearer YOUR_API_KEY"

Managing Fields

Fields define the data structure of a module.

Field Types

Data TypeDescriptionConfig Options
textShort textmaxLength
long_textMulti-line textmaxLength
rich_textFormatted text with HTMLtoolbarPreset, attachments
numberNumeric valuesprecision, min, max
currencyMoney valuescurrency, precision
dateDate onlyformat
datetimeDate and timeformat, timezone
emailEmail addressesmultiValue
phonePhone numbersmultiValue
urlWeb addresses-
selectSingle selectionoptions
multi_selectMultiple selectionsoptions
checkboxBoolean toggle-
userUser referencemultiValue
referenceModule referenceSee References section
formulaCalculated fieldexpression, resultType
rollupAggregated datareferenceSlug, field, aggregation
auto_numberAuto-incrementing IDprefix, padLength
attachmentFile uploadsmaxFiles, allowedTypes

Create Field

POST /modules/:moduleId/fields

Request Body

FieldTypeRequiredDescription
namestringYesInternal name
slugstringYesURL-friendly identifier
labelstringYesDisplay label
dataTypestringYesField type (see table above)
isRequiredbooleanNoWhether field is required
sortOrdernumberNoDisplay order
configobjectNoType-specific configuration
privacyLevelstringNoaccount, role, or private

Example: Text Field

curl -X POST "https://api.getcoherence.io/v1/modules/mod_new123/fields" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "project_name",
    "slug": "project-name",
    "label": "Project Name",
    "dataType": "text",
    "isRequired": true,
    "sortOrder": 1,
    "config": {
      "maxLength": 200
    }
  }'

Example: Select Field with Options

curl -X POST "https://api.getcoherence.io/v1/modules/mod_new123/fields" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "status",
    "slug": "status",
    "label": "Status",
    "dataType": "select",
    "isRequired": true,
    "config": {
      "options": [
        { "slug": "planning", "label": "Planning", "color": "blue" },
        { "slug": "in-progress", "label": "In Progress", "color": "yellow" },
        { "slug": "completed", "label": "Completed", "color": "green" },
        { "slug": "on-hold", "label": "On Hold", "color": "gray" }
      ],
      "defaultSlug": "planning"
    }
  }'

Example: Formula Field

curl -X POST "https://api.getcoherence.io/v1/modules/mod_new123/fields" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "total_value",
    "slug": "total-value",
    "label": "Total Value",
    "dataType": "formula",
    "config": {
      "formula": {
        "expression": "{quantity} * {unit_price}",
        "resultType": "number"
      }
    }
  }'

Example: Auto-Number Field

curl -X POST "https://api.getcoherence.io/v1/modules/mod_new123/fields" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "project_id",
    "slug": "project-id",
    "label": "Project ID",
    "dataType": "auto_number",
    "config": {
      "prefix": "PRJ-",
      "padLength": 4
    }
  }'

This generates IDs like PRJ-0001, PRJ-0002, etc.

Update Field

PATCH /modules/:moduleId/fields/:fieldId
curl -X PATCH "https://api.getcoherence.io/v1/modules/mod_new123/fields/fld_001" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Full Name",
    "isRequired": false
  }'

Delete Field

DELETE /modules/:moduleId/fields/:fieldId
curl -X DELETE "https://api.getcoherence.io/v1/modules/mod_new123/fields/fld_001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Deleting a field removes all data stored in that field across all records. System fields cannot be deleted.


Managing Views

Views control how records are displayed and interacted with.

View Types

TypeDescription
listTable/grid view of records
detailSingle record detail page
formData entry form
kanbanCard-based board view
calendarCalendar visualization

Create View

POST /modules/:moduleId/views

Request Body

FieldTypeRequiredDescription
namestringYesView name
viewTypestringYesView type (see table above)
statusstringNodraft, published, archived
visibilitystringNoaccount, team, private
sortOrdernumberNoDisplay order in navigation
configobjectNoView-specific configuration

Example: List View

curl -X POST "https://api.getcoherence.io/v1/modules/mod_new123/views" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Active Projects",
    "viewType": "list",
    "status": "published",
    "visibility": "account",
    "sortOrder": 1,
    "config": {
      "columns": ["name", "status", "owner", "due_date"],
      "defaultSort": { "field": "due_date", "direction": "asc" }
    }
  }'

Example: Kanban View

curl -X POST "https://api.getcoherence.io/v1/modules/mod_new123/views" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Project Board",
    "viewType": "kanban",
    "status": "published",
    "visibility": "account",
    "config": {
      "groupByField": "status",
      "cardFields": ["name", "owner", "due_date"]
    }
  }'

Update View

PATCH /modules/:moduleId/views/:viewId
curl -X PATCH "https://api.getcoherence.io/v1/modules/mod_new123/views/view_001" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "All Projects",
    "config": {
      "columns": ["name", "status", "owner", "due_date", "budget"]
    }
  }'

Reorder Views

POST /modules/:moduleId/views/reorder
curl -X POST "https://api.getcoherence.io/v1/modules/mod_new123/views/reorder" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "views": [
      { "viewId": "view_001", "sortOrder": 1 },
      { "viewId": "view_002", "sortOrder": 2 },
      { "viewId": "view_003", "sortOrder": 3 }
    ]
  }'

Delete View

DELETE /modules/:moduleId/views/:viewId
curl -X DELETE "https://api.getcoherence.io/v1/modules/mod_new123/views/view_001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Managing References

References define relationships between modules.

Relationship Types

TypeDescription
one_to_oneEach record links to exactly one target
one_to_manyOne source record links to many targets
many_to_oneMany source records link to one target
many_to_manyMany-to-many relationship
lookupRead-only lookup to another module

Target Types

TypeDescription
moduleReference to another module's records
userReference to workspace users

Create Reference

POST /modules/:moduleId/references

Request Body

FieldTypeRequiredDescription
slugstringYesURL-friendly identifier
targetModuleIdstringConditionalTarget module (required for module type)
targetTypestringNomodule (default) or user
relationshipTypestringYesRelationship type
isRequiredbooleanNoWhether reference is required
cascadeDeletebooleanNoDelete related records on delete
cascadeUpdatebooleanNoUpdate related records on update
targetFiltersobjectNoFilter target records
configobjectNoAdditional configuration

Example: Many-to-One Reference

Link projects to accounts:

curl -X POST "https://api.getcoherence.io/v1/modules/mod_projects/references" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "account",
    "targetModuleId": "mod_accounts",
    "targetType": "module",
    "relationshipType": "many_to_one",
    "isRequired": true,
    "cascadeDelete": false
  }'

Example: User Reference

Assign an owner to projects:

curl -X POST "https://api.getcoherence.io/v1/modules/mod_projects/references" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "owner",
    "targetType": "user",
    "relationshipType": "many_to_one",
    "isRequired": false,
    "targetFilters": {
      "roleSlugs": ["admin", "project_manager"]
    }
  }'

Example: Many-to-Many Reference

Link projects to tags:

curl -X POST "https://api.getcoherence.io/v1/modules/mod_projects/references" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "tags",
    "targetModuleId": "mod_tags",
    "targetType": "module",
    "relationshipType": "many_to_many",
    "isRequired": false
  }'

Update Reference

PATCH /modules/:moduleId/references/:referenceId
curl -X PATCH "https://api.getcoherence.io/v1/modules/mod_projects/references/ref_001" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "isRequired": true,
    "cascadeDelete": true
  }'

Delete Reference

DELETE /modules/:moduleId/references/:referenceId
curl -X DELETE "https://api.getcoherence.io/v1/modules/mod_projects/references/ref_001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Deleting a reference removes all relationship data between records. The target records themselves are not deleted unless cascadeDelete is enabled.


Error Responses

Common Errors

StatusCodeDescription
400validation_errorInvalid request body
401unauthorizedMissing or invalid authentication
403forbiddenInsufficient permissions
404not_foundModule, field, view, or reference not found
409conflictSlug already exists
422unprocessable_entityCannot process request

Example Error Response

{
  "error": {
    "code": "validation_error",
    "message": "Slug must contain only lowercase letters, numbers, and hyphens",
    "details": {
      "field": "slug"
    }
  }
}

Related: API Overview | Authentication | Template System