Skip to main content

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

CodeDescription
201Created, successful operation
400Invalid request
401Unauthorized
404Not found
500Unexpected error

Objects

Company Object

NameDescriptionRequiredType
idIdentifier for the companytruestring
businessNameName of the companytruestring
businessAddressThe company addresstruestring
businessPhoneNumberPhone number of the company, usually is the line numberfalsestring
businessDisplayNameCompany display namefalsestring
creditDetailsThe credit detailsfalseobject
sourceModifiedDateDate the record was last changed in the accounting service providertruedatetime
customersOptional array of customers to link to company in time of creationfalsearray

CreditDetails Object

NameDescriptionRequiredType
accountTypeThe account type (credit, cash)falsestring
accountCreationDateThe account creation datefalsedatetime
pricePackageThe price package of business (eg. A)falsestring
creditProviderThe credit provider (inhouse, co)falsestring
creditStatusThe actual credit status (active, suspended, closed)falsestring
creditAmountOverall credit amountfalsedecimal
outstandingAmountThe outstanding credit amount (current balance)falsedecimal
overdueBalanceThe overall overdue amountfalsedecimal
agingOverdueBalanceAging overdue balancefalsearray
invoicesOverallAmountOverall amount of invoicesfalsedecimal
invoicesOverallCountOverall number of invoicesfalseinteger
invoicesLastYearAmountOverall number of invoicesfalsedecimal
invoicesLastYearCountNumber of invoices last year.falseinteger
invoicesYearToDateAmountAmount of invoices in this year until current date.falsedecimal
invoicesYearToDateCountNumber of invoices in this year until current date.falseinteger
invoicesLastMonthAmountAmount of invoices last month.falsedecimal
invoicesLastMonthCountNumber of invoices last month.falseinteger
invoicesMonthToDateAmountAmount of invoices in this month until current date.falsedecimal
invoicesMonthToDateCountNumber of invoices in this month until current date.falseinteger
invoicesMonthlyAverageAmountAverage amount of invoices per month.falsedecimal
invoicesMonthlyAverageCountAverage number of invoices per month.falsedecimal

AgingOverdueBalance Object

NameDescriptionRequiredType
nameDescription of aging range (eg. 1-30 days)falsestring
daysFromAging range start daystrueinteger
daysToAging range end days. If not set, consider as infinite.falseinteger
overdueBalanceOverdue balance for this period.truedecimal

Customer Object

NameDescriptionRequiredType
idIdentifier for the customertruestring
firstNameFirst name of the main contact for the customer / companytruestring
lastNameLast name of the main contact for the customer / companytruestring
emailAddressEmail address of the main contact for the customer / company. This email address will be used to send the notifications outtruestring
cellPhoneNumberCellphone number of the main contact for the customer / company. This phone number will be used to send the notifications outtruestring
sourceModifiedDateDate the record was last changed in the accounting service providertruedatetime

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)