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

# Backfill Contact Analysis Data

> Trigger a backfill job that re-applies analysis data mappings to contacts using historical call and SMS chat data. Only one backfill job can run per organization at a time. Select contact_memory to rewrite memory from matching ended phone calls and SMS chats in chronological order, one conversation at a time, with no conversation-count cap. Backfill starts with the contact's existing memory. Each rewrite builds on the previous result, and the final successful result is saved once per contact. When mapped analysis fields and contact_memory are selected together, they are saved together in one contact update. Memory rewrites use the currently stored contact fields.



## OpenAPI

````yaml openapi-final post /backfill-contact-analysis-data
openapi: 3.0.3
info:
  title: Retell SDK
  version: 3.0.0
  x-retell-spec-revision: 2026-10-04-3cbc602
  contact:
    name: Retell Support
    url: https://www.retellai.com/
    email: support@retellai.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.retellai.com
    description: The production server.
security:
  - api_key: []
paths:
  /backfill-contact-analysis-data:
    post:
      description: >-
        Trigger a backfill job that re-applies analysis data mappings to
        contacts using historical call and SMS chat data. Only one backfill job
        can run per organization at a time. Select contact_memory to rewrite
        memory from matching ended phone calls and SMS chats in chronological
        order, one conversation at a time, with no conversation-count cap.
        Backfill starts with the contact's existing memory. Each rewrite builds
        on the previous result, and the final successful result is saved once
        per contact. When mapped analysis fields and contact_memory are selected
        together, they are saved together in one contact update. Memory rewrites
        use the currently stored contact fields.
      operationId: backfillContactAnalysisData
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                backfill_call_filter:
                  type: object
                  description: >-
                    Optional filter to scope which conversations are processed.
                    Supports agent and start_timestamp from the standard call
                    filter. The same filter applies to phone calls and SMS chats
                    for both analysis data mappings and contact_memory.
                  properties:
                    agent:
                      type: array
                      items:
                        $ref: '#/components/schemas/AgentFilter'
                      description: Filter conversations by agent. Agents are OR-connected.
                    start_timestamp:
                      oneOf:
                        - $ref: '#/components/schemas/NumberFilter'
                        - $ref: '#/components/schemas/RangeFilter'
                      description: Filter conversations by start timestamp (epoch ms).
                backfill_attributes:
                  type: array
                  items:
                    type: string
                  minItems: 1
                  maxItems: 200
                  description: >-
                    Contact fields to recompute. Each one must still exist as a
                    contact field and have an analysis data mapping configured,
                    except for the built-in contact_memory attribute, which
                    requires no mapping and supports requests on its own or
                    alongside mapped fields. Memory backfill skips conversations
                    without retained transcripts.
                  example:
                    - contact_memory
              required:
                - backfill_attributes
      responses:
        '201':
          description: Backfill job started.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobStatus'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Retell from 'retell-sdk';

            const client = new Retell({
              apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.contact.backfillAnalysisData({
              backfill_attributes: ['contact_memory'],
            });

            console.log(response.status);
        - lang: Python
          source: |-
            import os
            from retell import Retell

            client = Retell(
                api_key=os.environ.get("RETELL_API_KEY"),  # This is the default and can be omitted
            )
            response = client.contact.backfill_analysis_data(
                backfill_attributes=["contact_memory"],
            )
            print(response.status)
components:
  schemas:
    AgentFilter:
      type: object
      required:
        - agent_id
      properties:
        agent_id:
          type: string
          minLength: 1
          description: The agent ID to filter on.
        version:
          type: array
          items:
            type: number
          description: >-
            Specific versions to filter on. If omitted or empty, all versions
            are included.
    NumberFilter:
      type: object
      required:
        - type
        - op
        - value
      properties:
        type:
          type: string
          enum:
            - number
        op:
          type: string
          enum:
            - eq
            - ne
            - gt
            - ge
            - lt
            - le
          description: >-
            eq: equal, ne: not equal, gt: greater than, ge: greater than or
            equal, lt: less than, le: less than or equal
        value:
          type: number
    RangeFilter:
      type: object
      required:
        - type
        - op
        - value
      properties:
        type:
          type: string
          enum:
            - range
        op:
          type: string
          enum:
            - bt
          description: 'bt: between'
        value:
          type: array
          minItems: 2
          maxItems: 2
          items:
            type: number
          description: '[lower_bound, upper_bound]'
    JobStatus:
      type: object
      required:
        - status
      properties:
        status:
          type: string
          enum:
            - queued
            - running
            - idle
        start_timestamp:
          type: number
          description: Epoch milliseconds when the job started.
        succeeded:
          type: number
          description: Number of items processed successfully so far.
        failed:
          type: number
          description: Number of items that errored so far.
        triggered_by:
          type: string
          description: >-
            Whether the job was started by an explicit API call (`manual`) or by
            the scheduled sync (`cron`).
          enum:
            - manual
            - cron
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              message:
                type: string
                example: Invalid request format, please check API reference.
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              message:
                type: string
                example: API key is missing or invalid.
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              message:
                type: string
                example: Account rate limited, please throttle your requests.
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              message:
                type: string
                example: An unexpected server error occurred.
  securitySchemes:
    api_key:
      type: http
      scheme: bearer
      bearerFormat: string
      description: >-
        Authentication header containing API key (find it in dashboard). The
        format is "Bearer YOUR_API_KEY"

````

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