Skip to main content
GET
https://api.pretectum.io
/
v1
/
businessareas
/
{businessAreaId}
/
schemas
/
{schemaId}
Get Schema
curl --request GET \
  --url https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId} \
  --header 'Authorization: <authorization>'
{
  "schemaId": "<string>",
  "name": "<string>",
  "description": "<string>",
  "businessAreaId": "<string>",
  "businessAreaName": "<string>",
  "version": 123,
  "createdBy": "<string>",
  "updatedBy": "<string>",
  "createdDate": "<string>",
  "updatedDate": "<string>",
  "fields": [
    {
      "fieldId": "<string>",
      "name": "<string>",
      "description": "<string>",
      "active": true,
      "dataType": "<string>",
      "isPrimaryKey": true,
      "isSortKey": true,
      "isRequired": true,
      "isMultivalue": true,
      "isPII": true,
      "min": {},
      "max": {},
      "classifiers": [
        {
          "tagId": "<string>",
          "tagName": "<string>"
        }
      ],
      "validationRules": [
        {}
      ],
      "allowedBooleanValues": "<string>",
      "picklistType": "<string>",
      "staticPicklist": [
        {
          "code": "<string>",
          "description": "<string>"
        }
      ],
      "dataDomainId": "<string>",
      "dateFormat": "<string>",
      "dateSeparator": "<string>",
      "timeFormat": "<string>",
      "maxWidth": 123,
      "maxHeight": 123,
      "maxSize": 123,
      "createdBy": "<string>",
      "updatedBy": "<string>",
      "createdDate": "<string>",
      "updatedDate": "<string>"
    }
  ]
}
The Get Schema endpoint returns detailed information about a specific schema within a business area, including its field definitions and validation rules.

Prerequisites

  • Valid access token (see Get Access Token)
  • Permission to access schemas in your tenant
  • Valid business area ID and schema ID

Authentication

Include your access token in the Authorization header.
Pass the token directly without the “Bearer” prefix.
Authorization: your_access_token

Request

Path Parameters

businessAreaId
string
required
The unique identifier of the business area containing the schema.
schemaId
string
required
The unique identifier of the schema to retrieve. You can obtain this from the List Schemas endpoint.

Headers

Authorization
string
required
Your access token obtained from the /v1/oauth2/token endpoint. Pass the token directly without the “Bearer” prefix.
Accept
string
default:"application/json"
The response content type. Currently only application/json is supported.

Example Requests

curl -X GET "https://api.pretectum.io/v1/businessareas/20240115103000123a1b2c3d4e5f6789012345678901234/schemas/20240115103000456d1e2f3a4b5c6789012345678901234" \
  -H "Authorization: your_access_token" \
  -H "Accept: application/json"

Response

A successful request returns a schema object with its complete definition including field specifications.
schemaId
string
required
The unique identifier for the schema.
name
string
required
The display name of the schema.
description
string
A description of the schema explaining its purpose.
businessAreaId
string
required
The ID of the business area this schema belongs to.
businessAreaName
string
required
The name of the business area this schema belongs to.
version
integer
The version number of the schema.
createdBy
string
The email address of the user who created the schema.
updatedBy
string
The email address of the user who last modified the schema.
createdDate
string
required
The ISO 8601 timestamp when the schema was created.
updatedDate
string
The ISO 8601 timestamp when the schema was last modified.
fields
array
required
An array of field definitions that make up the schema structure. Fields are ordered by creation date (ascending).

Example Response

