> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dqlabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pattern

> Pattern endpoints: Create Pattern, Get Attribute Pattern, Get Pattern, Get Patterns, Update Pattern, Delete Pattern

<script type="application/ld+json">
  {`{
            "@context": "https://schema.org",
            "@type": "TechArticle",
            "headline": "Pattern",
            "description": "Pattern endpoints: Create Pattern, Get Attribute Pattern, Get Pattern, Get Patterns, Update Pattern, Delete Pattern",
            "url": "https://docs.dqlabs.ai/api-reference/metrics/pattern",
            "publisher": {
              "@type": "Organization",
              "name": "DQLabs Inc",
              "logo": "https://media.brand.dev/332adc35-5bc4-4d2b-bf78-256aa4a5e414.svg"
            }
            }`}
</script>

<Tabs>
  <Tab title="Create Pattern">
    `POST /api/v1/metrics/pattern`

    Create a new pattern

    **Response**

    <ResponseField name="success" type="boolean">Whether the request completed successfully</ResponseField>

    <ResponseField name="message" type="string">Human-readable result message</ResponseField>

    <ResponseField name="timestamp" type="string">ISO 8601 server timestamp</ResponseField>

    <ResponseField name="correlation_id" type="string">Unique ID for this request</ResponseField>

    <ResponseField name="data" type="object">The endpoint's response payload.</ResponseField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST "https://<your-workspace>.prizmdata.ai/api/v1/metrics/pattern" \
        -H "Authorization: Bearer <YOUR_API_TOKEN>" \
        -H "Content-Type: application/json" \
        -d '{}'
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "success": true,
      "message": "Create a new pattern",
      "timestamp": "2026-09-21T09:43:50.316067+00:00",
      "correlation_id": "1bff0823-3db2-4b12-bf56-22ea8d38bba2",
      "data": {}
    }
    ```
  </Tab>

  <Tab title="Get Attribute Pattern">
    `POST /api/v1/metrics/pattern/attribute-pattern`

    Get patterns by attribute\_id or by term (which fetches patterns for all linked assets)

    **Response**

    <ResponseField name="success" type="boolean">Whether the request completed successfully</ResponseField>

    <ResponseField name="message" type="string">Human-readable result message</ResponseField>

    <ResponseField name="timestamp" type="string">ISO 8601 server timestamp</ResponseField>

    <ResponseField name="correlation_id" type="string">Unique ID for this request</ResponseField>

    <ResponseField name="data" type="object" />

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST "https://<your-workspace>.prizmdata.ai/api/v1/metrics/pattern/attribute-pattern" \
        -H "Authorization: Bearer <YOUR_API_TOKEN>" \
        -H "Content-Type: application/json" \
        -d '{}'
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "success": true,
      "message": "Get patterns by attribute_id or by term (which fetches patterns for all linked assets)",
      "timestamp": "2026-09-21T09:43:50.316067+00:00",
      "correlation_id": "1bff0823-3db2-4b12-bf56-22ea8d38bba2",
      "data": {}
    }
    ```
  </Tab>

  <Tab title="Get Pattern">
    `GET /api/v1/metrics/pattern/{patternId}`

    Get a pattern by ID

    **Path Parameters**

    <ParamField path="patternId" type="string" required={true}>
      Example: \`\`
    </ParamField>

    **Response**

    <ResponseField name="success" type="boolean">Whether the request completed successfully</ResponseField>

    <ResponseField name="message" type="string">Human-readable result message</ResponseField>

    <ResponseField name="timestamp" type="string">ISO 8601 server timestamp</ResponseField>

    <ResponseField name="correlation_id" type="string">Unique ID for this request</ResponseField>

    <ResponseField name="data" type="object">
      <ResponseField name="name" type="string">
        Example: `"Signed integer"`.
      </ResponseField>

      <ResponseField name="pattern" type="string">
        Example: `"^[+-]?[0-9]+$"`.
      </ResponseField>

      <ResponseField name="type" type="string">
        Example: `"POSIX"`.
      </ResponseField>

      <ResponseField name="attribute_id" type="string">
        Example: `"52908f03-eefa-4564-9723-3a03d956695b"`.
      </ResponseField>

      <ResponseField name="system_pattern_id" type="string">
        Example: `"a2e3361e-ddef-4933-ba4d-8fa3a7ccd7de"`.
      </ResponseField>

      <ResponseField name="is_valid" type="boolean">
        Example: `true`.
      </ResponseField>

      <ResponseField name="id" type="string">
        Example: `"811589b0-7ad3-46d2-b29e-f8e6422b1f9a"`.
      </ResponseField>

      <ResponseField name="created_at" type="string">
        Example: `"2026-09-16T14:43:02.553790Z"`.
      </ResponseField>

      <ResponseField name="created_by" type="string">
        Example: `"85b88faf-5037-4de7-8a6e-ab61baed84a5"`.
      </ResponseField>
    </ResponseField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X GET "https://<your-workspace>.prizmdata.ai/api/v1/metrics/pattern/{patternId}" \
        -H "Authorization: Bearer <YOUR_API_TOKEN>"
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "success": true,
      "message": "Get a pattern by ID",
      "timestamp": "2026-09-21T09:43:50.316067+00:00",
      "correlation_id": "1bff0823-3db2-4b12-bf56-22ea8d38bba2",
      "data": {
        "name": "Signed integer",
        "pattern": "^[+-]?[0-9]+$",
        "type": "POSIX",
        "attribute_id": "52908f03-eefa-4564-9723-3a03d956695b",
        "system_pattern_id": "a2e3361e-ddef-4933-ba4d-8fa3a7ccd7de",
        "is_valid": true,
        "id": "811589b0-7ad3-46d2-b29e-f8e6422b1f9a",
        "created_at": "2026-09-16T14:43:02.553790Z",
        "created_by": "85b88faf-5037-4de7-8a6e-ab61baed84a5"
      }
    }
    ```
  </Tab>

  <Tab title="Get Patterns">
    `POST /api/v1/metrics/pattern/list`

    Get patterns with optional filtering using prizm-common filters

    **Request Body**

    <ParamField body="pagination" type="object">
      <ParamField body="page" type="integer">
        Example: `1`.
      </ParamField>

      <ParamField body="pageSize" type="integer">
        Example: `10`.
      </ParamField>
    </ParamField>

    <ParamField body="sorting" type="object[]" />

    <ParamField body="filters" type="object[]" />

    <ParamField body="search" type="string">
      Example: `""`.
    </ParamField>

    <ParamField body="export" type="boolean">
      Example: `false`.
    </ParamField>

    **Response**

    <ResponseField name="success" type="boolean">Whether the request completed successfully</ResponseField>

    <ResponseField name="message" type="string">Human-readable result message</ResponseField>

    <ResponseField name="timestamp" type="string">ISO 8601 server timestamp</ResponseField>

    <ResponseField name="correlation_id" type="string">Unique ID for this request</ResponseField>

    <ResponseField name="data" type="object">
      <ResponseField name="data" type="object[]">
        <ResponseField name="name" type="string">
          Example: `"Signed integer"`.
        </ResponseField>

        <ResponseField name="pattern" type="string">
          Example: `"^[+-]?[0-9]+$"`.
        </ResponseField>

        <ResponseField name="type" type="string">
          Example: `"POSIX"`.
        </ResponseField>

        <ResponseField name="attribute_id" type="string">
          Example: `"52908f03-eefa-4564-9723-3a03d956695b"`.
        </ResponseField>

        <ResponseField name="system_pattern_id" type="string">
          Example: `"a2e3361e-ddef-4933-ba4d-8fa3a7ccd7de"`.
        </ResponseField>

        <ResponseField name="is_valid" type="boolean">
          Example: `true`.
        </ResponseField>

        <ResponseField name="id" type="string">
          Example: `"811589b0-7ad3-46d2-b29e-f8e6422b1f9a"`.
        </ResponseField>

        <ResponseField name="created_at" type="string">
          Example: `"2026-09-16T14:43:02.553790Z"`.
        </ResponseField>

        <ResponseField name="created_by" type="string">
          Example: `"85b88faf-5037-4de7-8a6e-ab61baed84a5"`.
        </ResponseField>
      </ResponseField>

      <ResponseField name="count" type="integer">
        Example: `23`.
      </ResponseField>
    </ResponseField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST "https://<your-workspace>.prizmdata.ai/api/v1/metrics/pattern/list" \
        -H "Authorization: Bearer <YOUR_API_TOKEN>" \
        -H "Content-Type: application/json" \
        -d '{
        "pagination": {
          "page": 1,
          "pageSize": 10
        },
        "sorting": [],
        "filters": [],
        "search": "",
        "export": false
      }'
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "success": true,
      "message": "Get patterns with optional filtering using prizm-common filters",
      "timestamp": "2026-09-21T09:43:50.316067+00:00",
      "correlation_id": "1bff0823-3db2-4b12-bf56-22ea8d38bba2",
      "data": {
        "data": [
          {
            "name": "Signed integer",
            "pattern": "^[+-]?[0-9]+$",
            "type": "POSIX",
            "attribute_id": "52908f03-eefa-4564-9723-3a03d956695b",
            "system_pattern_id": "a2e3361e-ddef-4933-ba4d-8fa3a7ccd7de",
            "is_valid": true,
            "id": "811589b0-7ad3-46d2-b29e-f8e6422b1f9a",
            "created_at": "2026-09-16T14:43:02.553790Z",
            "created_by": "85b88faf-5037-4de7-8a6e-ab61baed84a5"
          }
        ],
        "count": 23
      }
    }
    ```
  </Tab>

  <Tab title="Update Pattern">
    `PUT /api/v1/metrics/pattern/{patternId}`

    Update a pattern

    **Path Parameters**

    <ParamField path="patternId" type="string" required={true}>
      Example: \`\`
    </ParamField>

    **Response**

    <ResponseField name="success" type="boolean">Whether the request completed successfully</ResponseField>

    <ResponseField name="message" type="string">Human-readable result message</ResponseField>

    <ResponseField name="timestamp" type="string">ISO 8601 server timestamp</ResponseField>

    <ResponseField name="correlation_id" type="string">Unique ID for this request</ResponseField>

    <ResponseField name="data" type="object">The endpoint's response payload.</ResponseField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X PUT "https://<your-workspace>.prizmdata.ai/api/v1/metrics/pattern/{patternId}" \
        -H "Authorization: Bearer <YOUR_API_TOKEN>" \
        -H "Content-Type: application/json" \
        -d '{}'
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "success": true,
      "message": "Update a pattern",
      "timestamp": "2026-09-21T09:43:50.316067+00:00",
      "correlation_id": "1bff0823-3db2-4b12-bf56-22ea8d38bba2",
      "data": {}
    }
    ```
  </Tab>

  <Tab title="Delete Pattern">
    `DELETE /api/v1/metrics/pattern/{patternId}`

    Delete a pattern

    **Path Parameters**

    <ParamField path="patternId" type="string" required={true}>
      Example: \`\`
    </ParamField>

    **Response**

    <ResponseField name="success" type="boolean">Whether the request completed successfully</ResponseField>

    <ResponseField name="message" type="string">Human-readable result message</ResponseField>

    <ResponseField name="timestamp" type="string">ISO 8601 server timestamp</ResponseField>

    <ResponseField name="correlation_id" type="string">Unique ID for this request</ResponseField>

    <ResponseField name="data" type="object">The endpoint's response payload.</ResponseField>

    **Example**

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X DELETE "https://<your-workspace>.prizmdata.ai/api/v1/metrics/pattern/{patternId}" \
        -H "Authorization: Bearer <YOUR_API_TOKEN>"
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "success": true,
      "message": "Delete a pattern",
      "timestamp": "2026-09-21T09:43:50.316067+00:00",
      "correlation_id": "1bff0823-3db2-4b12-bf56-22ea8d38bba2",
      "data": {}
    }
    ```
  </Tab>
</Tabs>
