---
title: "Controller Build Rfm Lookup"
method: POST
path: "/ad_analytics/rfm/build_lookup"
---

# Controller Build Rfm Lookup

`POST /ad_analytics/rfm/build_lookup`

Builds the lookup table for an RFM model

## Request body

- RFMBuildPayload
  - `product_selections` SelectionPayload, required
    - `selections` array[], required
      - Selection[]
        - `field` string, required
        - `values` string[], nullable, required
  - `audience_id` string, nullable — The ID of the audience to generate RFM segments for
  - `timeframe` SrcApiAdAnalyticsModelTimeframe
    - `start_date` string, date-time, required
    - `end_date` string, date-time, nullable, required
  - `upc_batch_id` integer, nullable — The ID of a UPC batch to use for product selections

## Response `201`

Successful Response

- SrcAsyncJobServiceBuildConcreteAsyncJobRecordClassLocalsConcreteAsyncJobRecord4
  - `id` integer, nullable — ID of this object.
  - `created_at` string, date-time, nullable — datetime object representing when this object was created.
  - `updated_at` string, date-time, nullable — datetime object representing when this object was updated.
  - `deleted_at` string, date-time, nullable — datetime object representing when this object was deleted.
  - `status` 'RUNNING' | 'COMPLETED' | 'FAILED'
  - `endpoint` string — Endpoint spawning async job
  - `request` union — request sent to endpoint
    - object
    - unknown[]
      - unknown
  - `sync_response` union — sync response
    - object
    - unknown[]
      - unknown
  - `error` string, nullable — error message
  - `response` RFM — Main RFM model for RFM analysis with equal-width segmentation and UPC upload support. Supports 1:N relationship with brands, sub-brands, products, and product categories.
    - `id` integer, nullable — ID of this object.
    - `created_at` string, date-time, nullable — datetime object representing when this object was created.
    - `updated_at` string, date-time, nullable — datetime object representing when this object was updated.
    - `deleted_at` string, date-time, nullable — datetime object representing when this object was deleted.
    - `async_job_id` integer, required — ID of the async job used for this RFM analysis.
    - `name` string, nullable — Optional name for this RFM analysis.
    - `audience_id` string, nullable — ID of the audience used for this RFM analysis.
    - `start_date` string, date-time, nullable — Start date for the RFM analysis.
    - `end_date` string, date-time, nullable — End date for the RFM analysis.
    - `upc_batch_id` integer, nullable — ID of the UPC batch used for this analysis.
    - `product_selections` object, nullable — Structured selection of brands, sub-brands, products, and categories for analysis.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/akk/apis/fastapi.md) · [All operations](https://skmtc.net/akk/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/akk/fastapi/versions/6662a407c637/schema)