{
  "schemaId": "20240115103000456d1e2f3a4b5c6789012345678901234",
  "name": "Customer Schema",
  "description": "Schema for customer data management",
  "businessAreaId": "20240115103000123a1b2c3d4e5f6789012345678901234",
  "businessAreaName": "Customer Management",
  "createdBy": "john.doe@example.com",
  "updatedBy": "jane.smith@example.com",
  "createdDate": "2025-01-15T10:30:00Z",
  "updatedDate": "2025-03-20T14:45:00Z",
  "version": 2,
  "fields": [
    {
      "fieldId": "20250115103500001a1b2c3d4e5f6789012345678901234",
      "name": "customer_id",
      "description": "Unique identifier for the customer",
      "active": true,
      "isPrimaryKey": true,
      "isSortKey": false,
      "dataType": "string",
      "max": 20,
      "min": 5,
      "isRequired": true,
      "isMultivalue": false,
      "isPII": false,
      "classifiers": [
        {
          "tagName": "Identifier",
          "tagId": "id-001"
        }
      ],
      "validationRules": ["alphanumeric"],
      "createdBy": "john.doe@example.com",
      "updatedBy": "john.doe@example.com",
      "createdDate": "2025-01-15T10:35:00Z",
      "updatedDate": "2025-01-15T10:35:00Z"
    },
    {
      "fieldId": "20250115103700002b2c3d4e5f6a7890123456789012345",
      "name": "full_name",
      "description": "Customer's full name",
      "active": true,
      "isPrimaryKey": false,
      "isSortKey": true,
      "dataType": "string",
      "max": 100,
      "min": 2,
      "isRequired": true,
      "isMultivalue": false,
      "isPII": true,
      "classifiers": [
        {
          "tagName": "Personally Identifiable",
          "tagId": "pii-001"
        }
      ],
      "validationRules": [],
      "createdBy": "john.doe@example.com",
      "updatedBy": "jane.smith@example.com",
      "createdDate": "2025-01-15T10:37:00Z",
      "updatedDate": "2025-02-20T11:22:00Z"
    },
    {
      "fieldId": "20250115104000003c3d4e5f6a7b8901234567890123456",
      "name": "date_of_birth",
      "description": "Customer's date of birth",
      "active": true,
      "isPrimaryKey": false,
      "isSortKey": false,
      "dataType": "date",
      "max": "2010-12-31",
      "min": "1920-01-01",
      "isRequired": false,
      "isMultivalue": false,
      "isPII": true,
      "dateFormat": "YYYY$MM$DD",
      "dateSeparator": "-",
      "classifiers": [
        {
          "tagName": "Personally Identifiable",
          "tagId": "pii-001"
        }
      ],
      "validationRules": [],
      "createdBy": "john.doe@example.com",
      "updatedBy": "john.doe@example.com",
      "createdDate": "2025-01-15T10:40:00Z",
      "updatedDate": "2025-01-15T10:40:00Z"
    },
    {
      "fieldId": "20250115104200004d4e5f6a7b8c9012345678901234567",
      "name": "customer_type",
      "description": "Type of customer",
      "active": true,
      "isPrimaryKey": false,
      "isSortKey": false,
      "dataType": "picklist",
      "isRequired": true,
      "isMultivalue": false,
      "isPII": false,
      "picklistType": "static",
      "staticPicklist": [
        {
          "code": "individual",
          "description": "Individual customer"
        },
        {
          "code": "corporate",
          "description": "Corporate customer"
        },
        {
          "code": "vip",
          "description": "VIP customer"
        }
      ],
      "classifiers": [],
      "validationRules": [],
      "createdBy": "john.doe@example.com",
      "updatedBy": "jane.smith@example.com",
      "createdDate": "2025-01-15T10:42:00Z",
      "updatedDate": "2025-03-10T09:15:00Z"
    },
    {
      "fieldId": "20250115104500005e5f6a7b8c9d0123456789012345678",
      "name": "is_active",
      "description": "Whether the customer account is active",
      "active": true,
      "isPrimaryKey": false,
      "isSortKey": false,
      "dataType": "boolean",
      "isRequired": true,
      "isMultivalue": false,
      "isPII": false,
      "allowedBooleanValues": "Y/N",
      "classifiers": [],
      "validationRules": [],
      "createdBy": "john.doe@example.com",
      "updatedBy": "john.doe@example.com",
      "createdDate": "2025-01-15T10:45:00Z",
      "updatedDate": "2025-01-15T10:45:00Z"
    },
    {
      "fieldId": "20250210132000006f6a7b8c9d0e1234567890123456789",
      "name": "profile_picture",
      "description": "Customer's profile picture",
      "active": true,
      "isPrimaryKey": false,
      "isSortKey": false,
      "dataType": "image",
      "isRequired": false,
      "isMultivalue": false,
      "isPII": true,
      "maxWidth": 1024,
      "maxHeight": 1024,
      "maxSize": 5242880,
      "classifiers": [
        {
          "tagName": "Personally Identifiable",
          "tagId": "pii-001"
        }
      ],
      "validationRules": [],
      "createdBy": "jane.smith@example.com",
      "updatedBy": "jane.smith@example.com",
      "createdDate": "2025-02-10T13:20:00Z",
      "updatedDate": "2025-02-10T13:20:00Z"
    }
  ]
}

Error Responses

Status CodeDescription
401 UnauthorizedInvalid or expired access token. Obtain a new token and try again.
403 ForbiddenYour application client does not have permission to access this schema.
404 Not FoundThe specified schema or business area does not exist, or you do not have access to it.
500 Internal Server ErrorAn unexpected error occurred on the server.

Use Cases

Understanding Data Structure

Use the schema details to understand what fields are available for searching:
const schema = await getSchema(businessAreaId, schemaId);

// Get searchable fields for building search queries
const searchableFields = schema.fields
  .filter(field => field.searchable)
  .map(field => field.name);

console.log('Searchable fields:', searchableFields);
// Output: ['First Name', 'Last Name', 'Email', 'Phone', 'Active']

Building Dynamic Forms

Use the field definitions to dynamically generate data entry forms:
const schema = await getSchema(businessAreaId, schemaId);

const formFields = schema.fields.map(field => ({
  name: field.name,
  type: mapDataTypeToInputType(field.dataType),
  required: field.required,
  placeholder: field.description
}));
Verify that a field exists and is searchable before including it in a query:
def is_field_searchable(schema, field_name):
    for field in schema['fields']:
        if field['name'] == field_name:
            return field.get('searchable', False)
    return False

schema = get_schema('20240115103000123a1b2c3d4e5f6789012345678901234', '20240115103000456d1e2f3a4b5c6789012345678901234')
if is_field_searchable(schema, 'Email'):
    # Safe to search by Email field
    results = search('email:*@example.com', schema='Individual Customer')

Best Practices

  1. Cache schema definitions: Schema structures change infrequently. Cache them locally.
  2. Check searchable flag: Only use fields marked as searchable: true in search queries.
  3. Respect required fields: When building forms, ensure required fields are validated.
  4. Use field names in queries: For field-specific searches, use the name property from field definitions.