> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.mixlayer.com/api-reference/platform-api/organizations/update-organization/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mixlayer.com/_mcp/server. # Update an organization PATCH https://api.mixlayer.com/v1/organizations/{org_id} Content-Type: application/json When authenticated with an API key, this operation requires `api-admin`. Reference: https://docs.mixlayer.com/api-reference/platform-api/organizations/update-organization ## Authentication - `Authorization` header (bearer token, required) — Console user session or Mixlayer API key supplied as a Bearer token. ## Request ### Path parameters - `org_id` (string, required) — Organization ID ### Body (application/json) This endpoint expects an UpdateOrganizationRequest. - `data_persistence` (DataPersistenceConfig, optional) — Stored-response persistence settings. `stored_responses_days` overrides the default 30-day retention for Responses API requests using `store: true`; values must be 0 through 90, and 0 disables storage. - `name` (string, optional) — New organization name. Whitespace is trimmed and the resulting name must not be empty. ## Response ### 200 Updated organization - `data` (ApiDataResponseOrganizationDetailData, required) — Organization details with the caller's role and current member counts. ## Errors ### 400 Bad Request Error The request body contains malformed JSON or invalid values. - `error` (ApiErrorBody, required) — Structured error details. ### 401 Unauthorized Error Authentication is missing or invalid. - `error` (ApiErrorBody, required) — Structured error details. ### 403 Forbidden Error The authenticated principal cannot perform this operation. - `error` (ApiErrorBody, required) — Structured error details. ### 404 Not Found Error Organization not found - `error` (ApiErrorBody, required) — Structured error details. ### 413 Content Too Large Error The request body exceeds the configured size limit. - `error` (ApiErrorBody, required) — Structured error details. ### 415 Unsupported Media Type Error The request does not have a JSON content type. - `error` (ApiErrorBody, required) — Structured error details. ### 422 Unprocessable Entity Error The JSON body does not match the request schema or contains a rejected field value. - `error` (ApiErrorBody, required) — Structured error details. ### 500 Internal Server Error An unexpected server or database error occurred. - `error` (ApiErrorBody, required) — Structured error details. ## Types ### DataPersistenceConfig Organization data-persistence settings accepted and exposed by the APIs. - `stored_responses_days` (integer, optional, nullable) — Stored-response retention in days for Responses API requests using `store: true`. Overrides the default 30-day retention; zero disables storage. ### ApiDataResponseOrganizationDetailData Organization details with the caller's role and current member counts. - `billing_account_id` (string, required) — Billing account attached to the organization. - `created_at` (datetime, required) — Time the organization was created. - `data_persistence` (DataPersistenceConfig, required) — Organization data-persistence settings exposed by the API. - `id` (string, required) — Stable organization identifier. - `is_personal` (boolean, required) — Whether this is a console user's personal organization. - `name` (string, required) — Organization name. - `updated_at` (datetime, required) — Time the organization was last updated. - `counts` (OrganizationCounts, required) — Current organization membership counts. - `role` (enum, required) — Authenticated console user's role, or `member` for an organization-scoped API key. - Allowed values: `primary_owner`, `owner`, `member` ### ApiErrorBody Structured error details returned by the platform API. - `message` (string, required) — Human-readable error message. - `code` (string, optional, nullable) — Stable machine-readable error code, when available. - `details` (any, optional) — Error-specific structured context, when available. ### OrganizationCounts Current organization membership counts. - `members` (long, required) — Total active organization members. - `primary_owners` (long, required) — Active primary owners. ## Examples **Request** ```json {} ``` **Response** ```json { "data": { "billing_account_id": "string", "created_at": "2024-01-15T09:30:00Z", "data_persistence": { "stored_responses_days": 1 }, "id": "string", "is_personal": true, "name": "string", "updated_at": "2024-01-15T09:30:00Z", "counts": { "members": 1, "primary_owners": 1 }, "role": "primary_owner" } } ``` **SDK Code** ```python import requests url = "https://api.mixlayer.com/v1/organizations/org_id" payload = {} headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.mixlayer.com/v1/organizations/org_id'; const options = { method: 'PATCH', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.mixlayer.com/v1/organizations/org_id" payload := strings.NewReader("{}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.mixlayer.com/v1/organizations/org_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://api.mixlayer.com/v1/organizations/org_id") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('PATCH', 'https://api.mixlayer.com/v1/organizations/org_id', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ```