---
title: "Controller Handle Update Audience"
method: POST
path: "/audience"
tags: ["audience"]
---

# Controller Handle Update Audience

`POST /audience`

Update an audience

## Request body

- UpdateAudiencePayload
  - `parsed_json` object, required — The JSON SQL to update the audience with
  - `audience` Audience, required
    - `id` string — ID of this object.
    - `_markedForDeletion` boolean — marked if record has been soft-deleted.
    - `created_at` union — datetime object representing when this object was created.
      - string, date-time
      - object
    - `updated_at` union — datetime object representing when this object was updated.
      - string, date-time
      - object
    - `name` string, required — The name of the audience.
    - `description` string — description of the audience.
    - `owner` string, required — The owner of the audience.
    - `teamId` string, required — The team ID associated with the audience.
    - `projectId` string, required — The ID of the project associated with the audience.
    - `chatRecordId` string, nullable — The ID of the chat record associated with the audience.
    - `state` 'PENDING' | 'IN_PROGRESS' | 'SUCCEEDED' | 'FAILED' | 'UNKNOWN_TIMEOUT' — Celery task status enum. Update apps/web-backend-api/src/types/TaskStatusEnum.ts if you update this enum.
    - `audienceSql` string, required — The SQL query defining the audience.
    - `audienceQueryJson` string, nullable — The JSON defining the audience query.
    - `saved_to_db` boolean, required — Whether the audience is saved to the database.
    - `llm_generated` boolean, nullable — Whether the audience was generated by LLM.
    - `isGlobalAudience` boolean — Whether the audience is global or pre-generated.
    - `isSavedByUser` boolean — Whether the audience was saved by the user.
    - `audienceInsights` object — Insights related to the audience.
    - `bannerImagePath` string — storage path for the audience banner.
    - `data` unknown[] — The data for the audience.
      - unknown
    - `sources` object, nullable — The source tables used for the audience.
    - `comment` union — details on failure.
      - string
      - object
    - `imported` boolean — Whether the audience was imported.
    - `num_rows` integer — The number of rows in the audience.
    - `last_refreshed` string, date-time, nullable — datetime object representing when this audience was last refreshed.
    - `distribution_invalidity` object, nullable — Dict representing validity to distribute audience to various targets.
    - `startingAudienceId` string, nullable — Base audience id

## Response `201`

Successful Response

- unknown

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