Account Management/
Using Account Management API/
Create an Account

Create an Account

POST Create an Account

https://api.moltin.com/v2/accounts/

Parameters

Headers

NameRequiredTypeDescription
AuthorizationRequiredstringThe Bearer token required to get access to the API.

Body

NameRequiredTypeDescription
typeRequiredstringSpecifies the the type of object. Set this value to account.
nameRequiredstringSpecifies the name of the account.
legal_nameRequiredstringSpecifies the legal name of the account.
registration_idOptionalstringSpecifies the registration ID. If specified, this field is checked for uniqueness.
parent_idOptionalstringSpecifies the ID of the parent account.

Request Examples

Curl

curl -X POST https://api.moltin.com/v2/accounts \
    -H "Authorization: Bearer XXXX" \
    -H "Content-Type: application/json" \
    -d $'{
     "data": {
       "type": "account",
       "name": "acc-name",
       "legal_name": "acc-legal-name",
       "registration_id": "00000000-0000-1000-8000-000f00000300",
       "parent_id": "96b1f750-55d3-4768-a3f8-adffba694a2c"
      }
    }'

JavaScript SDK

const MoltinGateway = require("@moltin/sdk").gateway;
const Moltin = MoltinGateway({
    client_id: "X",
    client_secret: "X",
});
const account = {
    type: "account",
    name: "acc-name",
    legal_name: "acc-legal-name",
    registration_id: "00000000-0000-1000-8000-000f00000300",
    parent_id: "96b1f750-55d3-4768-a3f8-adffba694a2c",
};
Moltin.Accounts.Create(account).then((acc) => {
    // Do something
});

Response Example

201 Created

{
    "data": {
        "id": "deb6b25f-8451-4211-9a22-95610333df23",
        "type": "account",
        "name": "acc-name",
        "legal_name": "acc-legal-name",
        "company_address": "company address",
        "registration_id": "00000000-0000-1000-8000-000f00000300",
        "relationships": {
            "parent": {
                "data": {
                    "id": "96b1f750-55d3-4768-a3f8-adffba694a2c",
                    "type": "account"
                }
            },
            "ancestors": [
                {
                    "data": {
                        "id": "96b1f750-55d3-4768-a3f8-adffba694a2c",
                        "type": "account"
                    }
                }
            ]
        },
        "meta": {
            "timestamps": {
                "created_at": "2021-02-23T09:40:33.882Z",
                "updated_at": "2021-02-23T09:40:33.882Z"
            }
        }
    },
    "links": {
        "self": "https://api.moltin.com/v2/accounts/deb6b25f-8451-4211-9a22-95610333df23"
    }
}

Was this helpful?

Previous
Get an Account

Learn

Docs