Add new company
Creates a company. Optionally you can immediately attach customers to this newly created company, in this case response contains signup urls per customer.
danger
API allows only 1 customer per company to add, otherwise returns code: company_can_have_only_one_customer.
Endpoint
POST /integration/company
HTTP Request
POST /integration/company
Company Object
{
"id": "a0b9cedc32ce",
"businessAddress": "1400 24th Ave, San Francisco, CA 94122, USA",
"businessPhoneNumber": "+11234567890",
"businessName": "Acme Inc.",
"businessDisplayName": "Acme",
"creditDetails": {
"accountType": "credit",
"accountCreationDate": "2023-03-09T00:10:20.300Z",
"pricePackage": "A",
"creditProvider": "inhouse",
"creditStatus": "active",
"creditAmount": 10000,
"outstandingAmount": 3000,
"overdueBalance": 500,
"agingOverdueBalance": [
{
"name": "1-30 days",
"daysFrom": 1,
"daysTo": 30,
"overdueBalance": 3000
}
],
"invoicesOverallAmount": 7000,
"invoicesOverallCount": 58,
"invoicesLastYearAmount": 5000,
"invoicesLastYearCount": 33,
"invoicesYearToDateAmount": 2000,
"invoicesYearToDateCount": 25,
"invoicesLastMonthAmount": 300,
"invoicesLastMonthCount": 5,
"invoicesMonthToDateAmount": 500,
"invoicesMonthToDateCount": 2,
"invoicesMonthlyAverageAmount": 888.33,
"invoicesMonthlyAverageCount": 5.7
},
"sourceModifiedDate": "2023-01-04T09:47:57.477Z",
"customers": [
{
"id": "dc506b22c7fa",
"firstName": "John",
"lastName": "Doe",
"emailAddress": "[email protected]",
"cellPhoneNumber": "+11234567890",
"sourceModifiedDate": "2023-01-04T09:00:00.000Z",
},
{
"id": "22c7fadc506b",
"firstName": "Mary",
"lastName": "Smith",
"emailAddress": "[email protected]",
"cellPhoneNumber": "+11678902345",
"sourceModifiedDate": "2023-01-04T10:00:00.000Z",
}
]
}
Successful response
HTTP 201
{
"blueTapeId": "fb5637b2e5f3",
"signUpUrls": [
{
"customerId": "dc506b22c7fa",
"signUpUrl": "https://www.bluetape.com/signup?id=97bee7a043b58084"
},
{
"customerId": "22c7fadc506b",
"signUpUrl": "https://www.bluetape.com/signup?id=bee7a043b5808497"
}
]
}
Erroneous response
HTTP 409
{
"code": "409",
"reason": "Company already exists."
}
Responses
| Code | Description |
|---|---|
| 201 | Created, successful operation |
| 400 | Invalid request |
| 401 | Unauthorized |
| 404 | Not found |
| 500 | Unexpected error |
Objects
Company Object
| Name | Description | Required | Type |
|---|---|---|---|
| id | Identifier for the company | true | string |
| businessName | Name of the company | true | string |
| businessAddress | The company address | true | string |
| businessPhoneNumber | Phone number of the company, usually is the line number | false | string |
| businessDisplayName | Company display name | false | string |
| creditDetails | The credit details | false | object |
| sourceModifiedDate | Date the record was last changed in the accounting service provider | true | datetime |
| customers | Optional array of customers to link to company in time of creation | false | array |
CreditDetails Object
| Name | Description | Required | Type |
|---|---|---|---|
| accountType | The account type (credit, cash) | false | string |
| accountCreationDate | The account creation date | false | datetime |
| pricePackage | The price package of business (eg. A) | false | string |
| creditProvider | The credit provider (inhouse, co) | false | string |
| creditStatus | The actual credit status (active, suspended, closed) | false | string |
| creditAmount | Overall credit amount | false | decimal |
| outstandingAmount | The outstanding credit amount (current balance) | false | decimal |
| overdueBalance | The overall overdue amount | false | decimal |
| agingOverdueBalance | Aging overdue balance | false | array |
| invoicesOverallAmount | Overall amount of invoices | false | decimal |
| invoicesOverallCount | Overall number of invoices | false | integer |
| invoicesLastYearAmount | Overall number of invoices | false | decimal |
| invoicesLastYearCount | Number of invoices last year. | false | integer |
| invoicesYearToDateAmount | Amount of invoices in this year until current date. | false | decimal |
| invoicesYearToDateCount | Number of invoices in this year until current date. | false | integer |
| invoicesLastMonthAmount | Amount of invoices last month. | false | decimal |
| invoicesLastMonthCount | Number of invoices last month. | false | integer |
| invoicesMonthToDateAmount | Amount of invoices in this month until current date. | false | decimal |
| invoicesMonthToDateCount | Number of invoices in this month until current date. | false | integer |
| invoicesMonthlyAverageAmount | Average amount of invoices per month. | false | decimal |
| invoicesMonthlyAverageCount | Average number of invoices per month. | false | decimal |
AgingOverdueBalance Object
| Name | Description | Required | Type |
|---|---|---|---|
| name | Description of aging range (eg. 1-30 days) | false | string |
| daysFrom | Aging range start days | true | integer |
| daysTo | Aging range end days. If not set, consider as infinite. | false | integer |
| overdueBalance | Overdue balance for this period. | true | decimal |
Customer Object
| Name | Description | Required | Type |
|---|---|---|---|
| id | Identifier for the customer | true | string |
| firstName | First name of the main contact for the customer / company | true | string |
| lastName | Last name of the main contact for the customer / company | true | string |
| emailAddress | Email address of the main contact for the customer / company. This email address will be used to send the notifications out | true | string |
| cellPhoneNumber | Cellphone number of the main contact for the customer / company. This phone number will be used to send the notifications out | true | string |
| sourceModifiedDate | Date the record was last changed in the accounting service provider | true | datetime |
Examples
curl https://api.bluetape.com/genericBthubService/integration/company \
-X POST \
-H "X-BlueTape-Key: <your-key>" \
-H "X-Integration-AccountId: <your-account-id>" \
-H "Content-Type: application/json" \
-d "@request.json"
import fetch from 'node-fetch';
const company = { ... };
const url = 'https://api.bluetape.com/genericBthubService/integration/company';
const options = {
method: 'POST',
headers: {
'X-BlueTape-Key': '<your-key>',
'X-Integration-AccountId': '<your-account-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify(company)
};
fetch(url, options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
using Flurl.Http;
var company = new Company() {
...
};
var result = await "https://api.bluetape.com/genericBthubService/integration/company"
.WithHeader("X-BlueTape-Key", "<your-key>")
.WithHeader("X-Integration-AccountId", "<your-account-id>")
.WithHeader("Content-Type", "application/json")
.PostJsonAsync(company)
.ReceiveJson<BlueTapeIntegrationResult>();
import requests
url = "https://api.bluetape.com/genericBthubService/integration/company"
headers = {
"X-BlueTape-Key": "<your-key>",
"X-Integration-AccountId": "<your-account-id>",
"Content-Type": "application/json"
}
data = <your-company-data>
response = requests.post(url, headers=headers, data=data)
print(response.text)