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

# Update Static Audience

> This API **replaces** all customers in an existing **Static** Audience with the records provided in the uploaded file. After processing, the audience will contain only the customers from the newly uploaded file, and all previously stored customer records will be removed.

#### Body Parameters (multipart/form-data)
-  `audience_file` **(required)**: A CSV or Excel file with the updated customers data. Use `@` followed by the local file path (Example: audience_file=@/Users/john/downloads/audience.csv) 

#### Note:
- HTTP method must be PUT
- Only **Static** audiences can be updated. Attempting to update a **Dynamic** audience will return '400 - Bad Request'.
- Only the audience_file field is accepted; no other audience properties can be modified through this endpoint.

## OpenAPI

````json PUT /Audiences/{AUDIENCE_ID}
{
  "openapi": "3.0.3",
  "info": {
    "title": "CommBox API",
    "x-logo": {
      "url": "https://www.commbox.io/logo/commbox_logo_large.png"
    },
    "version": "2.07",
    "termsOfService": "https://www.commbox.io/end-user-license-agreement-eula/",
    "contact": {
      "name": "commbox",
      "url": "https://www.commbox.io",
      "email": "contactus@commbox.io"
    }
  },
  "servers": [
    {
      "url": "https://api.commbox.io/",
      "description": "Production server"
    }
  ],
  "paths": {
    "/Audiences/{AUDIENCE_ID}": {
      "put": {
        "tags": [
          "Audiences"
        ],
        "summary": "Update Static Audience",
        "description": "This API **replaces** all customers in an existing **Static** Audience with the records provided in the uploaded file. After processing, the audience will contain only the customers from the newly uploaded file, and all previously stored customer records will be removed.\n\n#### Body Parameters (multipart/form-data)\n-  `audience_file` **(required)**: A CSV or Excel file with the updated customers data. Use `@` followed by the local file path (Example: audience_file=@/Users/john/downloads/audience.csv) \n\n#### Note:\n- HTTP method must be PUT\n- Only **Static** audiences can be updated. Attempting to update a **Dynamic** audience will return '400 - Bad Request'.\n- Only the audience_file field is accepted; no other audience properties can be modified through this endpoint.",
        "operationId": "Put_Audiences",
        "parameters": [
          {
            "name": "AUDIENCE_ID",
            "in": "path",
            "description": "A CommBox generated number for the Audience",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "audience_file"
                ],
                "properties": {
                  "audience_file": {
                    "type": "string",
                    "format": "binary",
                    "description": "URL of the CSV or Excel file with the updated customers' data",
                    "example": "audience_file=@/My Drive/NYC_Audience.csv"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 200
                    },
                    "description": {
                      "type": "string",
                      "example": "Operation successful"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2025-02-06T07:51:52.2581942Z"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The updated Audience ID",
                          "example": "312345"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Missing required fields, invalid file format, or missing phone1 column",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 400
                    },
                    "description": {
                      "type": "string",
                      "example": "Bad Request"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2025-02-06T07:51:52.2581942Z"
                    }
                  },
                  "required": [
                    "status",
                    "description"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing Bearer token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 401
                    },
                    "description": {
                      "type": "string",
                      "example": "Unauthorized"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2025-02-06T07:51:52.2581942Z"
                    }
                  },
                  "required": [
                    "status",
                    "description"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found - No audience exists with the given ID",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 404
                    },
                    "description": {
                      "type": "string",
                      "example": "Not Found"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2025-02-06T07:51:52.2581942Z"
                    }
                  },
                  "required": [
                    "status",
                    "description"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Too many requests have been made in a short period of time (Throttling)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 429
                    },
                    "description": {
                      "type": "string",
                      "example": "Too Many Requests – Rate limit exceeded"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2025-02-06T07:51:52.2581942Z"
                    }
                  },
                  "required": [
                    "status",
                    "description"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 500
                    },
                    "description": {
                      "type": "string",
                      "example": "Server Error"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2025-02-06T07:51:52.2581942Z"
                    }
                  },
                  "required": [
                    "status",
                    "description"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}
````

