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

# Apply mapping values to an integration

> Checks mapping records for one integration, as `POST /v1/integration/{id}/mapping/validate` does, and stores the valid ones. Valid records are written even when others fail; the refused ones are returned in `failed` and not written. Records are written one at a time, not in a transaction, so if one write fails, those before it stay. With `mode` `overwrite` (the default) each value is inserted or replaced; with `append`, a field that already has a stored value for the entity, even an empty or will-not-map one, is left alone and counted in `skipped`. `wnm` stores a will-not-map marker instead of a value. An empty value is stored as empty, which the tag skips; to remove a value, delete it. Queues tag rebuilds for the publishers the changed values reach that use the integration: every one for an integration-level value, those with a config (ad unit) on the ad stack, those in the organisation or an organisation below it, or the one publisher. Only publishers whose built config changes are rebuilt; when more than 25 publishers are reached, the check runs in background tasks. With `report_redundant`, also returns the lower-level values the saved ones have made redundant, for you to delete if you choose. For records across several integrations, use `POST /v1/mapping/apply`.



## OpenAPI

````yaml /openapi.json post /v1/integration/{id}/mapping/apply
openapi: 3.0.1
info:
  title: CI Public API
  description: >-
    # Introduction

    Welcome to the Content Ignite API. A central place for all Content Ignite
    functionality.


    This API enforces a separation between function and form, meaning anything
    you can do in our platforms can be replicated in your own bespoke solution.


    # Authentication

    Authentication is handled via JWTs. You can retrieve your unique JSON Web
    Token from the settings page in the platform, which needs to be passed in
    with every request.

    To do this, simple include it in an Authorization header with the "Bearer"
    key word.


    Please contact support for help getting started.


    # Error Codes

    This is a fully RESTful API, so prepare for a number of different HTTP
    status codes.


    There is also a standard "success" field returned for each request. This
    boolean value can provide a first check against a response.


    ## Errors any endpoint can return

    Every signed-in endpoint can also return these, so they aren't listed on
    each one:


    - `401` Unauthorized: no valid token was sent. It's missing, invalid,
    expired or revoked.

    - `403` Forbidden with `code` `session_invalid`: your user or organisation
    no longer exists, or you were removed from the organisation. Sign in again.

    - `403` Forbidden with `code` `insufficient_scope` ("This sign-in is
    read-only"): an OAuth (MCP) sign-in with read access tried to make a change.

    - `403` Forbidden with `code` `organisation_unavailable`: an OAuth (MCP)
    sign-in has lost access to its organisation. Switch to another organisation.

    - `503` Service Unavailable: "System is down for scheduled maintenance". Try
    again later.


    # Rate limit

    We reserve the right to block requests if we deem a client to be abusing the
    API.
  version: 1.0.0
servers:
  - url: https://api.tagdeliver.com
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Publisher
  - name: Publisher/Publisher Tag
  - name: Publisher/Config (Ad unit)
  - name: Publisher/App Placement
  - name: Publisher/Publisher Stack
  - name: Publisher/Experiment
  - name: Publisher/Publisher Meta
  - name: Publisher/Debugging
  - name: Ad Stack
  - name: Ad Stack/Integration
  - name: Integration
  - name: Integration/Authentication
  - name: Integration/Mapping
  - name: Mapping
  - name: Reporting
  - name: Reporting/Revenue Reports
  - name: Reporting/Insights Hub
  - name: Reporting/Insights Hub/Ads.txt Insights
  - name: Reporting/Insights Hub/Benchmarking
  - name: Reporting/Insights Hub/Core Web Vitals
  - name: Reporting/Insights Hub/Diagnostics
  - name: Reporting/Insights Hub/Demand Mix
  - name: Reporting/Insights Hub/Live Insights
  - name: Reporting/Insights Hub/Metrics
  - name: Reporting/Insights Hub/Revenue Analytics
  - name: Reporting/Insights Hub/Revenue Insights
  - name: Reporting/Insights Hub/SSP Insights
  - name: Reporting/Campaign Reports
  - name: Reporting/Experiment Reporting
  - name: Reporting/Health Check
  - name: Reporting/Ads.txt
  - name: Reporting/Utility
  - name: Audience
  - name: Audience/Segment
  - name: Organisation
  - name: Organisation/Organisation Meta
  - name: Organisation/Pricing
  - name: User
  - name: User/Account
  - name: Billing
  - name: Billing/Profile
  - name: Billing/Invoice
  - name: Audit Log
  - name: Search
  - name: Set-up
  - name: public
paths:
  /v1/integration/{id}/mapping/apply:
    post:
      tags:
        - Integration/Mapping
        - public
      summary: Apply mapping values to an integration
      description: >-
        Checks mapping records for one integration, as `POST
        /v1/integration/{id}/mapping/validate` does, and stores the valid ones.
        Valid records are written even when others fail; the refused ones are
        returned in `failed` and not written. Records are written one at a time,
        not in a transaction, so if one write fails, those before it stay. With
        `mode` `overwrite` (the default) each value is inserted or replaced;
        with `append`, a field that already has a stored value for the entity,
        even an empty or will-not-map one, is left alone and counted in
        `skipped`. `wnm` stores a will-not-map marker instead of a value. An
        empty value is stored as empty, which the tag skips; to remove a value,
        delete it. Queues tag rebuilds for the publishers the changed values
        reach that use the integration: every one for an integration-level
        value, those with a config (ad unit) on the ad stack, those in the
        organisation or an organisation below it, or the one publisher. Only
        publishers whose built config changes are rebuilt; when more than 25
        publishers are reached, the check runs in background tasks. With
        `report_redundant`, also returns the lower-level values the saved ones
        have made redundant, for you to delete if you choose. For records across
        several integrations, use `POST /v1/mapping/apply`.
      operationId: applyIntegrationMapping
      parameters:
        - name: id
          in: path
          description: >-
            Encoded integration ID (`iid`, base-36, as returned by `GET
            /v1/integration`), not the numeric integration ID.
          required: true
          example: ''
          schema:
            type: string
        - name: uid
          in: query
          description: >-
            Publisher ID. Looks the integration up among those available to this
            publisher's organisation instead of yours. Unless you're a platform
            admin, the publisher must be in your own organisation.
          required: false
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                mode:
                  type: string
                  title: Mode
                  description: >-
                    How to treat a field that already has a stored value for the
                    entity, including an empty or will-not-map one. Any other
                    value returns a `400`. Values: `overwrite` = Replace it
                    (default), `append` = Leave it and count the record as
                    skipped.
                  enum:
                    - overwrite
                    - append
                  default: overwrite
                records:
                  type: array
                  title: Records
                  description: >-
                    The mapping records for this integration. A record's own
                    `integration_id` is ignored. Missing is treated as an empty
                    list.
                  items:
                    type: object
                    title: Record
                    description: One mapping value for one field of one entity.
                    required:
                      - level
                      - field
                    properties:
                      level:
                        type: string
                        title: Level
                        description: >-
                          Where the value is set. The tag uses the most specific
                          value: config (ad unit), then publisher, then the
                          organisations (nearest first), then ad stack, then the
                          integration default. Values: `integration` =
                          Integration default, `ad_stack` = Ad stack,
                          `organisation` = Organisation, `publisher` =
                          Publisher, `config` = Config (ad unit).
                        enum:
                          - integration
                          - ad_stack
                          - organisation
                          - publisher
                          - config
                      entity_id:
                        type: integer
                        title: Entity ID
                        description: >-
                          The ad stack ID, organisation ID, publisher ID (uid)
                          or config (ad unit) ID for the level. Required at
                          every level except `integration`, where it's ignored.
                          A numeric string is accepted.
                        nullable: true
                      field:
                        type: string
                        title: Field
                        description: >-
                          Field key from the integration's field list (`GET
                          /v1/integration/{id}/fields`), matched exactly.
                          Sub-fields of an object setting use a dotted path.
                          `approved` is the built-in approval field.
                      value:
                        title: Value
                        description: >-
                          The value, of the type the field's JSON Schema gives
                          (text, number, yes/no, list or object). A list
                          replaces the stored list. Ignored when `wnm` is true.
                          An empty value (null, empty text or an empty list)
                          skips the schema check and is stored as an empty
                          value, which the tag skips.
                      wnm:
                        type: boolean
                        title: Will not map
                        description: >-
                          Marks the field as deliberately left empty for this
                          entity (will not map). It clears the missing-mapping
                          warning but doesn't stop a value set at a higher level
                          from being used. Not allowed for `approved`. Defaults
                          to false.
                        default: false
                report_redundant:
                  type: boolean
                  title: Report redundant values
                  description: >-
                    Also returns, in `redundant`, the lower-level values the
                    saved ones have made redundant (the same value, which every
                    tag would resolve the same way without), limited to those
                    you could delete. Nothing is deleted. Defaults to false.
                  default: false
            example:
              mode: overwrite
              records:
                - level: publisher
                  entity_id: 18620
                  field: adSlot
                  value: example.com_leaderboard
                - level: organisation
                  entity_id: 3
                  field: publisherId
                  wnm: true
              report_redundant: true
        required: true
      responses:
        '200':
          description: 'OK: What was written, skipped and refused.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: object
                    properties:
                      applied:
                        type: integer
                        description: Records written.
                      skipped:
                        type: integer
                        description: >-
                          Valid records left alone because `mode` is `append`
                          and the field was already set.
                      failed:
                        type: array
                        description: >-
                          The refused records, not written, in the same shape as
                          validate's `rows`.
                        items:
                          type: object
                          properties:
                            index:
                              type: integer
                              description: The record's position in `records`, from 0.
                            valid:
                              type: boolean
                              description: Whether the record passed every check.
                            skipped:
                              type: boolean
                              description: >-
                                With `mode` `append`: the record is valid but
                                the field already has a stored value for the
                                entity, so apply leaves it alone. Always false
                                otherwise.
                            integration_id:
                              type: string
                              description: Encoded integration ID of the record.
                              nullable: true
                            field:
                              type: string
                              description: The record's field.
                              nullable: true
                            errors:
                              type: array
                              description: Why the record was refused. Empty when valid.
                              items:
                                type: string
                          required:
                            - index
                            - valid
                            - skipped
                            - integration_id
                            - field
                            - errors
                      redundant:
                        type: array
                        description: >-
                          Only with `report_redundant`: lower-level values the
                          saved ones made redundant, one group per integration
                          and field.
                        items:
                          type: object
                          properties:
                            integration_id:
                              type: string
                              description: Encoded integration ID.
                            field:
                              type: string
                              description: Field key.
                            title:
                              type: string
                              description: Field label.
                            value:
                              description: The saved value the records repeat.
                            records:
                              type: array
                              description: >-
                                The redundant values, ready to send to `DELETE
                                /v1/mapping`.
                              items:
                                type: object
                                properties:
                                  integration_id:
                                    type: string
                                    description: Encoded integration ID.
                                  level:
                                    type: string
                                    description: >-
                                      Level of the redundant value. Values:
                                      `integration` = Integration default,
                                      `ad_stack` = Ad stack, `organisation` =
                                      Organisation, `publisher` = Publisher,
                                      `config` = Config (ad unit).
                                    enum:
                                      - integration
                                      - ad_stack
                                      - organisation
                                      - publisher
                                      - config
                                  entity_id:
                                    type: integer
                                    description: Entity at that level.
                                    nullable: true
                                  field:
                                    type: string
                                    description: Field key.
                                  label:
                                    type: string
                                    description: Entity name.
                                    nullable: true
                                  child_org:
                                    type: boolean
                                    description: >-
                                      True when the value belongs to a different
                                      organisation from the one the saved value
                                      was set for.
                                required:
                                  - integration_id
                                  - level
                                  - entity_id
                                  - field
                                  - label
                                  - child_org
                          required:
                            - integration_id
                            - field
                            - title
                            - value
                            - records
                    required:
                      - applied
                      - skipped
                      - failed
                  success:
                    type: boolean
                    description: Always true.
                required:
                  - results
                  - success
              example:
                results:
                  applied: 1
                  skipped: 0
                  failed:
                    - index: 1
                      valid: false
                      skipped: false
                      integration_id: gjdi28
                      field: publisherId
                      errors:
                        - Only the integration's owner can set 'Publisher ID'
                  redundant:
                    - integration_id: gjdi28
                      field: adSlot
                      title: Ad Slot
                      value: example.com_leaderboard
                      records:
                        - integration_id: gjdi28
                          level: config
                          entity_id: 90211
                          field: adSlot
                          label: example.com · Leaderboard
                          child_org: false
                success: true
          headers: {}
        '400':
          description: >-
            Bad Request: `records` isn't a list, or `mode` isn't `overwrite` or
            `append`.
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                success: false
                message: records must be an array
          headers: {}
        '401':
          description: >-
            Unauthorized: No valid token was sent. It's missing, invalid,
            expired or revoked.
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                success: false
                message: Token not found.
          headers: {}
        '403':
          description: 'Forbidden: You don''t have permission to do this.'
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                success: false
                message: User forbidden
          headers: {}
        '404':
          description: >-
            Not Found: The integration doesn't exist or you can't access it, or
            `uid` names a publisher you can't access.
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                success: false
                message: Integration gjdikr Not Found
          headers: {}
        '500':
          description: >-
            Internal Server Error: An unexpected error. The message includes a
            reference to quote to support.
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                status: 500
                message: >-
                  An error occurred [4f2k], please try again shortly or contact
                  your account manager for further assistance.
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        A personal API token from the platform's settings page, or an OAuth
        access token.

````

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