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

# Edit a custom enrichment

> Renames a custom enrichment and/or replaces its option list, and returns the
updated definition in the same shape as `GET /customEnrichments`.

### Full replace, not a diff

`constraints.enum` is **required** and **fully replaces** the currently listed
options: whatever array you submit becomes the complete set of listed options
going forward. Send the full intended list every time — `["A", "B"]` followed by
`["B", "C"]` leaves only `B` and `C` listed. `[]` removes every option.

This works the same way for `categorical` and `multivalue_categorical`
enrichments — both carry an option list. For `integer` enrichments
`constraints.enum` must be exactly `[]`; editing an integer enrichment is limited
to its `name`.

### Removing options — prefer adding to the list

Omitting a previously listed option removes it from the list. It does not delete
the values already written to mentions, but options are currently stored by their
position in the list, so **removing an option can relabel mentions tagged with the
options that followed it**. Until that is fixed, add options rather than remove
them; to retire an option, leave it listed and stop writing it.

### Self-registration still applies

This endpoint controls the explicitly managed list at the moment it is called.
Values pushed with `PUT /mentions/customEnrichments` that are not yet listed are
still registered automatically, exactly as before, and `GET /customEnrichments`
continues to reflect the current full set of listed options however they arrived.

`type` cannot be changed.




## OpenAPI

````yaml /api/api_docs.yaml put /customEnrichments/{enrichmentId}
openapi: 3.1.0
info:
  title: PeakMetrics API
  description: >
    The PeakMetrics API provides programmatic access to narrative intelligence
    data.


    Access millions of mentions across news, social media, and online platforms,
    enriched with custom AI-powered

    smart categories and over 50 metadata properties. The API enables you to

    identify, analyze, and act on emerging narratives in real-time.
  version: 2.0.0
servers:
  - url: https://api.peakmetrics.com
    description: Main (production) server
security:
  - BearerAuth: []
tags:
  - name: Authorization
  - name: Workspaces
  - name: Folders
  - name: Channels
  - name: Custom Channels
  - name: Custom Enrichments
    description: >
      Custom enrichments let you push external context about mentions into
      PeakMetrics,

      attached to individual mentions and used alongside all other mention
      metadata across

      the platform. Once written, enrichment values feed into narrative
      analysis, workspace

      summaries, and notifications, and are available through the customer API
      and the MCP

      server.


      Your team manages its own custom enrichments through the API: create one
      with

      `POST /customEnrichments`, list them with `GET /customEnrichments`, rename
      one or

      replace its option list with `PUT /customEnrichments/{enrichmentId}`,
      retire one with

      `DELETE /customEnrichments/{enrichmentId}`, and push values for individual
      mentions

      with `PUT /mentions/customEnrichments`.
paths:
  /customEnrichments/{enrichmentId}:
    put:
      tags:
        - Custom Enrichments
      summary: Edit a custom enrichment
      description: >
        Renames a custom enrichment and/or replaces its option list, and returns
        the

        updated definition in the same shape as `GET /customEnrichments`.


        ### Full replace, not a diff


        `constraints.enum` is **required** and **fully replaces** the currently
        listed

        options: whatever array you submit becomes the complete set of listed
        options

        going forward. Send the full intended list every time — `["A", "B"]`
        followed by

        `["B", "C"]` leaves only `B` and `C` listed. `[]` removes every option.


        This works the same way for `categorical` and `multivalue_categorical`

        enrichments — both carry an option list. For `integer` enrichments

        `constraints.enum` must be exactly `[]`; editing an integer enrichment
        is limited

        to its `name`.


        ### Removing options — prefer adding to the list


        Omitting a previously listed option removes it from the list. It does
        not delete

        the values already written to mentions, but options are currently stored
        by their

        position in the list, so **removing an option can relabel mentions
        tagged with the

        options that followed it**. Until that is fixed, add options rather than
        remove

        them; to retire an option, leave it listed and stop writing it.


        ### Self-registration still applies


        This endpoint controls the explicitly managed list at the moment it is
        called.

        Values pushed with `PUT /mentions/customEnrichments` that are not yet
        listed are

        still registered automatically, exactly as before, and `GET
        /customEnrichments`

        continues to reflect the current full set of listed options however they
        arrived.


        `type` cannot be changed.
      parameters:
        - in: path
          name: enrichmentId
          required: true
          schema:
            type: integer
          description: The `enrichment_id` from `GET /customEnrichments`.
          example: 1681
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - constraints
              properties:
                name:
                  type: string
                  maxLength: 255
                  description: >
                    A new display name. Optional; when present it must be unique
                    among

                    your team's custom enrichments (compared
                    case-insensitively).
                  example: Disinformation Analysis
                constraints:
                  type: object
                  required:
                    - enum
                  properties:
                    enum:
                      type: array
                      items:
                        type: string
                      description: >
                        The complete list of options to keep listed. Distinct,
                        non-empty

                        strings (at most 5000) for `categorical` and

                        `multivalue_categorical`; exactly `[]` for `integer`.
                      example:
                        - Uncorroborated
                        - Substantiated
                        - Mixed
                        - Debunked
            examples:
              add_and_remove:
                summary: Replace the option list
                value:
                  constraints:
                    enum:
                      - Uncorroborated
                      - Substantiated
                      - Mixed
                      - Debunked
              rename:
                summary: Rename without changing the options
                value:
                  name: Claim Assessment
                  constraints:
                    enum:
                      - Uncorroborated
                      - Substantiated
                      - Mixed
      responses:
        '200':
          description: The updated custom enrichment, reflecting the replaced option list.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomEnrichment'
              examples:
                updated:
                  summary: The updated enrichment
                  value:
                    enrichment_id: 1681
                    name: Disinformation Analysis
                    type: categorical
                    constraints:
                      enum:
                        - Uncorroborated
                        - Substantiated
                        - Mixed
                        - Debunked
        '400':
          description: >
            The request is invalid: a missing `constraints.enum`, a non-empty

            `constraints.enum` on an `integer` enrichment, blank or duplicate
            option

            values, more than 5000 options, an empty `name`, or an attempt to
            change

            `type`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomEnrichmentError'
        '401':
          description: Missing or invalid access token.
        '404':
          description: |
            Your team has no custom enrichment with this `enrichment_id`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomEnrichmentError'
              examples:
                not_found:
                  summary: No such custom enrichment
                  value:
                    error: Custom enrichment not found
        '409':
          description: >-
            Your team already has a different custom enrichment with the new
            `name`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomEnrichmentError'
      security:
        - BearerAuth: []
components:
  schemas:
    CustomEnrichment:
      type: object
      description: A custom enrichment definition, as listed by `GET /customEnrichments`.
      properties:
        enrichment_id:
          type: integer
          description: >-
            The unique identifier. Use it as `enrichment_id` when pushing values
            with `PUT /mentions/customEnrichments`.
          example: 1681
        name:
          type: string
          description: The display name.
          example: Disinformation Analysis
        type:
          type: string
          enum:
            - categorical
            - multivalue_categorical
            - integer
          description: The data type of the enrichment's `value`. Fixed at creation.
          example: categorical
        constraints:
          type: object
          properties:
            enum:
              type: array
              items:
                type: string
              description: >
                For `categorical` and `multivalue_categorical` enrichments, the
                currently

                listed options. For `integer` enrichments, always `[]`.
              example:
                - Uncorroborated
                - Substantiated
                - Mixed
    CustomEnrichmentError:
      type: object
      properties:
        error:
          type: string
          description: A human-readable description of what was rejected.
          example: '''constraints.enum'' contains a duplicate value: ''Mixed'''
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````