Create an Account

The Create an Account method allows to add a new Account.

 POST /api/vendor/v1/accounts.json?api_token={api_token}

Arguments


Name

Parameter Type

Data type

Required/Optional

Description

api_tokenquerystringRequiredAPI token of the manager who perform the operation (see API Token Authentication).

account_type_id

form

integer

Required

An account type ID.

primary_name

form

string

Optional

A company name, if the customer is a legal entity.

first_name

form

string

Required

The first name for the user the owner access rights.

middle_name

form

string

Optional

The middle name for the user the owner access rights.

last_name

form

string

Required

The last name for the user the owner access rights.

owner_id

form

integer

Optional

An ID of the existed user who will be granted the owner access rights in the Customer Control Panel.

manager_id

form

integer

Optional

A manager ID who will be linked with the account.

account_class_id

form

integer

Required

An account class ID (see Account classes in the ActivePlatform. Operator Control Panel).

country

form

string

Required

An account address: a two-letter ISO code ISO 3166-1 alpha-2 of the country.

region

form

string

Required

An account address: a region.

city

form

string

Required

An account address: a city.

street

form

string

Required

An account address: a street.

building

form

string

Required

An account address: building.

An account address: building.office

form

string

Required

An account address: office.

zip

form

string

Required

An account address: a zip-code.

phone

form

string

Required

A phone number of the account:

  • + < country code > < city code or network code > < phone number >
  • 00 < country code > < city code or network code > < phone number >

email

form

string

Required

A contact email of the account.

billing_dayformintegerOptionalA day of the month when the invoices are created.
custom_attributes[][key]

form

string

Depends on ID of the account type

A list of additional attributes (see Managing attributes in the ActivePlatform. Operator Control Panel).

The key that is used to determine the element in API (see Creating an attribute in the ActivePlatform. Operator Control Panel).

custom_attributes[][value]

form

Depends on attributeDepends on ID of the account typeA value of the attribute.

Response model

Name

Data type

Description

idintegerAn account ID.
namestringAn account name.
account_class_idintegerAn account class ID (see Account classes in the ActivePlatform. Operator Control Panel).
account_classstring

A name of the account class (see Account classes in the ActivePlatform. Operator Control Panel).

primary_namestringA company name, if the customer is a legal entity.
first_namestringThe first name for the user the owner access rights.
middle_namestringThe middle name for the user the owner access rights.
last_namestringThe last name for the user the owner access rights.
countrystringAn account address: a two-letter ISO code ISO 3166-1 alpha-2 of the country.
regionstringAn account address: a region.
citystringAn account address: a city.
streetstringAn account address: a street.
buildingstringAn account address: building.
officestringAn account address: office.
zipstringAn account address: a zip-code.
phonestring

A phone number of the account:

  • + < country code > < city code or network code > < phone number >
  • 00 < country code > < city code or network code > < phone number >
emailstring

A contact email of the account.

statusstring

A current account status:

balancefloatA current value of the account balance (see Viewing the List of Charges in the ActivePlatform. Operator Control Panel).
credit_limitfloat

A maximum amount of the credit that a customer can use for ordering services without topping up (the credit limit can be set manually or by default (see Account classes in the ActivePlatform. Operator Control Panel)).

account_type_idinteger

An ID of the account type.

account_typestringA name of the account type.
manager_idinteger

A manager ID who is linked with the account.

owner_idinteger

An ID of the existed user who is granted the owner access rights in the Customer Control Panel.

tech_user_idintegerAn ID of the user, which is responsible for the technical matters.
bill_user_idintegerAn ID of the user, which is responsible for the financial matters.
custom_attributesarray

A list of additional attributes (see Managing attributes in the ActivePlatform. Operator Control Panel):

  • name - a name of the attribute;

  • value - a value of the attribute.

created_atdateA date and time of the account's creation.
updated_atdateA date and time, when the account information was updated.

Request example

http://billing.activeplatform.com:80/api/vendor/v1/accounts.json?api_token=654321
{
  "account_type_id": 1,
  "first_name": "John",
  "last_name": "Doe",
  "account_class_id": 1,
  "country": "BY",
  "region": "Minsk",
  "city": "Minsk",
  "street": "Lenina",
  "building": "1",
  "office": "1",
  "zip": "220007",
  "phone": "+375290745930",
  "email": "doe.john777@activeplatform.com",
  "custom_attributes": [
    {
      "key": "birth_date",
      "value": "10.08.2016"
    },
    {
      "key": "passport_date_of_issue",
      "value": "01.07.2016"
    },
    {
      "key": "passport_issued_by",
      "value": "Goverment"
    },
    {
      "key": "personal_number",
      "value": "A4411111BB111"
    },
    {
      "key": "passport_number",
      "value": "1124111111111"
    }
  ]
}

Response example

If the Account is successfully created, the method returns:

{
  "id": 2000712,
  "name": "John Doe",
  "account_class_id": 1,
  "account_class": "Default",
  "primary_name": "",
  "first_name": "John",
  "middle_name": null,
  "last_name": "Doe",
  "country": "BY",
  "region": "Minsk",
  "city": "Minsk",
  "street": "Lenina",
  "building": "1",
  "office": "1",
  "zip": "220007",
  "phone": "+375290745930",
  "email": "doe.john777@activeplatform.com",
  "status": "active",
  "balance": 0,
  "credit_limit": 100,
  "account_type_id": 1,
  "account_type": "Personal",
  "manager_id": null,
  "owner_id": 2021052,
  "tech_user_id": 2021052,
  "bill_user_id": 2021052,
  "custom_attributes": [
    {
      "name": "Enable a new DNS",
      "value": ""
    },
    {
      "name": "Birth date",
      "value": "10.08.2016"
    },
    {
      "name": "Oasis Account ID",
      "value": ""
    },
    {
      "name": "Passport date of issue",
      "value": "01.07.2016"
    },
    {
      "name": "Passport issued by",
      "value": "Goverment"
    },
    {
      "name": "Passport number",
      "value": "1124111111111"
    },
    {
      "name": "Personal number",
      "value": "A4411111BB111"
    },
    {
      "name": "TenantID",
      "value": ""
    },
    {
      "name": "Tenant Name",
      "value": ""
    },
    {
      "name": "test_date_attr",
      "value": ""
    },
    {
      "name": "Trial",
      "value": ""
    }
  ],
  "created_at": "2016-10-07T13:49:47.934+03:00",
  "updated_at": "2016-10-07T13:49:47.934+03:00"
}

If the Account is not created, the method returns the mistake description:

 {
  "error": {
    "location.country": [
      "is not included in the list"
    ],
    "location.phone": [
      "is not in international format"
    ],
    "custom_attributes.value": [
      "can't be blank",
      "is not included in the list"
    ],
    "passport_date_of_issue": [
      {
        "value": [
          "can't be blank",
          "is not included in the list"
        ]
      }
    ],
    "personal_number": [
      {
        "value": [
          "can't be blank"
        ]
      }
    ],
    "birth_date": [
      {
        "value": [
          "can't be blank",
          "is not included in the list"
        ]
      }
    ],
    "passport_number": [
      {
        "value": [
          "can't be blank"
        ]
      }
    ],
    "passport_issued_by": [
      {
        "value": [
          "can't be blank"
        ]
      }
    ]
  }
}