Skip to main content
Base path: /custom-attributes

Types

// ============ Enums ============

type CustomAttributeType =
  | 'text'
  | 'number'
  | 'boolean'
  | 'date'
  | 'phone_number'
  | 'email'
  | 'url';

// ============ Request Types ============

interface CreateCustomAttributeRequest {
  displayName: string;          // 3-64 characters
  description?: string;         // 1-256 characters
  type: CustomAttributeType;
}

interface UpdateCustomAttributeRequest {
  description?: string;         // 1-256 characters
}

// ============ Response Types ============

interface CustomAttributeResponse {
  id: string;
  organizationId: string;
  name: string;                 // auto-generated slug from displayName
  displayName: string;
  description: string | null;
  type: CustomAttributeType;
  createdAt: string;            // ISO date
  updatedAt: string;            // ISO date
  deletedAt: string | null;
  createdBy: string | null;
  updatedBy: string | null;
  deletedBy: string | null;
}

Get all custom attributes

curl -X GET https://api.gomobile.ma/api/custom-attributes \
  -H "x-api-key: YOUR_API_KEY"
Response:
[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "organizationId": "660e8400-e29b-41d4-a716-446655440001",
    "name": "customer_age",
    "displayName": "Customer Age",
    "description": "Age of the customer in years",
    "type": "number",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z",
    "deletedAt": null,
    "createdBy": null,
    "updatedBy": null,
    "deletedBy": null
  }
]

Get custom attribute by ID

curl -X GET https://api.gomobile.ma/api/custom-attributes/550e8400-e29b-41d4-a716-446655440000 \
  -H "x-api-key: YOUR_API_KEY"
Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "organizationId": "660e8400-e29b-41d4-a716-446655440001",
  "name": "customer_age",
  "displayName": "Customer Age",
  "description": "Age of the customer in years",
  "type": "number",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:30:00.000Z",
  "deletedAt": null,
  "createdBy": null,
  "updatedBy": null,
  "deletedBy": null
}

Create a new custom attribute

curl -X POST https://api.gomobile.ma/api/custom-attributes \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
{
  "displayName": "Customer Age",
  "description": "Age of the customer in years",
  "type": "number"
}
'
Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "organizationId": "660e8400-e29b-41d4-a716-446655440001",
  "name": "customer_age",
  "displayName": "Customer Age",
  "description": "Age of the customer in years",
  "type": "number",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:30:00.000Z",
  "deletedAt": null,
  "createdBy": null,
  "updatedBy": null,
  "deletedBy": null
}

Update custom attribute

curl -X PUT https://api.gomobile.ma/api/custom-attributes/550e8400-e29b-41d4-a716-446655440000 \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
{
  "description": "Updated description for customer age"
}
'
Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "organizationId": "660e8400-e29b-41d4-a716-446655440001",
  "name": "customer_age",
  "displayName": "Customer Age",
  "description": "Updated description for customer age",
  "type": "number",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T12:00:00.000Z",
  "deletedAt": null,
  "createdBy": null,
  "updatedBy": null,
  "deletedBy": null
}

Delete custom attribute

curl -X DELETE https://api.gomobile.ma/api/custom-attributes/550e8400-e29b-41d4-a716-446655440000 \
  -H "x-api-key: YOUR_API_KEY"
Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  ...
}