> For a complete page index, fetch https://docs.synthflow.ai/llms.txt. For full documentation content, fetch https://docs.synthflow.ai/llms-full.txt. # Update a subaccount PUT https://api.synthflow.ai/v2/subaccounts/{subaccount_id} Content-Type: application/json Reference: https://docs.synthflow.ai/api-reference/platform-api/subaccounts/update-subaccount ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://api.synthflow.ai/v2` (Global, default) - `https://api.us.synthflow.ai/v2` (United States) - `https://api.eu.synthflow.ai/v2` (European Union) ## Request ### Path parameters - `subaccount_id` (string, required) — Subaccount ID. ### Body (application/json) This endpoint expects an object. - `subaccount_name` (string, optional) — The name for the new subaccount. This should be a unique identifier that distinguishes it from other subaccounts within the main account. - `invite_user_email` (string, optional) — This is the email address of the user you wish to invite to the subaccount. When this optional parameter is filled in, a "sign in" link will be generated and sent back in the response. The user can use this link to sign in and set up their account. - `pricing_tiers_attach` (list of SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaPricingTiersAttachItems, optional) — Pricing tier IDs that this subaccount can choose from when selecting a subscription plan. - `pricing_tiers_detach` (list of SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaPricingTiersDetachItems, optional) — Pricing tiers will be removed from this subaccount and will no longer be available for selection when choosing a subscription plan. - `import_subscription` (SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaImportSubscription, optional) — This section is used when you want to import an existing Stripe subscription for the subaccount - `twilio_account_sid` (string, optional) — This is the Twilio SID of the subaccount. - `twilio_auth_token` (string, optional) — This is the Twilio Token of the subaccount. - `concurrency` (integer, optional) — The maximum calls the subaccount can handle at once. - `max_agents` (integer, optional, nullable) — The maximum number of agents the subaccount is allowed to create. Null if no limit is set. - `max_minutes` (integer, optional, nullable) — The maximum number of minutes allocated to this subaccount. Null if no limit is set. - `max_workflow_runs` (integer, optional, nullable) — The maximum number of workflow runs allocated to this subaccount. Null if no limit is set. - `minutes_used` (integer, optional) — The minutes already consumed by this subaccount. Set it to `0` to reset usage, for example at the start of a customer's billing cycle. - `grant_permissions` (list of enum, optional) — Permissions to grant to the subaccount. Duplicate values are not allowed, and any value also present in `revoke_permissions` is rejected by the API. - Allowed values: `inbound`, `outbound`, `widget`, `chat`, `assistants`, `knowledge_base`, `actions`, `workflows`, `contacts`, `phone_numbers`, `logs`, `simulations`, `analytics` - `revoke_permissions` (list of enum, optional) — Permissions to revoke from the subaccount. Duplicate values are not allowed, and any value also present in `grant_permissions` is rejected by the API. - Allowed values: `inbound`, `outbound`, `widget`, `chat`, `assistants`, `knowledge_base`, `actions`, `workflows`, `contacts`, `phone_numbers`, `logs`, `simulations`, `analytics` - `operation_type` (enum, optional) — The type of operation to perform. You can import objects from the parent workspace to a subaccount or return objects from a subaccount in some cases. - Allowed values: `import`, `return` - `products` (SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaProducts, optional) — Objects to be imported to or returned from the subaccount_id ## Response ### 200 200 - `status` (string, optional) - `response` (SubaccountsSubaccountIdPutResponsesContentApplicationJsonSchemaResponse, optional) ## Errors ### 400 Bad Request Error 400 ### 401 Unauthorized Error Missing or invalid API credentials. - `detail` (ApiErrorDetail, optional) ### 500 Internal Server Error The request could not be completed. Read `detail.description` for the reason, then retry the same request. - `detail` (ApiErrorDetail, optional) ### 502 Bad Gateway Error The upstream service returned a body this API could not read. The write may or may not have been applied, so re-read the subaccount before retrying. - `detail` (ApiErrorDetail, optional) ## Types ### SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaPricingTiersAttachItems - `pricing_tier_id` (string, required) — The ID of the Synthflow pricing tier. ### SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaPricingTiersDetachItems - `pricing_tier_id` (string, required) — The ID of the Synthflow pricing tier. ### SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaImportSubscription This section is used when you want to import an existing Stripe subscription for the subaccount - `stripe_subscription_id` (string, optional) — The ID of the existing Stripe subscription you want to import. This is typically used when the subaccount already has a subscription set up in Stripe, and you want to link it to their Synthflow account. - `synthflow_price_id` (string, optional) — The ID of the Synthflow pricing tier that corresponds to the imported Stripe subscription. This allows you to map the external Stripe subscription to an equivalent plan within Synthflow. ### SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaProducts Objects to be imported to or returned from the subaccount_id - `phone_numbers` (list of SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaProductsPhoneNumbersItems, optional) — The list of numbers to be imported to or returned from the subaccount_id ### SubaccountsSubaccountIdPutResponsesContentApplicationJsonSchemaResponse - `subaccount_id` (string, optional) — Subaccount ID. - `api_key` (string, optional) - `user_email` (string, optional) - `sign_in_link` (string, optional) ### ApiErrorDetail - `status` (string, optional) - `description` (string, optional) — Human-readable reason for the failure. - `timestamp` (datetime, optional) — When the error was produced (ISO 8601). - `request_id` (string, optional) — Quote this when contacting support. - `category` (string, optional) ### SubaccountsSubaccountIdPutRequestBodyContentApplicationJsonSchemaProductsPhoneNumbersItems - `number` (string, optional) — The E.164 formatted phone number ## Examples **Request** ```json { "subaccount_name": "string", "max_agents": 5, "max_minutes": 1000, "max_workflow_runs": 500, "minutes_used": 0, "grant_permissions": [ "inbound", "outbound", "logs" ], "revoke_permissions": [ "widget", "phone_numbers" ], "operation_type": "import", "products": { "phone_numbers": [ { "number": "+12065550123" } ] } } ``` **Response** ```json { "status": "ok", "response": { "subaccount_id": "1726005822670x239735712159542050" } } ``` **SDK Code** ```python import requests url = "https://api.synthflow.ai/v2/subaccounts/1726005822670x239735712159542050" payload = { "subaccount_name": "string", "max_agents": 5, "max_minutes": 1000, "max_workflow_runs": 500, "minutes_used": 0, "grant_permissions": ["inbound", "outbound", "logs"], "revoke_permissions": ["widget", "phone_numbers"], "operation_type": "import", "products": { "phone_numbers": [{ "number": "+12065550123" }] } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.put(url, json=payload, headers=headers) print(response.json()) ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.synthflow.ai/v2/subaccounts/1726005822670x239735712159542050" payload := strings.NewReader("{\n \"subaccount_name\": \"string\",\n \"max_agents\": 5,\n \"max_minutes\": 1000,\n \"max_workflow_runs\": 500,\n \"minutes_used\": 0,\n \"grant_permissions\": [\n \"inbound\",\n \"outbound\",\n \"logs\"\n ],\n \"revoke_permissions\": [\n \"widget\",\n \"phone_numbers\"\n ],\n \"operation_type\": \"import\",\n \"products\": {\n \"phone_numbers\": [\n {\n \"number\": \"+12065550123\"\n }\n ]\n }\n}") req, _ := http.NewRequest("PUT", 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.synthflow.ai/v2/subaccounts/1726005822670x239735712159542050") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"subaccount_name\": \"string\",\n \"max_agents\": 5,\n \"max_minutes\": 1000,\n \"max_workflow_runs\": 500,\n \"minutes_used\": 0,\n \"grant_permissions\": [\n \"inbound\",\n \"outbound\",\n \"logs\"\n ],\n \"revoke_permissions\": [\n \"widget\",\n \"phone_numbers\"\n ],\n \"operation_type\": \"import\",\n \"products\": {\n \"phone_numbers\": [\n {\n \"number\": \"+12065550123\"\n }\n ]\n }\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.put("https://api.synthflow.ai/v2/subaccounts/1726005822670x239735712159542050") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"subaccount_name\": \"string\",\n \"max_agents\": 5,\n \"max_minutes\": 1000,\n \"max_workflow_runs\": 500,\n \"minutes_used\": 0,\n \"grant_permissions\": [\n \"inbound\",\n \"outbound\",\n \"logs\"\n ],\n \"revoke_permissions\": [\n \"widget\",\n \"phone_numbers\"\n ],\n \"operation_type\": \"import\",\n \"products\": {\n \"phone_numbers\": [\n {\n \"number\": \"+12065550123\"\n }\n ]\n }\n}") .asString(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.synthflow.ai/v2/subaccounts/1726005822670x239735712159542050"); var request = new RestRequest(Method.PUT); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"subaccount_name\": \"string\",\n \"max_agents\": 5,\n \"max_minutes\": 1000,\n \"max_workflow_runs\": 500,\n \"minutes_used\": 0,\n \"grant_permissions\": [\n \"inbound\",\n \"outbound\",\n \"logs\"\n ],\n \"revoke_permissions\": [\n \"widget\",\n \"phone_numbers\"\n ],\n \"operation_type\": \"import\",\n \"products\": {\n \"phone_numbers\": [\n {\n \"number\": \"+12065550123\"\n }\n ]\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "subaccount_name": "string", "max_agents": 5, "max_minutes": 1000, "max_workflow_runs": 500, "minutes_used": 0, "grant_permissions": ["inbound", "outbound", "logs"], "revoke_permissions": ["widget", "phone_numbers"], "operation_type": "import", "products": ["phone_numbers": [["number": "+12065550123"]]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.synthflow.ai/v2/subaccounts/1726005822670x239735712159542050")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PUT" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```