Create an Account
POSThttps://useast.api.elasticpath.com/v2/accounts
With the account creation endpoint, you have the ability to create accounts which can optionally have another account as a parent.
Request
Responses
- 201
- 400
- default
Created
Bad Request
Internal server error.
Authorization: http
name: BearerTokentype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://useast.api.elasticpath.com/v2/accounts");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"account\",\n \"name\": \"acc-name\",\n \"legal_name\": \"acc-legal-name\",\n \"registration_id\": \"reg-id\",\n \"external_ref\": \"ext-ref\",\n \"parent_id\": \"96b1f750-55d3-4768-a3f8-adffba694a2c\"\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear