> For the complete documentation index, see [llms.txt](https://docs.shoplift.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shoplift.ai/api-reference/public-api/update-custom-audience.md).

# Update custom audience

Renames a custom audience and/or replaces its rules. Omit a field to leave it unchanged; `rules`, when sent, is the audience's complete new rule list: it is never merged, so any stored rule you leave out is removed. It is validated exactly like POST /custom-audiences, and an invalid rule rejects the whole request. Launched tests keep the rules they launched with; drafts use the new rules when they launch. A duplicate name returns 400.

```json
{"openapi":"3.1.1","info":{"title":"Shoplift Public API","version":"1.0.0"},"tags":[{"name":"Public API"}],"servers":[{"url":"https://app.shoplift.ai"}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"http","description":"All requests require `Authorization: Bearer sl_live_<your_api_key>`. Generate a key from the Shoplift admin's API Keys settings page.","scheme":"bearer"}},"schemas":{"UpdateAudienceRequest":{"type":"object","properties":{"name":{"type":["null","string"]},"rules":{"type":["null","array"],"items":{"$ref":"#/components/schemas/CustomAudienceRule"}}},"additionalProperties":false},"CustomAudienceRule":{"required":["dimension","operator","values"],"type":"object","properties":{"dimension":{"type":"string"},"operator":{"type":"string"},"values":{"type":"array","items":{"type":"string"}},"selector":{"type":["null","string"]}},"additionalProperties":false},"ExternalAudienceItem":{"required":["id","name","rules"],"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/ExternalAudienceRuleItem"}}}},"ExternalAudienceRuleItem":{"required":["dimension","operator","values"],"type":"object","properties":{"dimension":{"type":"string"},"operator":{"type":"string"},"values":{"type":"array","items":{"type":"string"}},"selector":{"type":["null","string"]}}},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"type":["null","integer"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}},"paths":{"/api/public/v1/custom-audiences/{id}":{"patch":{"tags":["Public API"],"summary":"Update custom audience","description":"Renames a custom audience and/or replaces its rules. Omit a field to leave it unchanged; `rules`, when sent, is the audience's complete new rule list: it is never merged, so any stored rule you leave out is removed. It is validated exactly like POST /custom-audiences, and an invalid rule rejects the whole request. Launched tests keep the rules they launched with; drafts use the new rules when they launch. A duplicate name returns 400.","operationId":"updateCustomAudience","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAudienceRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalAudienceItem"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}}}
```
