Composable Frontend 2.0 Learn more 

  • Commerce Cloud/
    Account Management/
    Using Account Management API/
    Update an Account

    Update an Account

    PUT Update an Account

    https://useast.api.elasticpath.com/v2/accounts/:id
    

    Parameters

    Path parameters

    NameRequiredTypeDescription
    idRequiredstringThe ID of the requested account.

    Headers

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

    Body

    NameRequiredTypeDescription
    typeRequiredstringSpecifies the type of object. You must use account.
    nameOptionalstringSpecifies the name of the account.
    legal_nameOptionalstringSpecifies the legal name of the account.
    registration_idOptionalstringSpecifies the registration id of the account.
    external_refOptionalstringThe unique attribute associated with the account. For example, this could be an external reference from a separate company system. The maximum length is 2048 characters. Default is null.

    Request Examples

    Curl

    curl -X PUT https://useast.api.elasticpath.com/v2/accounts/:id \
        -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"
          }
        }
    

    JavaScript SDK

    const MoltinGateway = require("@moltin/sdk").gateway;
    const Moltin = MoltinGateway({
        client_id: "X",
        client_secret: "X",
    });
    const accountId = "00000000-0000-0000-0000-000000000000";
    const account = {
        type: "account",
        name: "acc-name",
        legal_name: "acc-legal-name",
        registration_id: "00000000-0000-1000-8000-000f00000300",
        external_ref: "16bedceb-8b2d-4f82-a973-b0a8d8432708",
        parent_id: "96b1f750-55d3-4768-a3f8-adffba694a2c",
    };
    Moltin.Accounts.Update(accountId, account).then((acc) => {
        // Do something
    });
    

    Response Example

    200 OK

    {
      "data": {
        "id": "deb6b25f-8451-4211-9a22-95610333df23",
        "type": "account",
        "name": "acc-name",
        "legal_name": "acc-legal-name",
        "registration_id": "00000000-0000-1000-8000-000f00000300",
        "external_ref": "16bedceb-8b2d-4f82-a973-b0a8d8432708",
        "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://useast.api.elasticpath.com/v2/accounts/deb6b25f-8451-4211-9a22-95610333df23"
      }
    }
    
    Previous
    Create an Account