Skip to main content

Create Company

Create a new company with associated address and user account.

Endpoint

POST /companies

Request Parameters

ParameterTypeRequiredDescription
namestringYesThe company name
address_attributesobjectYesAddress information for the company
validate_addressbooleanNoWhether to validate the address against FedEx to ensure it is deliverable and correctly formatted
currency_idstringYesCurrency code for the company (e.g., "GBP", "USD")
emailstringYesEmail for creating a user account linked to this company; this user will be used when placing orders or quotes

Address Attributes

ParameterTypeRequiredDescription
namestringNoName of the contact person
companystringNoCompany name for the address
emailstringNoContact email address
address_1stringNoPrimary address line
address_2stringNoSecondary address line
address_3stringNoAdditional address line
postal_codestringNoPostal/ZIP code
citystringNoCity name
provincestringNoProvince/state
country_idintegerYesCountry identifier
phonestringNoContact phone number
import_codestringNoImport reference code
tax_numberstringNoTax identification number
classificationstringNoAddress classification. Must be either "business" or "residential"
export_codestringNoExport reference code

Request Example

curl -X POST \
https://stream-orders-api-sandbox.herokuapp.com/client_api/v2/companies \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"name": "New Test Company",
"address_attributes": {
"name": "John Doe",
"company": "New Test Company",
"email": "example@company.com",
"address_1": "221B Baker Street",
"address_2": "Flat 2",
"address_3": "",
"postal_code": "NW1 6XE",
"city": "London",
"province": "Greater London",
"country_id": "232",
"phone": "+442079173000",
"import_code": "IMP123456",
"tax_number": "GB123456789",
"classification": "business",
"export_code": "EXP654321"
},
"validate_address": false,
"currency_id": "GBP",
"email": "test@example.com"
}'
{
"name": "New Test Company",
"address_attributes": {
"name": "John Doe",
"company": "New Test Company",
"email": "example@company.com",
"address_1": "221B Baker Street",
"address_2": "Flat 2",
"address_3": "",
"postal_code": "NW1 6XE",
"city": "London",
"province": "Greater London",
"country_id": "232",
"phone": "+442079173000",
"import_code": "IMP123456",
"tax_number": "GB123456789",
"classification": "business",
"export_code": "EXP654321"
},
"validate_address": false,
"currency_id": "GBP",
"email": "test@example.com"
}

Response

Success Response

Status Code: 201 Created

{
"company": {
"id": 2533,
"account_number": "STRNEW0013",
"account_status": "active_account",
"address": {
"id": 1075175,
"address_1": "221B Baker Street",
"address_2": "Flat 2",
"address_3": "",
"city": "London",
"classification": "business",
"company": "New Test Company",
"country_id": 232,
"email": "example@company.com",
"import_code": "IMP123456",
"latitude": null,
"longitude": null,
"name": "John Doe",
"phone": "+442079173000",
"postal_code": "NW1 6XE",
"province": "Greater London",
"summary": "Ukraine",
"tax_number": "GB123456789",
"time_zone_id": null
},
"code": "STRNEW0013",
"currency_id": "GBP",
"name": "New Test Company",
"api_users": [
{
"id": 5474,
"email": "test@vatitstream.com"
}
]
}
}

Response Fields

FieldTypeDescription
company.idintegerUnique identifier for the company
company.account_numberstringGenerated account number for the company
company.account_statusstringCurrent status of the account (e.g., "active_account")
company.addressobjectComplete address information with assigned ID
company.codestringCompany code (same as account_number)
company.currency_idstringCurrency code for the company
company.namestringCompany name
company.api_usersarrayArray of API users associated with this company
company.api_users[].idintegerUnique identifier for the API user
company.api_users[].emailstringEmail address of the API user

Error Responses

Status Code: 422 Unprocessable Entity

{
"error": "Validation failed: Api users email has already been taken, Api users email User has been taken and is on Company 'Acme Corporation' under Reseller 'Stream', Name has already been taken"
}

Notes

  • The email parameter creates a user account that will be linked to this company
  • This user account will be used for placing orders and quotes
  • The validate_address option uses FedEx validation to ensure address deliverability
  • All address attributes except country_id are optional
  • The classification field only accepts two values: "business" or "residential"
  • The system automatically generates an account number and code for the new company