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

# /integration/:id/mapping/apply

> Validates mapping records for one integration and stores the valid ones; invalid records are returned in `failed` and not written. This is the only way to write per-field mapping for an integration (there is no unvalidated PUT).

- **Permission:** `integration.edit`; the integration must be available to the caller, otherwise 404.
- Runs exactly the checks of `POST /v1/integration/{id}/mapping/validate`; `failed` holds those rows (same shape). Valid records are written even when others fail.
- `mode: overwrite` (default) inserts or updates each valid record. `mode: append` skips a record whose (level, entity, field) already has a row, even a will-not-map or empty one, and counts it in `skipped`.
- Array values replace the stored array entirely. `wnm: true` stores a will-not-map marker (value null). Sending an empty value stores an empty row, which resolution skips; use `DELETE /v1/integration/{id}/mapping` to remove a row.
- Rows are written one by one, not in a transaction.
- Queues tag rebuilds for the publishers the written rows reach (integration level: every publisher using it; ad stack: publishers with units on it; organisation: its publishers and its child organisations'; publisher / ad unit: that publisher). Rebuilds are hash-compared so only real changes build; more than 25 publishers are checked in the background.
- For records spanning 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.


    # 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: Reporting
  - name: Reporting/Revenue Reports
  - name: Reporting/Experiment Reporting
  - name: Reporting/Campaign Reports
  - name: Reporting/Health Check
  - name: Reporting/Ads.txt
  - name: Reporting/Utility
  - name: Reporting/Insights Hub
  - name: Reporting/Insights Hub/SSP Insights
  - name: Reporting/Insights Hub/Core Web Vitals
  - name: Reporting/Insights Hub/Ads.txt Insights
  - name: Reporting/Insights Hub/Live Insights
  - name: Reporting/Insights Hub/Metrics
  - name: Reporting/Insights Hub/Diagnostics
  - name: Reporting/Insights Hub/Revenue Insights
  - name: Reporting/Insights Hub/Revenue Analytics
  - name: Reporting/Insights Hub/Demand Mix
  - name: Reporting/Insights Hub/Benchmarking
  - name: Organisation
  - name: Organisation/Organisation Meta
  - name: Organisation/Pricing
  - name: Ad Stack
  - name: Ad Stack/Integration
  - name: Publisher
  - name: Publisher/Publisher Stack
  - name: Publisher/Publisher Tag
  - name: Publisher/Publisher Meta
  - name: Publisher/Experiment
  - name: Publisher/Config (Ad unit)
  - name: Publisher/App Placement
  - name: AI
  - name: AI/Activity
  - name: Billing
  - name: Billing/Invoice
  - name: Audit Log
  - name: '[IN PROGRESS] Integration'
  - name: '[IN PROGRESS] Integration/Mapping'
  - name: '[IN PROGRESS] User'
  - name: '[IN PROGRESS] User/Account'
  - name: Mapping
  - name: public
paths:
  /v1/integration/{id}/mapping/apply:
    post:
      tags:
        - '[IN PROGRESS] Integration/Mapping'
        - public
      summary: /integration/:id/mapping/apply
      description: >-
        Validates mapping records for one integration and stores the valid ones;
        invalid records are returned in `failed` and not written. This is the
        only way to write per-field mapping for an integration (there is no
        unvalidated PUT).


        - **Permission:** `integration.edit`; the integration must be available
        to the caller, otherwise 404.

        - Runs exactly the checks of `POST
        /v1/integration/{id}/mapping/validate`; `failed` holds those rows (same
        shape). Valid records are written even when others fail.

        - `mode: overwrite` (default) inserts or updates each valid record.
        `mode: append` skips a record whose (level, entity, field) already has a
        row, even a will-not-map or empty one, and counts it in `skipped`.

        - Array values replace the stored array entirely. `wnm: true` stores a
        will-not-map marker (value null). Sending an empty value stores an empty
        row, which resolution skips; use `DELETE /v1/integration/{id}/mapping`
        to remove a row.

        - Rows are written one by one, not in a transaction.

        - Queues tag rebuilds for the publishers the written rows reach
        (integration level: every publisher using it; ad stack: publishers with
        units on it; organisation: its publishers and its child organisations';
        publisher / ad unit: that publisher). Rebuilds are hash-compared so only
        real changes build; more than 25 publishers are checked in the
        background.

        - For records spanning several integrations use `POST
        /v1/mapping/apply`.
      parameters:
        - name: id
          in: path
          description: >-
            Encoded integration id (an opaque base-36 string such as `gjdhye`,
            as returned by `GET /v1/integration`). Never the raw numeric id.
          required: true
          example: gjdhye
          schema:
            type: string
        - name: uid
          in: query
          description: >-
            Optional publisher uid. When given, the integration is looked up
            among those available to this publisher's organisation (and its
            parents) instead of the caller's own. The publisher must exist and
            not be archived; a restricted (non-core) caller may only pass a
            publisher of their own organisation, otherwise 404 `Not Found`.
          required: false
          example: 12345
          schema:
            type: integer
            minimum: 1
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                mode:
                  type: string
                  enum:
                    - overwrite
                    - append
                  default: overwrite
                  description: >-
                    `overwrite` (default) upserts every valid record. `append`
                    skips a record when its (level, entity, field) already has a
                    row, including a will-not-map or empty one. Any other value
                    behaves as `overwrite`.
                records:
                  type: array
                  description: >-
                    Candidate records. Each is checked against this
                    integration's catalogue; a record's own `integration_id`, if
                    sent, is ignored.
                  items:
                    type: object
                    description: One per-field mapping record.
                    properties:
                      level:
                        type: string
                        enum:
                          - integration
                          - ad_stack
                          - organisation
                          - publisher
                          - config
                        description: >-
                          Mapping level: `integration` (the integration
                          default), `ad_stack`, `organisation`, `publisher` or
                          `config` (an ad unit).
                      entity_id:
                        type: integer
                        description: >-
                          Ad stack id, organisation id, publisher uid or ad unit
                          (config) id for the level. Required for every level
                          except `integration`, where it is ignored. A numeric
                          string is accepted.
                        nullable: true
                      field:
                        type: string
                        description: >-
                          Field key from `GET /v1/integration/{id}/fields`
                          (exact match; dotted for object sub-fields, e.g.
                          `video.mimes`; `approved` for the built-in approval
                          field).
                      value:
                        description: >-
                          The value: a scalar, or an array for array fields
                          (replaces the stored array entirely). Checked against
                          the field's JSON Schema unless empty or `wnm` is true.
                          Any JSON type.
                      wnm:
                        type: boolean
                        default: false
                        description: >-
                          Will not map: acknowledges the field is deliberately
                          left empty at this entity. The value is ignored and
                          stored as null. Not allowed for `approved`.
                    required:
                      - level
                      - field
              required:
                - records
            example:
              mode: append
              records:
                - level: publisher
                  entity_id: 12345
                  field: adSlot
                  value: '38519891'
                - level: config
                  entity_id: 67890
                  field: video.mimes
                  value:
                    - video/mp4
                    - video/webm
                - level: publisher
                  entity_id: 12377
                  field: pmzoneid
                  wnm: true
                - level: publisher
                  entity_id: 99999
                  field: placement
                  value: abc
        required: true
      responses:
        '200':
          description: Write summary.
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: object
                    properties:
                      applied:
                        type: integer
                        description: Records written (inserted or updated).
                      skipped:
                        type: integer
                        description: >-
                          Valid records left alone in `append` mode because a
                          row already existed. Always 0 in `overwrite` mode.
                      failed:
                        type: array
                        description: Invalid records, not written (validate's row shape).
                        items:
                          type: object
                          description: The outcome for one submitted record.
                          properties:
                            index:
                              type: integer
                              description: >-
                                Position of the record in the submitted
                                `records` array (0-based).
                            valid:
                              type: boolean
                              description: True when the record has no errors.
                            integration_id:
                              type: string
                              description: >-
                                Encoded id of the integration the record was
                                checked against (the path `{id}`). Returned as a
                                number if the encoded id happens to be all
                                digits.
                            field:
                              type: string
                              description: >-
                                The record's field key, as sent (null if
                                missing).
                              nullable: true
                            errors:
                              type: array
                              description: Why the record is invalid; empty when valid.
                              items:
                                type: string
                          required:
                            - index
                            - valid
                            - integration_id
                            - field
                            - errors
                    required:
                      - applied
                      - skipped
                      - failed
                  success:
                    type: boolean
                    description: Always true on success.
                required:
                  - results
                  - success
              example:
                results:
                  applied: 2
                  skipped: 1
                  failed:
                    - index: 3
                      valid: false
                      integration_id: gjdhye
                      field: placement
                      errors:
                        - Unknown field 'placement' for this integration
                        - Unknown publisher 99999
                success: true
          headers: {}
        '400':
          description: '`records` isn''t an array.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: What went wrong.
                  success:
                    type: boolean
                    description: Always false on an error.
                required:
                  - message
                  - success
              example:
                message: records must be an array
                success: false
          headers: {}
        '403':
          description: Missing the required permission.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: What went wrong.
                  success:
                    type: boolean
                    description: Always false on an error.
                required:
                  - message
                  - success
              example:
                message: User forbidden
                success: false
          headers: {}
        '404':
          description: >-
            The integration (or another referenced entity) doesn't exist or
            isn't available to the caller.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: What went wrong.
                  success:
                    type: boolean
                    description: Always false on an error.
                required:
                  - message
                  - success
              example:
                message: Integration gjdhye Not Found
                success: false
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

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