> ## 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`.

### Restoring options

Omitting a previously listed option delists it without deleting the values already written to mentions.
Re-adding a previously removed option restores it, together with the 
mentions tagged under it — as long as it is **spelled exactly as before, including
capitalization and spacing**. An option that differs by case or spacing is
treated as a new, separate option (`"Gold"` and `"gold"` are two distinct
options).

### 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: Explore
    description: >
      Run an ad-hoc [Explore](/help/get-started-with-peakmetrics/explore) query
      without creating a workspace, and get back Volume Over Time (`POST
      /explore/analytics/timeline`) or a Channel, Language, or Domain
      distribution (`POST /explore/analytics/distribution`).


      Both endpoints use the same Bearer JWT authentication as the rest of the
      API and take their parameters as a JSON body.


      ### Rate limits and quota


      - **5 queries per user per minute**, shared across both Explore endpoints.
      The minute is a fixed window of 60 seconds from the first request in the
      window. Exceeding it returns a `429` with `error: "rate_limited"` and
      `retryAfterSeconds`.

      - **1,000 queries per user per endpoint per month.** Each endpoint has its
      own monthly allowance, which resets at the start of each calendar month
      (UTC). Exceeding it returns a `429` with `error: "quota_exceeded"` and
      `retryAfterSeconds` set to the time until the reset.


      Every request counts toward the per-minute limit; only successful (`200`)
      requests count toward the monthly quota.


      Both limits are shared with the Explore tools in the [PeakMetrics MCP
      server](/mcp/capabilities), so queries your AI assistant runs there count
      toward the same totals.
  - name: Folders
  - name: Channels
  - name: Locations
    description: >
      PeakMetrics resolves a normalized location on mentions across every
      channel, using a

      six-level taxonomy: `region`, `subregion`, `country`, `state`, `county`,
      and `city`.

      `state` and `county` are United States only.


      Look locations up with `GET /locations`, read a mention's resolved
      location from the

      `location` object on `GET /workspaces/{workspaceId}/mentions`, filter the
      mentions,

      timeline, or distribution endpoints with the `locations.<level>`
      parameters, and

      break counts down with the matching `locations.<level>` `group_by` values.
  - 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`.


        ### Restoring options


        Omitting a previously listed option delists it without deleting the
        values already written to mentions.

        Re-adding a previously removed option restores it, together with the 

        mentions tagged under it — as long as it is **spelled exactly as before,
        including

        capitalization and spacing**. An option that differs by case or spacing
        is

        treated as a new, separate option (`"Gold"` and `"gold"` are two
        distinct

        options).


        ### 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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.