Introduction
This documentation aims to provide all the information you need to work with our API.
Base URL
https://your-tenant.craterinvoice.com/
Authenticating requests
Authenticate requests to this API's endpoints by sending an Authorization
header with the value "Bearer {YOUR_AUTH_TOKEN}"
.
All authenticated endpoints are marked with a requires authentication
badge in the documentation below.
You can retrieve your token by doing a POST Request on oauth/token endpoint. Also because Crater supports multiple businesses, you must pass the header "business" with value as the ID of the business you are requesting.
Auth
Authentication endpoints
Get Authentication token
This endpoint allows you to get the bearer token required for authentication of all protected endpoints
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/oauth/token" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"grant_type\": \"client_credentials\",
\"client_id\": \"your-client-id\",
\"client_secret\": \"your-client-secret\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/oauth/token"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"grant_type": "client_credentials",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/oauth/token',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'grant_type' => 'client_credentials',
'client_id' => 'your-client-id',
'client_secret' => 'your-client-secret',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"token_type": "Bearer",
"expires_in": 31536000,
"access_token": "Your-bearer-token"
}
Received response:
Request failed with error:
Businesses
API Endpoints for managing businesses
List all businesses
requires authentication
Returns a list of your businesses.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/businesses?limit=6&page=9&name=error&business_type=vel&email=beatae&phone=qui&contact_first_name=sapiente" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/businesses"
);
const params = {
"limit": "6",
"page": "9",
"name": "error",
"business_type": "vel",
"email": "beatae",
"phone": "qui",
"contact_first_name": "sapiente",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/businesses',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '6',
'page'=> '9',
'name'=> 'error',
'business_type'=> 'vel',
'email'=> 'beatae',
'phone'=> 'qui',
'contact_first_name'=> 'sapiente',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 269,
"name": "Dare Inc",
"website": null,
"phone": null,
"email": "marilie.robel@yahoo.com",
"logo": null,
"unique_hash": "8EIbhbxxp94lNCX0iOZt",
"profile_completed": null,
"slug": "dare-inc",
"contact_first_name": "Kaylee",
"contact_last_name": "McCullough",
"charges_enabled": null,
"payouts_enabled": null,
"details_submitted": null,
"business_type": "company",
"requirements": null,
"created_at": 1667663245
},
{
"id": 270,
"name": "Frami and Sons",
"website": null,
"phone": null,
"email": "cristal51@gmail.com",
"logo": null,
"unique_hash": "2IiJQMSIvxFDeV6JCK1C",
"profile_completed": null,
"slug": "frami-and-sons",
"contact_first_name": "Katarina",
"contact_last_name": "VonRueden",
"charges_enabled": null,
"payouts_enabled": null,
"details_submitted": null,
"business_type": "company",
"requirements": null,
"created_at": 1667663245
}
]
}
Received response:
Request failed with error:
Create a business
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/businesses" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"Crater Invoice\",
\"contact_first_name\": \"rerum\",
\"contact_last_name\": \"aut\",
\"business_type\": \"porro\",
\"email\": \"tempora\",
\"address\": {
\"state\": \"California\",
\"city\": \"Los Angeles\",
\"address_street_1\": \"Address 1\",
\"address_street_2\": \"Address 2\",
\"zip\": \"91504\",
\"phone\": \"123-123-123\",
\"website\": \"https:\\/\\/craterapp.com\"
}
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/businesses"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "Crater Invoice",
"contact_first_name": "rerum",
"contact_last_name": "aut",
"business_type": "porro",
"email": "tempora",
"address": {
"state": "California",
"city": "Los Angeles",
"address_street_1": "Address 1",
"address_street_2": "Address 2",
"zip": "91504",
"phone": "123-123-123",
"website": "https:\/\/craterapp.com"
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/businesses',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'Crater Invoice',
'contact_first_name' => 'rerum',
'contact_last_name' => 'aut',
'business_type' => 'porro',
'email' => 'tempora',
'address' => [
'state' => 'California',
'city' => 'Los Angeles',
'address_street_1' => 'Address 1',
'address_street_2' => 'Address 2',
'zip' => '91504',
'phone' => '123-123-123',
'website' => 'https://craterapp.com',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Retrieve a business
requires authentication
Retrieves a Business object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/businesses/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/businesses/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/businesses/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": {
"id": 271,
"name": "Bednar LLC",
"website": null,
"phone": null,
"email": "roob.maxwell@yahoo.com",
"logo": null,
"unique_hash": "V1QZrlqQRiLFgXhJbiJK",
"profile_completed": null,
"slug": "bednar-llc",
"contact_first_name": "Cordia",
"contact_last_name": "Spencer",
"charges_enabled": null,
"payouts_enabled": null,
"details_submitted": null,
"business_type": "company",
"requirements": null,
"created_at": 1667663245
}
}
Received response:
Request failed with error:
Update a business
requires authentication
Example request:
curl --request PUT \
"https://your-tenant.craterinvoice.com/api/v2/businesses/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"Crater Invoice\",
\"contact_first_name\": \"consectetur\",
\"contact_last_name\": \"enim\",
\"business_type\": \"vero\",
\"email\": \"id\",
\"address\": {
\"state\": \"California\",
\"city\": \"Los Angeles\",
\"address_street_1\": \"Address 1\",
\"address_street_2\": \"Address 2\",
\"zip\": \"91504\",
\"phone\": \"123-123-123\",
\"website\": \"https:\\/\\/craterapp.com\"
}
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/businesses/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "Crater Invoice",
"contact_first_name": "consectetur",
"contact_last_name": "enim",
"business_type": "vero",
"email": "id",
"address": {
"state": "California",
"city": "Los Angeles",
"address_street_1": "Address 1",
"address_street_2": "Address 2",
"zip": "91504",
"phone": "123-123-123",
"website": "https:\/\/craterapp.com"
}
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://your-tenant.craterinvoice.com/api/v2/businesses/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'Crater Invoice',
'contact_first_name' => 'consectetur',
'contact_last_name' => 'enim',
'business_type' => 'vero',
'email' => 'id',
'address' => [
'state' => 'California',
'city' => 'Los Angeles',
'address_street_1' => 'Address 1',
'address_street_2' => 'Address 2',
'zip' => '91504',
'phone' => '123-123-123',
'website' => 'https://craterapp.com',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Delete Business
requires authentication
Delete a business.
Example request:
curl --request DELETE \
"https://your-tenant.craterinvoice.com/api/v2/businesses/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/businesses/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://your-tenant.craterinvoice.com/api/v2/businesses/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Current Business
API Endpoints for managing currently active business
Active Business
requires authentication
Retrieves currently active Business object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/business" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/business"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/business',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": {
"id": 272,
"name": "Leffler-Kreiger",
"website": null,
"phone": null,
"email": "verla36@ernser.com",
"logo": null,
"unique_hash": "xgNZfL6vGi64k22fbtm9",
"profile_completed": null,
"slug": "leffler-kreiger",
"contact_first_name": "Ethan",
"contact_last_name": "Lindgren",
"charges_enabled": null,
"payouts_enabled": null,
"details_submitted": null,
"business_type": "company",
"requirements": null,
"created_at": 1667663246
}
}
Received response:
Request failed with error:
Update current business
requires authentication
Example request:
curl --request PUT \
"https://your-tenant.craterinvoice.com/api/v2/business" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"Crater Invoice\",
\"contact_first_name\": \"sit\",
\"contact_last_name\": \"et\",
\"business_type\": \"aperiam\",
\"email\": \"consequuntur\",
\"address\": {
\"state\": \"California\",
\"city\": \"Los Angeles\",
\"address_street_1\": \"Address 1\",
\"address_street_2\": \"Address 2\",
\"zip\": \"91504\",
\"phone\": \"123-123-123\",
\"website\": \"https:\\/\\/craterapp.com\"
}
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/business"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "Crater Invoice",
"contact_first_name": "sit",
"contact_last_name": "et",
"business_type": "aperiam",
"email": "consequuntur",
"address": {
"state": "California",
"city": "Los Angeles",
"address_street_1": "Address 1",
"address_street_2": "Address 2",
"zip": "91504",
"phone": "123-123-123",
"website": "https:\/\/craterapp.com"
}
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://your-tenant.craterinvoice.com/api/v2/business',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'Crater Invoice',
'contact_first_name' => 'sit',
'contact_last_name' => 'et',
'business_type' => 'aperiam',
'email' => 'consequuntur',
'address' => [
'state' => 'California',
'city' => 'Los Angeles',
'address_street_1' => 'Address 1',
'address_street_2' => 'Address 2',
'zip' => '91504',
'phone' => '123-123-123',
'website' => 'https://craterapp.com',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Upload business logo
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/business/upload-logo" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"business_logo\": \"Logo.png\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/business/upload-logo"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"business_logo": "Logo.png"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/business/upload-logo',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'business_logo' => 'Logo.png',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Get business settings
requires authentication
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/business/settings" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"settings\": [
\"currency\",
\"language\"
]
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/business/settings"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"settings": [
"currency",
"language"
]
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/business/settings',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'settings' => [
'currency',
'language',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (500):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
{
"message": "Server Error"
}
Received response:
Request failed with error:
Update business settings
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/business/settings" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"invoice_business_address_format\": \"<h3><strong>{BUSINESS_NAME}<\\/strong><\\/h3><p>{BUSINESS_ADDRESS_STREET_1}<\\/p><p>{BUSINESS_ADDRESS_STREET_2}<\\/p><p>{BUSINESS_CITY} {BUSINESS_STATE}<\\/p><p>{BUSINESS_COUNTRY} {BUSINESS_ZIP_CODE}<\\/p><p>{BUSINESS_PHONE}<\\/p>\",
\"invoice_shipping_address_format\": \"<h3>{SHIPPING_ADDRESS_NAME}<\\/h3><p>{SHIPPING_ADDRESS_STREET_1}<\\/p><p>{SHIPPING_ADDRESS_STREET_2}<\\/p><p>{SHIPPING_CITY} {SHIPPING_STATE}<\\/p><p>{SHIPPING_COUNTRY} {SHIPPING_ZIP_CODE}<\\/p><p>{SHIPPING_PHONE}<\\/p>\",
\"invoice_billing_address_format\": \"<h3>{BILLING_ADDRESS_NAME}<\\/h3><p>{BILLING_ADDRESS_STREET_1}<\\/p><p>{BILLING_ADDRESS_STREET_2}<\\/p><p>{BILLING_CITY} {BILLING_STATE}<\\/p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}<\\/p><p>{BILLING_PHONE}<\\/p>\",
\"estimate_business_address_format\": \"<h3><strong>{BUSINESS_NAME}<\\/strong><\\/h3><p>{BUSINESS_ADDRESS_STREET_1}<\\/p><p>{BUSINESS_ADDRESS_STREET_2}<\\/p><p>{BUSINESS_CITY} {BUSINESS_STATE}<\\/p><p>{BUSINESS_COUNTRY} {BUSINESS_ZIP_CODE}<\\/p><p>{BUSINESS_PHONE}<\\/p>\",
\"estimate_shipping_address_format\": \"<h3>{SHIPPING_ADDRESS_NAME}<\\/h3><p>{SHIPPING_ADDRESS_STREET_1}<\\/p><p>{SHIPPING_ADDRESS_STREET_2}<\\/p><p>{SHIPPING_CITY} {SHIPPING_STATE}<\\/p><p>{SHIPPING_COUNTRY} {SHIPPING_ZIP_CODE}<\\/p><p>{SHIPPING_PHONE}<\\/p>\",
\"estimate_billing_address_format\": \"<h3>{BILLING_ADDRESS_NAME}<\\/h3><p>{BILLING_ADDRESS_STREET_1}<\\/p><p>{BILLING_ADDRESS_STREET_2}<\\/p><p>{BILLING_CITY} {BILLING_STATE}<\\/p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}<\\/p><p>{BILLING_PHONE}<\\/p>\",
\"payment_business_address_format\": \"<h3><strong>{BUSINESS_NAME}<\\/strong><\\/h3><p>{BUSINESS_ADDRESS_STREET_1}<\\/p><p>{BUSINESS_ADDRESS_STREET_2}<\\/p><p>{BUSINESS_CITY} {BUSINESS_STATE}<\\/p><p>{BUSINESS_COUNTRY} {BUSINESS_ZIP_CODE}<\\/p><p>{BUSINESS_PHONE}<\\/p>\",
\"payment_from_customer_address_format\": \"<h3>{BILLING_ADDRESS_NAME}<\\/h3><p>{BILLING_ADDRESS_STREET_1}<\\/p><p>{BILLING_ADDRESS_STREET_2}<\\/p><p>{BILLING_CITY} {BILLING_STATE}<\\/p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}<\\/p><p>{BILLING_PHONE}<\\/p>\",
\"tax_per_item_enabled\": \"YES\",
\"discount_per_item_enabled\": \"YES\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/business/settings"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"invoice_business_address_format": "<h3><strong>{BUSINESS_NAME}<\/strong><\/h3><p>{BUSINESS_ADDRESS_STREET_1}<\/p><p>{BUSINESS_ADDRESS_STREET_2}<\/p><p>{BUSINESS_CITY} {BUSINESS_STATE}<\/p><p>{BUSINESS_COUNTRY} {BUSINESS_ZIP_CODE}<\/p><p>{BUSINESS_PHONE}<\/p>",
"invoice_shipping_address_format": "<h3>{SHIPPING_ADDRESS_NAME}<\/h3><p>{SHIPPING_ADDRESS_STREET_1}<\/p><p>{SHIPPING_ADDRESS_STREET_2}<\/p><p>{SHIPPING_CITY} {SHIPPING_STATE}<\/p><p>{SHIPPING_COUNTRY} {SHIPPING_ZIP_CODE}<\/p><p>{SHIPPING_PHONE}<\/p>",
"invoice_billing_address_format": "<h3>{BILLING_ADDRESS_NAME}<\/h3><p>{BILLING_ADDRESS_STREET_1}<\/p><p>{BILLING_ADDRESS_STREET_2}<\/p><p>{BILLING_CITY} {BILLING_STATE}<\/p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}<\/p><p>{BILLING_PHONE}<\/p>",
"estimate_business_address_format": "<h3><strong>{BUSINESS_NAME}<\/strong><\/h3><p>{BUSINESS_ADDRESS_STREET_1}<\/p><p>{BUSINESS_ADDRESS_STREET_2}<\/p><p>{BUSINESS_CITY} {BUSINESS_STATE}<\/p><p>{BUSINESS_COUNTRY} {BUSINESS_ZIP_CODE}<\/p><p>{BUSINESS_PHONE}<\/p>",
"estimate_shipping_address_format": "<h3>{SHIPPING_ADDRESS_NAME}<\/h3><p>{SHIPPING_ADDRESS_STREET_1}<\/p><p>{SHIPPING_ADDRESS_STREET_2}<\/p><p>{SHIPPING_CITY} {SHIPPING_STATE}<\/p><p>{SHIPPING_COUNTRY} {SHIPPING_ZIP_CODE}<\/p><p>{SHIPPING_PHONE}<\/p>",
"estimate_billing_address_format": "<h3>{BILLING_ADDRESS_NAME}<\/h3><p>{BILLING_ADDRESS_STREET_1}<\/p><p>{BILLING_ADDRESS_STREET_2}<\/p><p>{BILLING_CITY} {BILLING_STATE}<\/p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}<\/p><p>{BILLING_PHONE}<\/p>",
"payment_business_address_format": "<h3><strong>{BUSINESS_NAME}<\/strong><\/h3><p>{BUSINESS_ADDRESS_STREET_1}<\/p><p>{BUSINESS_ADDRESS_STREET_2}<\/p><p>{BUSINESS_CITY} {BUSINESS_STATE}<\/p><p>{BUSINESS_COUNTRY} {BUSINESS_ZIP_CODE}<\/p><p>{BUSINESS_PHONE}<\/p>",
"payment_from_customer_address_format": "<h3>{BILLING_ADDRESS_NAME}<\/h3><p>{BILLING_ADDRESS_STREET_1}<\/p><p>{BILLING_ADDRESS_STREET_2}<\/p><p>{BILLING_CITY} {BILLING_STATE}<\/p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}<\/p><p>{BILLING_PHONE}<\/p>",
"tax_per_item_enabled": "YES",
"discount_per_item_enabled": "YES"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/business/settings',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'invoice_business_address_format' => '<h3><strong>{BUSINESS_NAME}</strong></h3><p>{BUSINESS_ADDRESS_STREET_1}</p><p>{BUSINESS_ADDRESS_STREET_2}</p><p>{BUSINESS_CITY} {BUSINESS_STATE}</p><p>{BUSINESS_COUNTRY} {BUSINESS_ZIP_CODE}</p><p>{BUSINESS_PHONE}</p>',
'invoice_shipping_address_format' => '<h3>{SHIPPING_ADDRESS_NAME}</h3><p>{SHIPPING_ADDRESS_STREET_1}</p><p>{SHIPPING_ADDRESS_STREET_2}</p><p>{SHIPPING_CITY} {SHIPPING_STATE}</p><p>{SHIPPING_COUNTRY} {SHIPPING_ZIP_CODE}</p><p>{SHIPPING_PHONE}</p>',
'invoice_billing_address_format' => '<h3>{BILLING_ADDRESS_NAME}</h3><p>{BILLING_ADDRESS_STREET_1}</p><p>{BILLING_ADDRESS_STREET_2}</p><p>{BILLING_CITY} {BILLING_STATE}</p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}</p><p>{BILLING_PHONE}</p>',
'estimate_business_address_format' => '<h3><strong>{BUSINESS_NAME}</strong></h3><p>{BUSINESS_ADDRESS_STREET_1}</p><p>{BUSINESS_ADDRESS_STREET_2}</p><p>{BUSINESS_CITY} {BUSINESS_STATE}</p><p>{BUSINESS_COUNTRY} {BUSINESS_ZIP_CODE}</p><p>{BUSINESS_PHONE}</p>',
'estimate_shipping_address_format' => '<h3>{SHIPPING_ADDRESS_NAME}</h3><p>{SHIPPING_ADDRESS_STREET_1}</p><p>{SHIPPING_ADDRESS_STREET_2}</p><p>{SHIPPING_CITY} {SHIPPING_STATE}</p><p>{SHIPPING_COUNTRY} {SHIPPING_ZIP_CODE}</p><p>{SHIPPING_PHONE}</p>',
'estimate_billing_address_format' => '<h3>{BILLING_ADDRESS_NAME}</h3><p>{BILLING_ADDRESS_STREET_1}</p><p>{BILLING_ADDRESS_STREET_2}</p><p>{BILLING_CITY} {BILLING_STATE}</p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}</p><p>{BILLING_PHONE}</p>',
'payment_business_address_format' => '<h3><strong>{BUSINESS_NAME}</strong></h3><p>{BUSINESS_ADDRESS_STREET_1}</p><p>{BUSINESS_ADDRESS_STREET_2}</p><p>{BUSINESS_CITY} {BUSINESS_STATE}</p><p>{BUSINESS_COUNTRY} {BUSINESS_ZIP_CODE}</p><p>{BUSINESS_PHONE}</p>',
'payment_from_customer_address_format' => '<h3>{BILLING_ADDRESS_NAME}</h3><p>{BILLING_ADDRESS_STREET_1}</p><p>{BILLING_ADDRESS_STREET_2}</p><p>{BILLING_CITY} {BILLING_STATE}</p><p>{BILLING_COUNTRY} {BILLING_ZIP_CODE}</p><p>{BILLING_PHONE}</p>',
'tax_per_item_enabled' => 'YES',
'discount_per_item_enabled' => 'YES',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Customers
List all customers
requires authentication
Returns a list of your customers.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/customers?limit=3&page=2&name=nemo&email=voluptate&phone=facere" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/customers"
);
const params = {
"limit": "3",
"page": "2",
"name": "nemo",
"email": "voluptate",
"phone": "facere",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/customers',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '3',
'page'=> '2',
'name'=> 'nemo',
'email'=> 'voluptate',
'phone'=> 'facere',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 1090,
"name": "Garrett Conroy IV",
"business_id": 1,
"customer_business_id": null,
"email": "henry.ruecker@example.com",
"phone": "843.887.2253",
"contact_first_name": "Madeline",
"contact_last_name": "Moen",
"website": "http://wuckert.com/quae-fuga-eum-beatae-debitis",
"created_at": 1667663246,
"updated_at": 1667663246,
"due_amount": null
},
{
"id": 1091,
"name": "Foster Cronin",
"business_id": 1,
"customer_business_id": null,
"email": "jadyn.klein@example.org",
"phone": "(283) 609-6644",
"contact_first_name": "Geovanny",
"contact_last_name": "Hermann",
"website": "http://cummings.info/",
"created_at": 1667663246,
"updated_at": 1667663246,
"due_amount": null
}
]
}
Received response:
Request failed with error:
Create a customer
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/customers" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"john\",
\"email\": \"john@gmail.com\",
\"phone\": \"0123123123\",
\"contact_first_name\": \"xyz\",
\"contact_last_name\": \"john\",
\"website\": \"http:\\/\\/craterapp.com\",
\"billing\": {
\"name\": \"Crater Invoice\",
\"address_street_1\": \"Address 1\",
\"address_street_2\": \"Address 2\",
\"city\": \"Los Angeles\",
\"state\": \"California\",
\"country_id\": 231,
\"zip\": \"91504\",
\"phone\": \"0123123123\"
},
\"shipping\": {
\"name\": \"crater Invoice\",
\"address_street_1\": \"Address 1\",
\"address_street_2\": \"Address 2\",
\"city\": \"Los Angeles\",
\"state\": \"California\",
\"country_id\": 231,
\"zip\": \"91504\",
\"phone\": \"0123123123\"
}
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/customers"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "john",
"email": "john@gmail.com",
"phone": "0123123123",
"contact_first_name": "xyz",
"contact_last_name": "john",
"website": "http:\/\/craterapp.com",
"billing": {
"name": "Crater Invoice",
"address_street_1": "Address 1",
"address_street_2": "Address 2",
"city": "Los Angeles",
"state": "California",
"country_id": 231,
"zip": "91504",
"phone": "0123123123"
},
"shipping": {
"name": "crater Invoice",
"address_street_1": "Address 1",
"address_street_2": "Address 2",
"city": "Los Angeles",
"state": "California",
"country_id": 231,
"zip": "91504",
"phone": "0123123123"
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/customers',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'john',
'email' => 'john@gmail.com',
'phone' => '0123123123',
'contact_first_name' => 'xyz',
'contact_last_name' => 'john',
'website' => 'http://craterapp.com',
'billing' => [
'name' => 'Crater Invoice',
'address_street_1' => 'Address 1',
'address_street_2' => 'Address 2',
'city' => 'Los Angeles',
'state' => 'California',
'country_id' => 231,
'zip' => '91504',
'phone' => '0123123123',
],
'shipping' => [
'name' => 'crater Invoice',
'address_street_1' => 'Address 1',
'address_street_2' => 'Address 2',
'city' => 'Los Angeles',
'state' => 'California',
'country_id' => 231,
'zip' => '91504',
'phone' => '0123123123',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Retrieve a customer
requires authentication
Retrieves a Customer object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/customers/787" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/customers/787"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/customers/787',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": {
"id": 1092,
"name": "Prof. Maribel D'Amore",
"business_id": 1,
"customer_business_id": null,
"email": "rosenbaum.shanny@example.org",
"phone": "+1-270-608-9144",
"contact_first_name": "Jettie",
"contact_last_name": "Denesik",
"website": "http://www.mayert.com/ut-labore-libero-fugit-rem-perferendis",
"created_at": 1667663246,
"updated_at": 1667663246,
"due_amount": null
}
}
Received response:
Request failed with error:
Update a customer
requires authentication
Example request:
curl --request PUT \
"https://your-tenant.craterinvoice.com/api/v2/customers/787" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"john\",
\"email\": \"john@gmail.com\",
\"phone\": \"0123123123\",
\"contact_first_name\": \"xyz\",
\"contact_last_name\": \"john\",
\"website\": \"http:\\/\\/craterapp.com\",
\"billing\": {
\"name\": \"Crater Invoice\",
\"address_street_1\": \"Address 1\",
\"address_street_2\": \"Address 2\",
\"city\": \"Los Angeles\",
\"state\": \"California\",
\"country_id\": 231,
\"zip\": \"91504\",
\"phone\": \"0123123123\"
},
\"shipping\": {
\"name\": \"crater Invoice\",
\"address_street_1\": \"Address 1\",
\"address_street_2\": \"Address 2\",
\"city\": \"Los Angeles\",
\"state\": \"California\",
\"country_id\": 231,
\"zip\": \"91504\",
\"phone\": \"0123123123\"
}
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/customers/787"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "john",
"email": "john@gmail.com",
"phone": "0123123123",
"contact_first_name": "xyz",
"contact_last_name": "john",
"website": "http:\/\/craterapp.com",
"billing": {
"name": "Crater Invoice",
"address_street_1": "Address 1",
"address_street_2": "Address 2",
"city": "Los Angeles",
"state": "California",
"country_id": 231,
"zip": "91504",
"phone": "0123123123"
},
"shipping": {
"name": "crater Invoice",
"address_street_1": "Address 1",
"address_street_2": "Address 2",
"city": "Los Angeles",
"state": "California",
"country_id": 231,
"zip": "91504",
"phone": "0123123123"
}
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://your-tenant.craterinvoice.com/api/v2/customers/787',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'john',
'email' => 'john@gmail.com',
'phone' => '0123123123',
'contact_first_name' => 'xyz',
'contact_last_name' => 'john',
'website' => 'http://craterapp.com',
'billing' => [
'name' => 'Crater Invoice',
'address_street_1' => 'Address 1',
'address_street_2' => 'Address 2',
'city' => 'Los Angeles',
'state' => 'California',
'country_id' => 231,
'zip' => '91504',
'phone' => '0123123123',
],
'shipping' => [
'name' => 'crater Invoice',
'address_street_1' => 'Address 1',
'address_street_2' => 'Address 2',
'city' => 'Los Angeles',
'state' => 'California',
'country_id' => 231,
'zip' => '91504',
'phone' => '0123123123',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Delete customer
requires authentication
Delete a Customer alongside all of their resources (i.e. Estimates, Invoices, Payments and Addresses)
Example request:
curl --request DELETE \
"https://your-tenant.craterinvoice.com/api/v2/customers/787" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/customers/787"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://your-tenant.craterinvoice.com/api/v2/customers/787',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Estimates
Send an estimate
requires authentication
Mail a specific estimate to the corresponding customer's email address.
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/send-email" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"subject\": \"exercitationem\",
\"body\": \"soluta\",
\"reply_to\": \"minima\",
\"to\": \"voluptas\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/send-email"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"subject": "exercitationem",
"body": "soluta",
"reply_to": "minima",
"to": "voluptas"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/estimates/1/send-email',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'subject' => 'exercitationem',
'body' => 'soluta',
'reply_to' => 'minima',
'to' => 'voluptas',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Accept an incoming estimate.
requires authentication
Endpoint to accept an incoming estimate.
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/accept" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"status\": \"ACCEPTED\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/accept"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"status": "ACCEPTED"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/estimates/1/accept',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'status' => 'ACCEPTED',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Reject an incoming estimate.
requires authentication
Endpoint to reject an incoming estimate.
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/reject" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"status\": \"REJECTED\",
\"reason\": \"alias\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/reject"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"status": "REJECTED",
"reason": "alias"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/estimates/1/reject',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'status' => 'REJECTED',
'reason' => 'alias',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Convert into invoice.
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/convert-to-invoice" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/convert-to-invoice"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/estimates/1/convert-to-invoice',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Add attachments to estimate
requires authentication
This endpoint is mainly used to add an attachments to invoice.
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/attachments" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates/1/attachments"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/estimates/1/attachments',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
List all estimate templates
requires authentication
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/estimates/templates" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates/templates"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/estimates/templates',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (500):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
{
"message": "Server Error"
}
Received response:
Request failed with error:
List all estimates
requires authentication
Returns a list of estimates for current business.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/estimates?limit=10&page=1&status=SENT&customer_id=1&estimate_number=0&from_date=2022-11-01&to_date=2022-11-04&incoming=1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates"
);
const params = {
"limit": "10",
"page": "1",
"status": "SENT",
"customer_id": "1",
"estimate_number": "0",
"from_date": "2022-11-01",
"to_date": "2022-11-04",
"incoming": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/estimates',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '10',
'page'=> '1',
'status'=> 'SENT',
'customer_id'=> '1',
'estimate_number'=> '0',
'from_date'=> '2022-11-01',
'to_date'=> '2022-11-04',
'incoming'=> '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 92,
"estimate_date": 125884800,
"expiry_date": 437875200,
"created_at": 1667663245,
"estimate_number": "EST-000002",
"sequence_number": 2,
"status": "DRAFT",
"notes": "Eligendi magnam exercitationem rerum nisi iure.",
"discount": 4,
"discount_type": "fixed",
"discount_val": 4,
"sub_total": 3,
"total": 5,
"tax": 1,
"unique_hash": "ZAg6b0wEnVfhzLp9xllAWBdJRxtzgCUqDkxafVX6AMk2EzgyWzUfwST0xkUy",
"creator_id": null,
"template_name": "estimate1",
"customer_id": 1077,
"currency_id": 1,
"estimate_pdf_url": "http://your-tenant.craterinvoice.com/estimates/pdf/ZAg6b0wEnVfhzLp9xllAWBdJRxtzgCUqDkxafVX6AMk2EzgyWzUfwST0xkUy",
"attachments": [],
"reject_reason": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO",
"estimate_type": "incoming",
"deposit": null,
"deductible": null,
"deposit_processing": null,
"deductible_processing": null
},
{
"id": 93,
"estimate_date": 615254400,
"expiry_date": 1351382400,
"created_at": 1667663245,
"estimate_number": "EST-000003",
"sequence_number": 3,
"status": "DRAFT",
"notes": "Qui tenetur et ut magnam eos ex. Aut velit rem sunt cum voluptas possimus.",
"discount": 1.28,
"discount_type": "percentage",
"discount_val": 32,
"sub_total": 5,
"total": 4,
"tax": 8,
"unique_hash": "6rgouKRV24cfO9LRpppB83n7qrNw5pNuD8bt7TDiBF4PNPjjroK3DkYbiyZU",
"creator_id": null,
"template_name": "estimate1",
"customer_id": 1078,
"currency_id": 1,
"estimate_pdf_url": "http://your-tenant.craterinvoice.com/estimates/pdf/6rgouKRV24cfO9LRpppB83n7qrNw5pNuD8bt7TDiBF4PNPjjroK3DkYbiyZU",
"attachments": [],
"reject_reason": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO",
"estimate_type": "incoming",
"deposit": null,
"deductible": null,
"deposit_processing": null,
"deductible_processing": null
}
]
}
Received response:
Request failed with error:
Create an estimate
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/estimates" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: multipart/form-data" \
--header "Accept: application/json" \
--header "business: 1" \
--form "estimate_date=2022-02-13" \
--form "expiry_date=2022-02-16" \
--form "customer_id=1" \
--form "estimate_number=EST-000001" \
--form "discount_type=fixed" \
--form "discount=50" \
--form "discount_val=5000" \
--form "tax=0" \
--form "template_name=estimate1" \
--form "items[][name]=Apple Macbook" \
--form "items[][quantity]=1" \
--form "items[][price]=10000" \
--form "items[][description]=Light and powerful laptop" \
--form "items[][item_id]=5" \
--form "items[][unit_name]=box" \
--form "items[][discount]=0" \
--form "items[][discount_type]=fixed" \
--form "items[][discount_val]=0" \
--form "attachments[]=@/private/var/folders/8c/6wjrzp5s0y9crtzp6p0b7sy00000gn/T/phpP71YZn"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
"business": "1",
};
const body = new FormData();
body.append('estimate_date', '2022-02-13');
body.append('expiry_date', '2022-02-16');
body.append('customer_id', '1');
body.append('estimate_number', 'EST-000001');
body.append('discount_type', 'fixed');
body.append('discount', '50');
body.append('discount_val', '5000');
body.append('tax', '0');
body.append('template_name', 'estimate1');
body.append('items[][name]', 'Apple Macbook');
body.append('items[][quantity]', '1');
body.append('items[][price]', '10000');
body.append('items[][description]', 'Light and powerful laptop');
body.append('items[][item_id]', '5');
body.append('items[][unit_name]', 'box');
body.append('items[][discount]', '0');
body.append('items[][discount_type]', 'fixed');
body.append('items[][discount_val]', '0');
body.append('attachments[]', document.querySelector('input[name="attachments[]"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/estimates',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'business' => '1',
],
'multipart' => [
[
'name' => 'estimate_date',
'contents' => '2022-02-13'
],
[
'name' => 'expiry_date',
'contents' => '2022-02-16'
],
[
'name' => 'customer_id',
'contents' => '1'
],
[
'name' => 'estimate_number',
'contents' => 'EST-000001'
],
[
'name' => 'discount_type',
'contents' => 'fixed'
],
[
'name' => 'discount',
'contents' => '50'
],
[
'name' => 'discount_val',
'contents' => '5000'
],
[
'name' => 'tax',
'contents' => '0'
],
[
'name' => 'template_name',
'contents' => 'estimate1'
],
[
'name' => 'items[][name]',
'contents' => 'Apple Macbook'
],
[
'name' => 'items[][quantity]',
'contents' => '1'
],
[
'name' => 'items[][price]',
'contents' => '10000'
],
[
'name' => 'items[][description]',
'contents' => 'Light and powerful laptop'
],
[
'name' => 'items[][item_id]',
'contents' => '5'
],
[
'name' => 'items[][unit_name]',
'contents' => 'box'
],
[
'name' => 'items[][discount]',
'contents' => '0'
],
[
'name' => 'items[][discount_type]',
'contents' => 'fixed'
],
[
'name' => 'items[][discount_val]',
'contents' => '0'
],
[
'name' => 'attachments[]',
'contents' => fopen('/private/var/folders/8c/6wjrzp5s0y9crtzp6p0b7sy00000gn/T/phpP71YZn', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 94,
"estimate_date": 457833600,
"expiry_date": 1279497600,
"created_at": 1667663245,
"estimate_number": "EST-000002",
"sequence_number": 2,
"status": "DRAFT",
"notes": "Necessitatibus repellendus eligendi tempore sint recusandae eligendi.",
"discount": 0.9,
"discount_type": "percentage",
"discount_val": 15,
"sub_total": 5,
"total": 6,
"tax": 6,
"unique_hash": "PQ5cevUC35qNpAt4UnmASM7EDR3bMgTmnvO2dUMPsqSux5bsfVSxOQEt91Yw",
"creator_id": null,
"template_name": "estimate1",
"customer_id": 1079,
"currency_id": 1,
"estimate_pdf_url": "http://your-tenant.craterinvoice.com/estimates/pdf/PQ5cevUC35qNpAt4UnmASM7EDR3bMgTmnvO2dUMPsqSux5bsfVSxOQEt91Yw",
"attachments": [],
"reject_reason": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO",
"estimate_type": "incoming",
"deposit": null,
"deductible": null,
"deposit_processing": null,
"deductible_processing": null
},
{
"id": 95,
"estimate_date": 1324771200,
"expiry_date": 43459200,
"created_at": 1667663245,
"estimate_number": "EST-000003",
"sequence_number": 3,
"status": "DRAFT",
"notes": "Ut id asperiores qui dolorem velit possimus iure ducimus.",
"discount": 7,
"discount_type": "fixed",
"discount_val": 7,
"sub_total": 6,
"total": 5,
"tax": 9,
"unique_hash": "HkPpEQRWxHzf7Vi5IehjLN2Xf0707YEQ0qBzTNhmdh2bazWgerFRtXaaKbXU",
"creator_id": null,
"template_name": "estimate1",
"customer_id": 1080,
"currency_id": 1,
"estimate_pdf_url": "http://your-tenant.craterinvoice.com/estimates/pdf/HkPpEQRWxHzf7Vi5IehjLN2Xf0707YEQ0qBzTNhmdh2bazWgerFRtXaaKbXU",
"attachments": [],
"reject_reason": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO",
"estimate_type": "incoming",
"deposit": null,
"deductible": null,
"deposit_processing": null,
"deductible_processing": null
}
]
}
Received response:
Request failed with error:
Retrieve an estimate
requires authentication
Retrieves an Estimate object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/estimates/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/estimates/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": {
"id": 96,
"estimate_date": 838857600,
"expiry_date": 1497571200,
"created_at": 1667663245,
"estimate_number": "EST-000002",
"sequence_number": 2,
"status": "DRAFT",
"notes": "Voluptatem minus nisi dolores quaerat ex maiores.",
"discount": 8,
"discount_type": "fixed",
"discount_val": 8,
"sub_total": 5,
"total": 1,
"tax": 5,
"unique_hash": "BcLoz99PwvHjRKX4Wxyw9vVu9X2SI3j8pW5zEOBPb1dMk5GSDvcWhHkbWcmo",
"creator_id": null,
"template_name": "estimate1",
"customer_id": 1081,
"currency_id": 1,
"estimate_pdf_url": "http://your-tenant.craterinvoice.com/estimates/pdf/BcLoz99PwvHjRKX4Wxyw9vVu9X2SI3j8pW5zEOBPb1dMk5GSDvcWhHkbWcmo",
"attachments": [],
"reject_reason": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO",
"estimate_type": "incoming",
"deposit": null,
"deductible": null,
"deposit_processing": null,
"deductible_processing": null
}
}
Received response:
Request failed with error:
Update an estimate
requires authentication
Example request:
curl --request PUT \
"https://your-tenant.craterinvoice.com/api/v2/estimates/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: multipart/form-data" \
--header "Accept: application/json" \
--header "business: 1" \
--form "estimate_date=2022-02-13" \
--form "expiry_date=2022-02-16" \
--form "customer_id=1" \
--form "estimate_number=EST-000001" \
--form "discount_type=fixed" \
--form "discount=50" \
--form "discount_val=5000" \
--form "tax=0" \
--form "template_name=estimate1" \
--form "items[][name]=Apple Macbook" \
--form "items[][quantity]=1" \
--form "items[][price]=10000" \
--form "items[][description]=Light and powerful laptop" \
--form "items[][item_id]=5" \
--form "items[][unit_name]=box" \
--form "items[][discount]=0" \
--form "items[][discount_type]=fixed" \
--form "items[][discount_val]=0" \
--form "attachments[]=@/private/var/folders/8c/6wjrzp5s0y9crtzp6p0b7sy00000gn/T/phpv5anEx"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
"business": "1",
};
const body = new FormData();
body.append('estimate_date', '2022-02-13');
body.append('expiry_date', '2022-02-16');
body.append('customer_id', '1');
body.append('estimate_number', 'EST-000001');
body.append('discount_type', 'fixed');
body.append('discount', '50');
body.append('discount_val', '5000');
body.append('tax', '0');
body.append('template_name', 'estimate1');
body.append('items[][name]', 'Apple Macbook');
body.append('items[][quantity]', '1');
body.append('items[][price]', '10000');
body.append('items[][description]', 'Light and powerful laptop');
body.append('items[][item_id]', '5');
body.append('items[][unit_name]', 'box');
body.append('items[][discount]', '0');
body.append('items[][discount_type]', 'fixed');
body.append('items[][discount_val]', '0');
body.append('attachments[]', document.querySelector('input[name="attachments[]"]').files[0]);
fetch(url, {
method: "PUT",
headers,
body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://your-tenant.craterinvoice.com/api/v2/estimates/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'business' => '1',
],
'multipart' => [
[
'name' => 'estimate_date',
'contents' => '2022-02-13'
],
[
'name' => 'expiry_date',
'contents' => '2022-02-16'
],
[
'name' => 'customer_id',
'contents' => '1'
],
[
'name' => 'estimate_number',
'contents' => 'EST-000001'
],
[
'name' => 'discount_type',
'contents' => 'fixed'
],
[
'name' => 'discount',
'contents' => '50'
],
[
'name' => 'discount_val',
'contents' => '5000'
],
[
'name' => 'tax',
'contents' => '0'
],
[
'name' => 'template_name',
'contents' => 'estimate1'
],
[
'name' => 'items[][name]',
'contents' => 'Apple Macbook'
],
[
'name' => 'items[][quantity]',
'contents' => '1'
],
[
'name' => 'items[][price]',
'contents' => '10000'
],
[
'name' => 'items[][description]',
'contents' => 'Light and powerful laptop'
],
[
'name' => 'items[][item_id]',
'contents' => '5'
],
[
'name' => 'items[][unit_name]',
'contents' => 'box'
],
[
'name' => 'items[][discount]',
'contents' => '0'
],
[
'name' => 'items[][discount_type]',
'contents' => 'fixed'
],
[
'name' => 'items[][discount_val]',
'contents' => '0'
],
[
'name' => 'attachments[]',
'contents' => fopen('/private/var/folders/8c/6wjrzp5s0y9crtzp6p0b7sy00000gn/T/phpv5anEx', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Delete estimate
requires authentication
Delete a specific Estimate
Example request:
curl --request DELETE \
"https://your-tenant.craterinvoice.com/api/v2/estimates/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/estimates/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://your-tenant.craterinvoice.com/api/v2/estimates/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Invoices
Send an invoice
requires authentication
Mail a specific invoice to the corresponding customer's email address.
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/invoices/2/send-email" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"body\": \"You have received an from xyz company.\",
\"subject\": \"You have received an invoice\",
\"reply_to\": \"reply@abc.com\",
\"to\": \"to@abc.com\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices/2/send-email"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"body": "You have received an from xyz company.",
"subject": "You have received an invoice",
"reply_to": "reply@abc.com",
"to": "to@abc.com"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/invoices/2/send-email',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'body' => 'You have received an from xyz company.',
'subject' => 'You have received an invoice',
'reply_to' => 'reply@abc.com',
'to' => 'to@abc.com',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Clone an invoice
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/invoices/11/clone" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices/11/clone"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/invoices/11/clone',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Approve an incoming invoice.
requires authentication
Endpoint to approve an incoming invoice.
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/invoices/12/approve-incoming" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices/12/approve-incoming"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/invoices/12/approve-incoming',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Reject an incoming invoice.
requires authentication
Endpoint to reject an incoming invoice.
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/invoices/16/reject-incoming" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"reason\": \"The invoice does not belongs to our business.\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices/16/reject-incoming"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"reason": "The invoice does not belongs to our business."
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/invoices/16/reject-incoming',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'reason' => 'The invoice does not belongs to our business.',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Add attachments to invoice
requires authentication
This endpoint is mainly used to add an attachments to invoice.
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/invoices/10/attachments" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices/10/attachments"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/invoices/10/attachments',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
List all invoice templates
requires authentication
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/invoices/templates" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices/templates"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/invoices/templates',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (500):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
{
"message": "Server Error"
}
Received response:
Request failed with error:
List all invoices
requires authentication
Returns a list of your invoices.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/invoices?limit=14&page=18&status=odio&customer_id=quo&invoice_number=15&from_date=quibusdam&to_date=vero" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices"
);
const params = {
"limit": "14",
"page": "18",
"status": "odio",
"customer_id": "quo",
"invoice_number": "15",
"from_date": "quibusdam",
"to_date": "vero",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/invoices',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '14',
'page'=> '18',
'status'=> 'odio',
'customer_id'=> 'quo',
'invoice_number'=> '15',
'from_date'=> 'quibusdam',
'to_date'=> 'vero',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 285,
"unique_hash": "fCilMgsQsiZUu9lWhibDCj3z2LOhyo9ZkZNMe3Cx8M7O26BTzBaOTuKQ6K87",
"invoicing_enabled": true,
"invoice_date": 1169683200,
"created_at": 1667663246,
"due_date": 1054598400,
"invoice_number": "INV-000001",
"status": "DRAFT",
"paid_status": "UNPAID",
"reject_reason": null,
"notes": "Culpa voluptatem quos quas qui corrupti repudiandae.",
"discount_type": "fixed",
"discount": 3,
"discount_val": 3,
"sub_total": 7798,
"tax": 5,
"total": 7580,
"due_amount": 7580,
"sent_at": null,
"viewed_at": null,
"overdue_at": null,
"template_name": "invoice1",
"sequence_number": 1,
"customer_id": 1085,
"creator_id": null,
"invoice_pdf_url": "http://your-tenant.craterinvoice.com/invoices/pdf/fCilMgsQsiZUu9lWhibDCj3z2LOhyo9ZkZNMe3Cx8M7O26BTzBaOTuKQ6K87",
"attachments": [],
"quickbooks_id": null,
"ar_paid": null,
"invoice_type": "incoming",
"loan_status": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO"
},
{
"id": 286,
"unique_hash": "X4Agd3IbYJgOchZY9SaXynW5GXJL0maqRUGf5cEvvoWetuepkFA8f4OsYJO3",
"invoicing_enabled": true,
"invoice_date": 896400000,
"created_at": 1667663246,
"due_date": 1241136000,
"invoice_number": "INV-000002",
"status": "DRAFT",
"paid_status": "UNPAID",
"reject_reason": null,
"notes": "Incidunt autem voluptas quibusdam natus.",
"discount_type": "fixed",
"discount": 1,
"discount_val": 1,
"sub_total": 1709,
"tax": 7,
"total": 9969,
"due_amount": 9969,
"sent_at": null,
"viewed_at": null,
"overdue_at": null,
"template_name": "invoice1",
"sequence_number": 2,
"customer_id": 1086,
"creator_id": null,
"invoice_pdf_url": "http://your-tenant.craterinvoice.com/invoices/pdf/X4Agd3IbYJgOchZY9SaXynW5GXJL0maqRUGf5cEvvoWetuepkFA8f4OsYJO3",
"attachments": [],
"quickbooks_id": null,
"ar_paid": null,
"invoice_type": "incoming",
"loan_status": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO"
}
]
}
Received response:
Request failed with error:
Create an invoice
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/invoices" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: multipart/form-data" \
--header "Accept: application/json" \
--header "business: 1" \
--form "invoice_number=INV-000001" \
--form "invoice_date=2022-02-13" \
--form "due_date=2022-02-16" \
--form "customer_id=1" \
--form "sub_total=10000" \
--form "discount_type=fixed" \
--form "discount=50" \
--form "discount_val=5000" \
--form "template_name=invoice1" \
--form "items[][name]=Apple Macbook" \
--form "items[][quantity]=1" \
--form "items[][price]=10000" \
--form "items[][description]=Light and powerful laptop" \
--form "items[][item_id]=5" \
--form "items[][sub_total]=10000" \
--form "items[][total]=10000" \
--form "items[][unit_name]=box" \
--form "items[][discount]=0" \
--form "items[][discount_type]=fixed" \
--form "items[][discount_val]=0" \
--form "total=5000" \
--form "attachments[]=@/private/var/folders/8c/6wjrzp5s0y9crtzp6p0b7sy00000gn/T/phpB2GW8X"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
"business": "1",
};
const body = new FormData();
body.append('invoice_number', 'INV-000001');
body.append('invoice_date', '2022-02-13');
body.append('due_date', '2022-02-16');
body.append('customer_id', '1');
body.append('sub_total', '10000');
body.append('discount_type', 'fixed');
body.append('discount', '50');
body.append('discount_val', '5000');
body.append('template_name', 'invoice1');
body.append('items[][name]', 'Apple Macbook');
body.append('items[][quantity]', '1');
body.append('items[][price]', '10000');
body.append('items[][description]', 'Light and powerful laptop');
body.append('items[][item_id]', '5');
body.append('items[][sub_total]', '10000');
body.append('items[][total]', '10000');
body.append('items[][unit_name]', 'box');
body.append('items[][discount]', '0');
body.append('items[][discount_type]', 'fixed');
body.append('items[][discount_val]', '0');
body.append('total', '5000');
body.append('attachments[]', document.querySelector('input[name="attachments[]"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/invoices',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'business' => '1',
],
'multipart' => [
[
'name' => 'invoice_number',
'contents' => 'INV-000001'
],
[
'name' => 'invoice_date',
'contents' => '2022-02-13'
],
[
'name' => 'due_date',
'contents' => '2022-02-16'
],
[
'name' => 'customer_id',
'contents' => '1'
],
[
'name' => 'sub_total',
'contents' => '10000'
],
[
'name' => 'discount_type',
'contents' => 'fixed'
],
[
'name' => 'discount',
'contents' => '50'
],
[
'name' => 'discount_val',
'contents' => '5000'
],
[
'name' => 'template_name',
'contents' => 'invoice1'
],
[
'name' => 'items[][name]',
'contents' => 'Apple Macbook'
],
[
'name' => 'items[][quantity]',
'contents' => '1'
],
[
'name' => 'items[][price]',
'contents' => '10000'
],
[
'name' => 'items[][description]',
'contents' => 'Light and powerful laptop'
],
[
'name' => 'items[][item_id]',
'contents' => '5'
],
[
'name' => 'items[][sub_total]',
'contents' => '10000'
],
[
'name' => 'items[][total]',
'contents' => '10000'
],
[
'name' => 'items[][unit_name]',
'contents' => 'box'
],
[
'name' => 'items[][discount]',
'contents' => '0'
],
[
'name' => 'items[][discount_type]',
'contents' => 'fixed'
],
[
'name' => 'items[][discount_val]',
'contents' => '0'
],
[
'name' => 'total',
'contents' => '5000'
],
[
'name' => 'attachments[]',
'contents' => fopen('/private/var/folders/8c/6wjrzp5s0y9crtzp6p0b7sy00000gn/T/phpB2GW8X', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 287,
"unique_hash": "YjmdjEKWp6ZYpsx3Ls9dCVTshdiwAuYpL3kcotYBaKLfT5RanWDx23AYbtPB",
"invoicing_enabled": true,
"invoice_date": 1487635200,
"created_at": 1667663246,
"due_date": 556243200,
"invoice_number": "INV-000001",
"status": "DRAFT",
"paid_status": "UNPAID",
"reject_reason": null,
"notes": "Velit ut et accusantium autem earum rerum. Enim quidem tempore enim qui non ea.",
"discount_type": "percentage",
"discount": 3326.3,
"discount_val": 37,
"sub_total": 8653,
"tax": 6,
"total": 8990,
"due_amount": 8990,
"sent_at": null,
"viewed_at": null,
"overdue_at": null,
"template_name": "invoice1",
"sequence_number": 1,
"customer_id": 1087,
"creator_id": null,
"invoice_pdf_url": "http://your-tenant.craterinvoice.com/invoices/pdf/YjmdjEKWp6ZYpsx3Ls9dCVTshdiwAuYpL3kcotYBaKLfT5RanWDx23AYbtPB",
"attachments": [],
"quickbooks_id": null,
"ar_paid": null,
"invoice_type": "incoming",
"loan_status": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO"
},
{
"id": 288,
"unique_hash": "GHs58RzOph6LD6abJJxiMkUd1NEsFiNZZ8wMSEBGriilb0xwOVPTwbHxOekM",
"invoicing_enabled": true,
"invoice_date": 1041811200,
"created_at": 1667663246,
"due_date": 860457600,
"invoice_number": "INV-000002",
"status": "DRAFT",
"paid_status": "UNPAID",
"reject_reason": null,
"notes": "Esse et sed aspernatur repudiandae praesentium maxime.",
"discount_type": "percentage",
"discount": 3634.36,
"discount_val": 86,
"sub_total": 7491,
"tax": 3,
"total": 4226,
"due_amount": 4226,
"sent_at": null,
"viewed_at": null,
"overdue_at": null,
"template_name": "invoice1",
"sequence_number": 2,
"customer_id": 1088,
"creator_id": null,
"invoice_pdf_url": "http://your-tenant.craterinvoice.com/invoices/pdf/GHs58RzOph6LD6abJJxiMkUd1NEsFiNZZ8wMSEBGriilb0xwOVPTwbHxOekM",
"attachments": [],
"quickbooks_id": null,
"ar_paid": null,
"invoice_type": "incoming",
"loan_status": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO"
}
]
}
Received response:
Request failed with error:
Retrieve an invoice
requires authentication
Retrieves an Invoice object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/invoices/17" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices/17"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/invoices/17',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": {
"id": 289,
"unique_hash": "iSpgPGl7xpCxqE8tbhQN4Yc7RoMyXNiAkoAhbwkdzed1V4SNZkfC0A1OoKNh",
"invoicing_enabled": true,
"invoice_date": 1019347200,
"created_at": 1667663246,
"due_date": 723859200,
"invoice_number": "INV-000001",
"status": "DRAFT",
"paid_status": "UNPAID",
"reject_reason": null,
"notes": "Voluptates omnis et atque quaerat quia dignissimos.",
"discount_type": "percentage",
"discount": 4498.34,
"discount_val": 77,
"sub_total": 3100,
"tax": 4,
"total": 5842,
"due_amount": 5842,
"sent_at": null,
"viewed_at": null,
"overdue_at": null,
"template_name": "invoice1",
"sequence_number": 1,
"customer_id": 1089,
"creator_id": null,
"invoice_pdf_url": "http://your-tenant.craterinvoice.com/invoices/pdf/iSpgPGl7xpCxqE8tbhQN4Yc7RoMyXNiAkoAhbwkdzed1V4SNZkfC0A1OoKNh",
"attachments": [],
"quickbooks_id": null,
"ar_paid": null,
"invoice_type": "incoming",
"loan_status": null,
"tax_per_item_enabled": "NO",
"discount_per_item_enabled": "NO"
}
}
Received response:
Request failed with error:
Update an invoice
requires authentication
Example request:
curl --request PUT \
"https://your-tenant.craterinvoice.com/api/v2/invoices/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: multipart/form-data" \
--header "Accept: application/json" \
--header "business: 1" \
--form "invoice_number=INV-000001" \
--form "invoice_date=2022-02-13" \
--form "due_date=2022-02-16" \
--form "customer_id=1" \
--form "sub_total=10000" \
--form "discount_type=fixed" \
--form "discount=50" \
--form "discount_val=5000" \
--form "template_name=invoice1" \
--form "items[][name]=Apple Macbook" \
--form "items[][quantity]=1" \
--form "items[][price]=10000" \
--form "items[][description]=Light and powerful laptop" \
--form "items[][item_id]=5" \
--form "items[][sub_total]=10000" \
--form "items[][total]=10000" \
--form "items[][unit_name]=box" \
--form "items[][discount]=0" \
--form "items[][discount_type]=fixed" \
--form "items[][discount_val]=0" \
--form "total=5000" \
--form "attachments[]=@/private/var/folders/8c/6wjrzp5s0y9crtzp6p0b7sy00000gn/T/phpPQQ0cC"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
"business": "1",
};
const body = new FormData();
body.append('invoice_number', 'INV-000001');
body.append('invoice_date', '2022-02-13');
body.append('due_date', '2022-02-16');
body.append('customer_id', '1');
body.append('sub_total', '10000');
body.append('discount_type', 'fixed');
body.append('discount', '50');
body.append('discount_val', '5000');
body.append('template_name', 'invoice1');
body.append('items[][name]', 'Apple Macbook');
body.append('items[][quantity]', '1');
body.append('items[][price]', '10000');
body.append('items[][description]', 'Light and powerful laptop');
body.append('items[][item_id]', '5');
body.append('items[][sub_total]', '10000');
body.append('items[][total]', '10000');
body.append('items[][unit_name]', 'box');
body.append('items[][discount]', '0');
body.append('items[][discount_type]', 'fixed');
body.append('items[][discount_val]', '0');
body.append('total', '5000');
body.append('attachments[]', document.querySelector('input[name="attachments[]"]').files[0]);
fetch(url, {
method: "PUT",
headers,
body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://your-tenant.craterinvoice.com/api/v2/invoices/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'business' => '1',
],
'multipart' => [
[
'name' => 'invoice_number',
'contents' => 'INV-000001'
],
[
'name' => 'invoice_date',
'contents' => '2022-02-13'
],
[
'name' => 'due_date',
'contents' => '2022-02-16'
],
[
'name' => 'customer_id',
'contents' => '1'
],
[
'name' => 'sub_total',
'contents' => '10000'
],
[
'name' => 'discount_type',
'contents' => 'fixed'
],
[
'name' => 'discount',
'contents' => '50'
],
[
'name' => 'discount_val',
'contents' => '5000'
],
[
'name' => 'template_name',
'contents' => 'invoice1'
],
[
'name' => 'items[][name]',
'contents' => 'Apple Macbook'
],
[
'name' => 'items[][quantity]',
'contents' => '1'
],
[
'name' => 'items[][price]',
'contents' => '10000'
],
[
'name' => 'items[][description]',
'contents' => 'Light and powerful laptop'
],
[
'name' => 'items[][item_id]',
'contents' => '5'
],
[
'name' => 'items[][sub_total]',
'contents' => '10000'
],
[
'name' => 'items[][total]',
'contents' => '10000'
],
[
'name' => 'items[][unit_name]',
'contents' => 'box'
],
[
'name' => 'items[][discount]',
'contents' => '0'
],
[
'name' => 'items[][discount_type]',
'contents' => 'fixed'
],
[
'name' => 'items[][discount_val]',
'contents' => '0'
],
[
'name' => 'total',
'contents' => '5000'
],
[
'name' => 'attachments[]',
'contents' => fopen('/private/var/folders/8c/6wjrzp5s0y9crtzp6p0b7sy00000gn/T/phpPQQ0cC', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Delete invoice
requires authentication
Delete an invoice
Example request:
curl --request DELETE \
"https://your-tenant.craterinvoice.com/api/v2/invoices/2" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/invoices/2"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://your-tenant.craterinvoice.com/api/v2/invoices/2',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Payments
API Endpoints for managing payments
Send payment receipt
requires authentication
Mail the payment receipt to the corresponding customer's email address.
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/payments/1/send-email" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"subject\": \"You have received a payment details for your invoice\",
\"body\": \"You have received a payment details for your invoice.\",
\"reply_to\": \"reply@abc.com\",
\"to\": \"to@abc.com\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/payments/1/send-email"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"subject": "You have received a payment details for your invoice",
"body": "You have received a payment details for your invoice.",
"reply_to": "reply@abc.com",
"to": "to@abc.com"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/payments/1/send-email',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'subject' => 'You have received a payment details for your invoice',
'body' => 'You have received a payment details for your invoice.',
'reply_to' => 'reply@abc.com',
'to' => 'to@abc.com',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
List all payments
requires authentication
Returns a list of your payments.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/payments?limit=18&page=16&payment_number=11&customer_id=quisquam&payment_method_id=ad" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/payments"
);
const params = {
"limit": "18",
"page": "16",
"payment_number": "11",
"customer_id": "quisquam",
"payment_method_id": "ad",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/payments',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '18',
'page'=> '16',
'payment_number'=> '11',
'customer_id'=> 'quisquam',
'payment_method_id'=> 'ad',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 157,
"payment_number": "PAY-000001",
"payment_date": 1649721600,
"created_at": 1667663245,
"notes": "Ut odio explicabo modi animi consequatur ad mollitia sequi.",
"amount": 6,
"unique_hash": "oYkDqp7AWafRDYc3oApZstBGDxdvBizQEDsWAeDtW9p5RbM6dmxaO8PS1YWT",
"invoice_id": null,
"business_id": 1,
"payment_method_id": 373,
"creator_id": null,
"customer_id": 1082,
"currency_id": 1,
"transaction_id": null,
"sequence_number": 1,
"payment_pdf_url": "http://your-tenant.craterinvoice.com/payments/pdf/oYkDqp7AWafRDYc3oApZstBGDxdvBizQEDsWAeDtW9p5RbM6dmxaO8PS1YWT",
"attachments": [],
"customer": {
"id": 1082,
"name": "Tyrel Bergnaum",
"business_id": 1,
"customer_business_id": null,
"email": "lauren.luettgen@example.net",
"phone": "+1-828-361-5039",
"contact_first_name": "Amy",
"contact_last_name": "Bahringer",
"website": "https://www.rutherford.com/eaque-vero-distinctio-aut-et-deleniti-aut-error",
"created_at": 1667663245,
"updated_at": 1667663245,
"due_amount": null,
"billing": null,
"shipping": null
},
"payment_method": {
"id": 373,
"name": "ACH",
"business_id": 1
},
"business": {
"id": 1,
"name": "Jones Vendor",
"website": null,
"phone": null,
"email": "vendor@getjones.com",
"logo": null,
"unique_hash": "l5DL6E1K8Bn8x0YVnBPO",
"profile_completed": 0,
"slug": "jones-vendor",
"contact_first_name": null,
"contact_last_name": null,
"charges_enabled": null,
"payouts_enabled": null,
"details_submitted": null,
"business_type": null,
"requirements": null,
"created_at": 1667372609,
"address": {
"id": 1,
"name": null,
"address_street_1": null,
"address_street_2": null,
"city": null,
"state": null,
"country_id": 231,
"zip": null,
"phone": null,
"email": null,
"type": null,
"user_id": null,
"business_id": 1,
"customer_id": null,
"country": {
"id": 231,
"code": "US",
"name": "United States",
"phone_code": null
}
}
},
"payment_type": "incoming"
},
{
"id": 158,
"payment_number": "PAY-000002",
"payment_date": 188784000,
"created_at": 1667663245,
"notes": "Possimus facilis accusamus assumenda distinctio occaecati numquam.",
"amount": 6,
"unique_hash": "G58rscltWwrrPgsaozlXCubMGMpb30VzDUzcTXcRJiQczbZEvHirSoOh8iJF",
"invoice_id": null,
"business_id": 1,
"payment_method_id": 374,
"creator_id": null,
"customer_id": 1083,
"currency_id": 1,
"transaction_id": null,
"sequence_number": 2,
"payment_pdf_url": "http://your-tenant.craterinvoice.com/payments/pdf/G58rscltWwrrPgsaozlXCubMGMpb30VzDUzcTXcRJiQczbZEvHirSoOh8iJF",
"attachments": [],
"customer": {
"id": 1083,
"name": "Stephan Hyatt",
"business_id": 1,
"customer_business_id": null,
"email": "langosh.emanuel@example.org",
"phone": "828.396.9278",
"contact_first_name": "Lavada",
"contact_last_name": "Fritsch",
"website": "http://little.org/",
"created_at": 1667663245,
"updated_at": 1667663245,
"due_amount": null,
"billing": null,
"shipping": null
},
"payment_method": {
"id": 374,
"name": "Credit Card",
"business_id": 1
},
"business": {
"id": 1,
"name": "Jones Vendor",
"website": null,
"phone": null,
"email": "vendor@getjones.com",
"logo": null,
"unique_hash": "l5DL6E1K8Bn8x0YVnBPO",
"profile_completed": 0,
"slug": "jones-vendor",
"contact_first_name": null,
"contact_last_name": null,
"charges_enabled": null,
"payouts_enabled": null,
"details_submitted": null,
"business_type": null,
"requirements": null,
"created_at": 1667372609,
"address": {
"id": 1,
"name": null,
"address_street_1": null,
"address_street_2": null,
"city": null,
"state": null,
"country_id": 231,
"zip": null,
"phone": null,
"email": null,
"type": null,
"user_id": null,
"business_id": 1,
"customer_id": null,
"country": {
"id": 231,
"code": "US",
"name": "United States",
"phone_code": null
}
}
},
"payment_type": "incoming"
}
]
}
Received response:
Request failed with error:
Retrieve a payment
requires authentication
Retrieves a Payment object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/payments/3" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/payments/3"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/payments/3',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": {
"id": 159,
"payment_number": "PAY-000001",
"payment_date": 1444262400,
"created_at": 1667663245,
"notes": "Explicabo aspernatur dicta porro animi enim veritatis occaecati.",
"amount": 7,
"unique_hash": "VADHiSval0Gjtd6QrdL0u8dEkHpQYoMSM45JffDgdefEuxlB0F2UKnoISyg0",
"invoice_id": null,
"business_id": 1,
"payment_method_id": 375,
"creator_id": null,
"customer_id": 1084,
"currency_id": 1,
"transaction_id": null,
"sequence_number": 1,
"payment_pdf_url": "http://your-tenant.craterinvoice.com/payments/pdf/VADHiSval0Gjtd6QrdL0u8dEkHpQYoMSM45JffDgdefEuxlB0F2UKnoISyg0",
"attachments": [],
"customer": {
"id": 1084,
"name": "Edgar Terry",
"business_id": 1,
"customer_business_id": null,
"email": "sherman.jacobson@example.net",
"phone": "+14018101941",
"contact_first_name": "Neoma",
"contact_last_name": "Block",
"website": "http://www.huels.com/et-accusamus-quaerat-tempore-deleniti-qui-officiis",
"created_at": 1667663245,
"updated_at": 1667663245,
"due_amount": null,
"billing": null,
"shipping": null
},
"payment_method": {
"id": 375,
"name": "ACH",
"business_id": 1
},
"business": {
"id": 1,
"name": "Jones Vendor",
"website": null,
"phone": null,
"email": "vendor@getjones.com",
"logo": null,
"unique_hash": "l5DL6E1K8Bn8x0YVnBPO",
"profile_completed": 0,
"slug": "jones-vendor",
"contact_first_name": null,
"contact_last_name": null,
"charges_enabled": null,
"payouts_enabled": null,
"details_submitted": null,
"business_type": null,
"requirements": null,
"created_at": 1667372609,
"address": {
"id": 1,
"name": null,
"address_street_1": null,
"address_street_2": null,
"city": null,
"state": null,
"country_id": 231,
"zip": null,
"phone": null,
"email": null,
"type": null,
"user_id": null,
"business_id": 1,
"customer_id": null,
"country": {
"id": 231,
"code": "US",
"name": "United States",
"phone_code": null
}
}
},
"payment_type": "incoming"
}
}
Received response:
Request failed with error:
Items
API Endpoints for managing items
List all items
requires authentication
Returns a list of your items.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/items?limit=8&page=5&price=consequatur&unit_id=eum&name=voluptates" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/items"
);
const params = {
"limit": "8",
"page": "5",
"price": "consequatur",
"unit_id": "eum",
"name": "voluptates",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/items',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '8',
'page'=> '5',
'price'=> 'consequatur',
'unit_id'=> 'eum',
'name'=> 'voluptates',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 181,
"name": "Prof. Marcos Kshlerin",
"description": "Beatae sit consequatur adipisci. Qui illum ipsum eveniet in veritatis. Atque nobis dolorem doloremque qui commodi quis.",
"price": 4,
"unit_id": 370,
"business_id": 1,
"creator_id": null,
"currency_id": null,
"created_at": 1667663246,
"updated_at": 1667663246,
"tax_per_item_enabled": true
},
{
"id": 182,
"name": "Viviane Wehner",
"description": "Qui quaerat accusamus ipsum sit quis exercitationem. Id reiciendis non et placeat. Corporis praesentium pariatur quo sint aspernatur.",
"price": 2,
"unit_id": 371,
"business_id": 1,
"creator_id": null,
"currency_id": null,
"created_at": 1667663246,
"updated_at": 1667663246,
"tax_per_item_enabled": true
}
]
}
Received response:
Request failed with error:
Create an item
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/items" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"Laptop\",
\"price\": 6,
\"unit_id\": 1
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/items"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "Laptop",
"price": 6,
"unit_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/items',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'Laptop',
'price' => 6,
'unit_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Retrieve an item
requires authentication
Retrieves an Item object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/items/15" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/items/15"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/items/15',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": {
"id": 183,
"name": "Mr. Candelario Wuckert",
"description": "Eius eos et facere. Et illo quia veritatis labore sequi voluptas dolorem sunt. Velit et voluptatem voluptatem. Ut quod quisquam explicabo laudantium.",
"price": 8,
"unit_id": 372,
"business_id": 1,
"creator_id": null,
"currency_id": null,
"created_at": 1667663246,
"updated_at": 1667663246,
"tax_per_item_enabled": false
}
}
Received response:
Request failed with error:
Update an item
requires authentication
Example request:
curl --request PUT \
"https://your-tenant.craterinvoice.com/api/v2/items/20" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"Laptop\",
\"price\": 13,
\"unit_id\": 1
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/items/20"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "Laptop",
"price": 13,
"unit_id": 1
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://your-tenant.craterinvoice.com/api/v2/items/20',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'Laptop',
'price' => 13,
'unit_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Delete item
requires authentication
Delete a specific Item
Example request:
curl --request DELETE \
"https://your-tenant.craterinvoice.com/api/v2/items/2" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/items/2"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://your-tenant.craterinvoice.com/api/v2/items/2',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Item Units
API Endpoints for managing item units
List all item units
requires authentication
Returns a list of your item units.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/item-units?limit=1&page=15" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/item-units"
);
const params = {
"limit": "1",
"page": "15",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/item-units',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '1',
'page'=> '15',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 373,
"name": "Myrna Willms",
"business_id": 1
},
{
"id": 374,
"name": "Mr. London Sanford II",
"business_id": 1
}
]
}
Received response:
Request failed with error:
Create an item unit
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/item-units" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"box\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/item-units"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "box"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/item-units',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'box',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Retrieve an item unit
requires authentication
Retrieves an Item unit object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/item-units/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/item-units/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/item-units/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": {
"id": 375,
"name": "Miss Chloe Jast II",
"business_id": 1
}
}
Received response:
Request failed with error:
Update an item unit
requires authentication
Example request:
curl --request PUT \
"https://your-tenant.craterinvoice.com/api/v2/item-units/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"box\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/item-units/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "box"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://your-tenant.craterinvoice.com/api/v2/item-units/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'box',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Delete an item unit
requires authentication
Example request:
curl --request DELETE \
"https://your-tenant.craterinvoice.com/api/v2/item-units/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/item-units/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://your-tenant.craterinvoice.com/api/v2/item-units/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
General
Next Sequence Number
requires authentication
Get Next Number for Invoices or Estimates or Payments
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/next-number" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/next-number"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/next-number',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"nextNumber": "INV-000001",
"nextSequenceNumber": 1
}
Received response:
Request failed with error:
Notes
API Endpoints for managing notes
List all notes
requires authentication
Returns a list of your notes.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/notes?limit=11&page=4" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/notes"
);
const params = {
"limit": "11",
"page": "4",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/notes',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '11',
'page'=> '4',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 79,
"type": "Payment",
"name": "ut",
"notes": "Et sit sunt quis dignissimos minima. Id voluptate illo non debitis nobis ea. Ea dolore rem optio rerum placeat consequatur quidem officiis."
},
{
"id": 80,
"type": "Payment",
"name": "minus",
"notes": "Odit modi quidem aliquid velit. Est autem distinctio tenetur fugit similique quidem doloremque."
}
]
}
Received response:
Request failed with error:
Create a note
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/notes" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"invoice note\",
\"type\": \"Invoice\",
\"notes\": \"Invoice should we paid within 5 days.\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/notes"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "invoice note",
"type": "Invoice",
"notes": "Invoice should we paid within 5 days."
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/notes',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'invoice note',
'type' => 'Invoice',
'notes' => 'Invoice should we paid within 5 days.',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Retrieve a note
requires authentication
Retrieves a note object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/notes/19" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/notes/19"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/notes/19',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": {
"id": 81,
"type": "Estimate",
"name": "culpa",
"notes": "Ab natus ratione dolorem. Quasi ratione ut sed reiciendis sed illo non. Laboriosam nesciunt voluptatum voluptates et sit."
}
}
Received response:
Request failed with error:
Update a note
requires authentication
Example request:
curl --request PUT \
"https://your-tenant.craterinvoice.com/api/v2/notes/12" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"invoice note\",
\"type\": \"Invoice\",
\"notes\": \"Invoice should we paid within 5 days.\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/notes/12"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "invoice note",
"type": "Invoice",
"notes": "Invoice should we paid within 5 days."
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://your-tenant.craterinvoice.com/api/v2/notes/12',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'invoice note',
'type' => 'Invoice',
'notes' => 'Invoice should we paid within 5 days.',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Delete a note
requires authentication
Example request:
curl --request DELETE \
"https://your-tenant.craterinvoice.com/api/v2/notes/19" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/notes/19"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://your-tenant.craterinvoice.com/api/v2/notes/19',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Payment Methods
API Endpoints for managing payment methods
List all payment methods
requires authentication
Returns a list of your payment methods.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/payments/methods?limit=8&page=17" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/payments/methods"
);
const params = {
"limit": "8",
"page": "17",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/payments/methods',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '8',
'page'=> '17',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 369,
"name": "Credit Card",
"business_id": 1
},
{
"id": 370,
"name": "Credit Card",
"business_id": 1
}
]
}
Received response:
Request failed with error:
Retrieve a payment method
requires authentication
Retrieves a Payment Method object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/payments/methods/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/payments/methods/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/payments/methods/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 371,
"name": "Credit Card",
"business_id": 1
},
{
"id": 372,
"name": "ACH",
"business_id": 1
}
]
}
Received response:
Request failed with error:
Tax Types
API Endpoints for managing tax types
List all tax types
requires authentication
Returns a list of your tax types.
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/tax-types?limit=10&page=10" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/tax-types"
);
const params = {
"limit": "10",
"page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/tax-types',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'query' => [
'limit'=> '10',
'page'=> '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 128,
"name": "unde",
"percent": 73,
"type": null,
"description": "Sed ipsum aut aut doloribus et. Exercitationem laborum ex et quam. Quo et molestiae aspernatur quaerat. Quia quia magni numquam qui rerum corporis omnis.",
"business_id": 1
},
{
"id": 129,
"name": "maxime",
"percent": 51,
"type": null,
"description": "Qui ex rerum et quibusdam et distinctio sit exercitationem. Sit quia et aperiam libero quia et et. Necessitatibus sit cum dicta quibusdam.",
"business_id": 1
}
]
}
Received response:
Request failed with error:
Create a tax type
requires authentication
Example request:
curl --request POST \
"https://your-tenant.craterinvoice.com/api/v2/tax-types" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"tax type 1\",
\"percent\": \"5\",
\"description\": \"5% of the tax will be imposed on the total amount.\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/tax-types"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "tax type 1",
"percent": "5",
"description": "5% of the tax will be imposed on the total amount."
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://your-tenant.craterinvoice.com/api/v2/tax-types',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'tax type 1',
'percent' => '5',
'description' => '5% of the tax will be imposed on the total amount.',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 130,
"name": "ut",
"percent": 87,
"type": null,
"description": "Quo beatae possimus labore nulla. Odio architecto ipsam mollitia minus sequi. Laborum molestiae ut vel magni placeat consequatur veritatis.",
"business_id": 1
},
{
"id": 131,
"name": "iste",
"percent": 73,
"type": null,
"description": "Officia dicta atque cum aperiam quia minus. In quo sint impedit omnis expedita quaerat.",
"business_id": 1
}
]
}
Received response:
Request failed with error:
Retrieve a tax type
requires authentication
Retrieves a Tax type object
Example request:
curl --request GET \
--get "https://your-tenant.craterinvoice.com/api/v2/tax-types/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/tax-types/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://your-tenant.craterinvoice.com/api/v2/tax-types/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 132,
"name": "est",
"percent": 87,
"type": null,
"description": "Impedit recusandae nemo qui facilis et consequuntur. Vero numquam dolor consequatur perferendis magnam quos. Officia odit fugiat sapiente quam non.",
"business_id": 1
},
{
"id": 133,
"name": "minima",
"percent": 94,
"type": null,
"description": "Ea iusto magnam qui enim animi. Animi magni itaque sequi porro accusamus. Non nobis sit quasi inventore excepturi iusto et. A molestias fugiat est fugiat repellat aut architecto et.",
"business_id": 1
}
]
}
Received response:
Request failed with error:
Update a tax type
requires authentication
Example request:
curl --request PUT \
"https://your-tenant.craterinvoice.com/api/v2/tax-types/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1" \
--data "{
\"name\": \"tax type 1\",
\"percent\": \"5\",
\"description\": \"5% of the tax will be imposed on the total amount.\"
}"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/tax-types/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
let body = {
"name": "tax type 1",
"percent": "5",
"description": "5% of the tax will be imposed on the total amount."
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://your-tenant.craterinvoice.com/api/v2/tax-types/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
'json' => [
'name' => 'tax type 1',
'percent' => '5',
'description' => '5% of the tax will be imposed on the total amount.',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Delete a tax type
requires authentication
Delete a tax type
Example request:
curl --request DELETE \
"https://your-tenant.craterinvoice.com/api/v2/tax-types/1" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "business: 1"
const url = new URL(
"https://your-tenant.craterinvoice.com/api/v2/tax-types/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
"business": "1",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://your-tenant.craterinvoice.com/api/v2/tax-types/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'business' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error: