> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # Create Subprojects POST https://YOUR_SPACE.signalwire.com/api/laml/2010-04-01/Accounts Content-Type: application/x-www-form-urlencoded Creates a subproject beneath the project used to authenticate the request and returns it as an Account. Use this route for integrations built around Account SIDs and form-encoded requests; use [Create a subproject](/docs/apis/rest/projects/create-subproject) for a JSON request. #### Permissions The API token used to authenticate must have the following scope(s) enabled to make a successful request: _Management_. [Learn more about API scopes](/docs/platform/your-signalwire-api-space). Reference: https://signalwire.com/docs/compatibility-api/rest/accounts/create-subprojects ## Authentication - `Authorization` header (basic auth, required) — SignalWire Basic Authentication using Project ID and API Token. The client sends HTTP requests with the Authorization header containing the word Basic followed by a space and a base64-encoded string of project_id:token. The project ID will be used as the username and the API token as the password. Example: ``` Authorization: Basic base64(project_id:token) ``` ## Request ### Body (application/x-www-form-urlencoded) This endpoint expects a CreateSubprojectRequest. - `FriendlyName` (string, required) — The name of the Project, up to 250 characters long. ## Response ### 201 Response containing a newly created subproject account. - `sid` (string, required) — The unique identifier for this Project. - `friendly_name` (string, required) — The name of the Project. - `status` (enum, required) — The status of the Project. Always 'active'. - Allowed values: `active` - `auth_token` (string, required) — The authorization token for this Project. Always returns 'redacted' for security. - `date_created` (string, required) — The date and time this Project was created, in RFC 2822 format. - `date_updated` (string, required) — The date and time this Project was last updated, in RFC 2822 format. - `type` (enum, required) — The type of the Project. Always 'Full'. - Allowed values: `Full` - `owner_account_sid` (string, required) — The Project ID of the parent project. For parent projects, this is the same as sid. - `region_preference` (string, required) — The preferred region for the Project. - `uri` (string, required) — The URI for the Project. - `subproject` (boolean, required) — Whether this project is a sub-project of another project. - `signing_key` (string, required, nullable) — The signing key for the Project. Only returned once when a subproject is created. Subsequent requests return null. - `subresource_uris` (SubresourceUris, required) — A map of URIs for sub-resources linked to this Project. ## Errors ### 400 Bad Request Error The request was invalid or cannot be processed. Check the error details for more information. - `code` (integer, required) — Error code. - `message` (string, required) — Error message. - `more_info` (string, required) — URL for more information about the error. - `status` (integer, required) — HTTP status code. ### 401 Unauthorized Error Authentication failed. Please verify your credentials and try again. - `code` (integer, required) — Error code. - `message` (string, required) — Error message. - `more_info` (string, required) — URL for more information about the error. - `status` (integer, required) — HTTP status code. ### 422 Unprocessable Entity Error The request could not be processed due to validation errors. Check the error details for more information. - `code` (integer, required) — Error code. - `message` (string, required) — Error message. - `more_info` (string, required) — URL for more information about the error. - `status` (integer, required) — HTTP status code. ## Types ### SubresourceUris A Map of sub-resources that are linked to the given Project. - `addresses` (any, required) — URI for addresses. Not supported. - `available_phone_numbers` (string, required) — URI for available phone numbers. - `applications` (string, required) — URI for applications. - `authorized_connect_apps` (any, required) — URI for authorized connect apps. Not supported. - `calls` (string, required) — URI for calls. - `conferences` (string, required) — URI for conferences. - `connect_apps` (any, required) — URI for connect apps. Not supported. - `incoming_phone_numbers` (string, required) — URI for incoming phone numbers. - `keys` (any, required) — URI for keys. Not supported. - `notifications` (any, required) — URI for notifications. Not supported. - `outgoing_caller_ids` (any, required) — URI for outgoing caller IDs. Not supported. - `queues` (string, required) — URI for queues. - `recordings` (string, required) — URI for recordings. - `sandbox` (any, required) — URI for sandbox. Not supported. - `sip` (any, required) — URI for SIP. Not supported. - `short_codes` (any, required) — URI for short codes. Not supported. - `messages` (string, required) — URI for messages. - `transcriptions` (string, required) — URI for transcriptions. - `usage` (any, required) — URI for usage. Not supported. ## Examples **Request** ```json { "FriendlyName": "My Project" } ``` **Response** ```json { "sid": "b3877c40-da60-4998-90ad-b792e98472af", "friendly_name": "My Project", "status": "active", "auth_token": "redacted", "date_created": "Sat, 15 Sep 2018 10:00:00 +0000", "date_updated": "Sat, 16 Sep 2018 10:00:00 +0000", "type": "Full", "owner_account_sid": "b3877c40-da60-4998-90ad-b792e98472af", "region_preference": "us-east", "uri": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af", "subproject": false, "signing_key": null, "subresource_uris": { "addresses": null, "available_phone_numbers": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/AvailablePhoneNumbers", "applications": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Applications", "authorized_connect_apps": null, "calls": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Calls", "conferences": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Conferences", "connect_apps": null, "incoming_phone_numbers": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/IncomingPhoneNumbers", "keys": null, "notifications": null, "outgoing_caller_ids": null, "queues": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Queues", "recordings": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Recordings", "sandbox": null, "sip": null, "short_codes": null, "messages": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Messages", "transcriptions": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Transcriptions", "usage": null } } ``` **SDK Code** ```python import requests url = "https://your_space.signalwire.com/api/laml/2010-04-01/Accounts" payload = "" headers = { "Content-Type": "application/x-www-form-urlencoded" } response = requests.post(url, data=payload, headers=headers, auth=("", "")) print(response.json()) ``` ```javascript const url = 'https://your_space.signalwire.com/api/laml/2010-04-01/Accounts'; const credentials = btoa(":"); const options = { method: 'POST', headers: { Authorization: `Basic ${credentials}`, 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams('') }; 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" "net/http" "io" ) func main() { url := "https://your_space.signalwire.com/api/laml/2010-04-01/Accounts" req, _ := http.NewRequest("POST", url, nil) req.SetBasicAuth("", "") req.Header.Add("Content-Type", "application/x-www-form-urlencoded") 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://your_space.signalwire.com/api/laml/2010-04-01/Accounts") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request.basic_auth("", "") request["Content-Type"] = 'application/x-www-form-urlencoded' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://your_space.signalwire.com/api/laml/2010-04-01/Accounts") .basicAuth("", "") .header("Content-Type", "application/x-www-form-urlencoded") .asString(); ``` ```php request('POST', 'https://your_space.signalwire.com/api/laml/2010-04-01/Accounts', [ 'form_params' => null, 'headers' => [ 'Content-Type' => 'application/x-www-form-urlencoded', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://your_space.signalwire.com/api/laml/2010-04-01/Accounts"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/x-www-form-urlencoded"); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let credentials = Data(":".utf8).base64EncodedString() let headers = [ "Authorization": "Basic \(credentials)", "Content-Type": "application/x-www-form-urlencoded" ] let request = NSMutableURLRequest(url: NSURL(string: "https://your_space.signalwire.com/api/laml/2010-04-01/Accounts")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers 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() ```