MENU navbar-image

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"
}
 

Request   

POST oauth/token

Body Parameters

grant_type  string  

client_credentials

client_id  string  

client_credentials

client_secret  string  

client_secret

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
        }
    ]
}
 

Request   

GET api/v2/businesses

Query Parameters

limit  integer optional  

A limit on the number of businesses to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

name  string optional  

Filter records by name

business_type  string optional  

Filter records by business_type

email  string optional  

Filter records by email

phone  string optional  

Filter records by phone

contact_first_name  string optional  

Filter records by contact_first_name

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));

Request   

POST api/v2/businesses

Body Parameters

name  string  

contact_first_name  string  

contact_last_name  string  

business_type  string  

business_structure  string optional  

email  string  

address  object optional  

address.state  string optional  

address.city  string optional  

address.address_street_1  string optional  

address.address_street_2  string optional  

address.zip  string optional  

address.phone  string optional  

address.website  string optional  

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
    }
}
 

Request   

GET api/v2/businesses/{id}

URL Parameters

id  integer  

The ID of the business.

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));

Request   

PUT api/v2/businesses/{id}

PATCH api/v2/businesses/{id}

URL Parameters

id  integer  

The ID of the business.

Body Parameters

name  string  

contact_first_name  string  

contact_last_name  string  

business_type  string  

business_structure  string optional  

email  string  

address  object optional  

address.state  string optional  

address.city  string optional  

address.address_street_1  string optional  

address.address_street_2  string optional  

address.zip  string optional  

address.phone  string optional  

address.website  string optional  

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));

Request   

DELETE api/v2/businesses/{id}

URL Parameters

id  integer  

The ID of the business.

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
    }
}
 

Request   

GET api/v2/business

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));

Request   

PUT api/v2/business

Body Parameters

name  string  

contact_first_name  string  

contact_last_name  string  

business_type  string  

business_structure  string optional  

email  string  

address  object optional  

address.state  string optional  

address.city  string optional  

address.address_street_1  string optional  

address.address_street_2  string optional  

address.zip  string optional  

address.phone  string optional  

address.website  string optional  

requires authentication

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"
}
 

Request   

GET api/v2/business/settings

Body Parameters

settings  string[]  

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));

Request   

POST api/v2/business/settings

Body Parameters

invoice_business_address_format  string optional  

Business address format on Invoice PDF.

invoice_shipping_address_format  string optional  

Customer shipping address format on Invoice PDF.

invoice_billing_address_format  string optional  

Customer billing address format on Invoice PDF.

estimate_business_address_format  string optional  

Business address format on Estimate PDF.

estimate_shipping_address_format  string optional  

Customer shipping address format on Estimate PDF.

estimate_billing_address_format  string optional  

Customer billing address format on Estimate PDF.

payment_business_address_format  string optional  

Business address format on Payment Receipt PDF.

payment_from_customer_address_format  string optional  

Customer address format on Payment Receipt PDF.

tax_per_item_enabled  string optional  

Specify whether tax_per_item is enabled on this business?. Must be one of YES or NO.

discount_per_item_enabled  string optional  

Specify whether discount_per_item is enabled on this business?. Must be one of YES or NO.

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
        }
    ]
}
 

Request   

GET api/v2/customers

Query Parameters

limit  integer optional  

A limit on the number of customers to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

name  string optional  

Filter records by name

email  string optional  

Filter records by email

phone  string optional  

Filter records by phone

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));

Request   

POST api/v2/customers

Body Parameters

name  string  

Name of customer.

email  string optional  

Email of customer. Must be a valid email address.

phone  string optional  

Phone number of customer.

contact_first_name  string optional  

XYZ Corporation.

contact_last_name  string optional  

Customers contact name.

website  string optional  

Website of customer.

billing  object optional  

billing.name  string optional  

Billing address name.

billing.address_street_1  string optional  

Billing address street-1.

billing.address_street_2  string optional  

Billing address street-2.

billing.city  string optional  

Billing address city.

billing.state  string optional  

Billing address state.

billing.country_id  string optional  

Billing address country ID.

billing.zip  string optional  

Billing address zip code.

billing.phone  string optional  

Billing address phone.

shipping  object optional  

shipping.name  string optional  

Shipping address name.

shipping.address_street_1  string optional  

Shipping address street-1.

shipping.address_street_2  string optional  

Shipping address street-2.

shipping.city  string optional  

Shipping address city.

shipping.state  string optional  

Shipping address state.

shipping.country_id  string optional  

Shipping address country ID.

shipping.zip  string optional  

Shipping address zip code.

shipping.phone  string optional  

Shipping address phone.

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
    }
}
 

Request   

GET api/v2/customers/{id}

URL Parameters

id  integer  

The ID of the customer.

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));

Request   

PUT api/v2/customers/{id}

PATCH api/v2/customers/{id}

URL Parameters

id  integer  

The ID of the customer.

Body Parameters

name  string  

Name of customer.

email  string optional  

Email of customer. Must be a valid email address.

phone  string optional  

Phone number of customer.

contact_first_name  string optional  

XYZ Corporation.

contact_last_name  string optional  

Customers contact name.

website  string optional  

Website of customer.

billing  object optional  

billing.name  string optional  

Billing address name.

billing.address_street_1  string optional  

Billing address street-1.

billing.address_street_2  string optional  

Billing address street-2.

billing.city  string optional  

Billing address city.

billing.state  string optional  

Billing address state.

billing.country_id  string optional  

Billing address country ID.

billing.zip  string optional  

Billing address zip code.

billing.phone  string optional  

Billing address phone.

shipping  object optional  

shipping.name  string optional  

Shipping address name.

shipping.address_street_1  string optional  

Shipping address street-1.

shipping.address_street_2  string optional  

Shipping address street-2.

shipping.city  string optional  

Shipping address city.

shipping.state  string optional  

Shipping address state.

shipping.country_id  string optional  

Shipping address country ID.

shipping.zip  string optional  

Shipping address zip code.

shipping.phone  string optional  

Shipping address phone.

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));

Request   

DELETE api/v2/customers/{id}

URL Parameters

id  integer  

The ID of the customer.

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));

Request   

POST api/v2/estimates/{estimate_id}/send-email

URL Parameters

estimate_id  integer  

The ID of the estimate.

Body Parameters

subject  string  

body  string  

reply_to  string  

to  string  

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));

Request   

POST api/v2/estimates/{estimate_id}/accept

URL Parameters

estimate_id  integer  

The ID of the estimate.

Body Parameters

status  string  

Must be one of ACCEPTED.

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));

Request   

POST api/v2/estimates/{estimate_id}/reject

URL Parameters

estimate_id  integer  

The ID of the estimate.

Body Parameters

status  string  

Must be one of REJECTED.

reason  string  

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));

Request   

POST api/v2/estimates/{estimate_id}/convert-to-invoice

URL Parameters

estimate_id  integer  

The ID of the estimate.

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));

Request   

POST api/v2/estimates/{estimate_id}/attachments

URL Parameters

estimate_id  integer  

The ID of the estimate.

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"
}
 

Request   

GET api/v2/estimates/templates

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
        }
    ]
}
 

Request   

GET api/v2/estimates

Query Parameters

limit  integer optional  

A limit on the number of estimates to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

status  string optional  

Filter records by status.

customer_id  string optional  

Filter records by customer_id.

estimate_number  integer optional  

Filter records by estimate_number

from_date  string optional  

Filter records by from_date.

to_date  string optional  

Filter records by to_date.

incoming  boolean optional  

By default, this endpoint returns a list of outgoing estimate, but you can also fetch incoming estimates of a business using this param.

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
        }
    ]
}
 

Request   

POST api/v2/estimates

Body Parameters

estimate_date  string  

Date of the estimate.

expiry_date  string optional  

Due Date.

customer_id  string optional  

Customer ID.

customer_name  string optional  

tax_type_ids  string optional  

estimate_number  string  

Estimate Number.

discount_type  string optional  

Type of discount: fixed or percentage.

discount  string optional  

Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

deposit  string optional  

deductible  string optional  

discount_val  string optional  

Total discount amount in cents.

notes  string optional  

tax  string  

Total tax on the estimate in cents.

template_name  string  

Name of the template to be used for the Estimate PDF.

items  object[] optional  

items[].name  string  

Name of Item.

items[].quantity  string  

Item Quantity.

items[].price  string  

Item Price.

items[].description  string optional  

Item Description.

items[].item_id  string optional  

Item ID.

items[].unit_name  string optional  

Item Unit Name.

items[].discount  string optional  

Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

items[].discount_type  string optional  

Type of discount: fixed or percentage.

items[].discount_val  string optional  

Total discount amount in cents.

attachments  file[] optional  

Must be a file. Must not be greater than 10240 kilobytes.

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
    }
}
 

Request   

GET api/v2/estimates/{id}

URL Parameters

id  integer  

The ID of the estimate.

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));

Request   

PUT api/v2/estimates/{id}

PATCH api/v2/estimates/{id}

URL Parameters

id  integer  

The ID of the estimate.

Body Parameters

estimate_date  string  

Date of the estimate.

expiry_date  string optional  

Due Date.

customer_id  string optional  

Customer ID.

customer_name  string optional  

tax_type_ids  string optional  

estimate_number  string  

Estimate Number.

discount_type  string optional  

Type of discount: fixed or percentage.

discount  string optional  

Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

deposit  string optional  

deductible  string optional  

discount_val  string optional  

Total discount amount in cents.

notes  string optional  

tax  string  

Total tax on the estimate in cents.

template_name  string  

Name of the template to be used for the Estimate PDF.

items  object[] optional  

items[].name  string  

Name of Item.

items[].quantity  string  

Item Quantity.

items[].price  string  

Item Price.

items[].description  string optional  

Item Description.

items[].item_id  string optional  

Item ID.

items[].unit_name  string optional  

Item Unit Name.

items[].discount  string optional  

Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

items[].discount_type  string optional  

Type of discount: fixed or percentage.

items[].discount_val  string optional  

Total discount amount in cents.

attachments  file[] optional  

Must be a file. Must not be greater than 10240 kilobytes.

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));

Request   

DELETE api/v2/estimates/{id}

URL Parameters

id  integer  

The ID of the estimate.

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));

Request   

POST api/v2/invoices/{invoice_id}/send-email

URL Parameters

invoice_id  integer  

The ID of the invoice.

Body Parameters

body  string  

subject  string  

reply_to  string  

to  string  

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));

Request   

POST api/v2/invoices/{invoice_id}/clone

URL Parameters

invoice_id  integer  

The ID of the invoice.

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));

Request   

POST api/v2/invoices/{invoice_id}/approve-incoming

URL Parameters

invoice_id  integer  

The ID of the invoice.

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));

Request   

POST api/v2/invoices/{invoice_id}/reject-incoming

URL Parameters

invoice_id  integer  

The ID of the invoice.

Body Parameters

reason  string  

Reason for rejecting the invoice.

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));

Request   

POST api/v2/invoices/{invoice_id}/attachments

URL Parameters

invoice_id  integer  

The ID of the invoice.

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"
}
 

Request   

GET api/v2/invoices/templates

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"
        }
    ]
}
 

Request   

GET api/v2/invoices

Query Parameters

limit  integer optional  

A limit on the number of invoices to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

status  string optional  

Filter records by status

customer_id  string optional  

Filter records by customer_id

invoice_number  integer optional  

Filter records by invoice_number

from_date  string optional  

Filter records by from_date

to_date  string optional  

Filter records by to_date

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"
        }
    ]
}
 

Request   

POST api/v2/invoices

Body Parameters

invoice_number  string  

Invoice Number.

invoice_date  string  

Date of the invoice.

due_date  string optional  

Due Date.

customer_id  string  

Customer ID.

sub_total  string  

Subtotal amount of the invoice in cents.

discount_type  string optional  

Type of discount: fixed or percentage.

tax_type_ids  string optional  

discount  string optional  

Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

discount_val  string optional  

Total discount amount in cents.

notes  string optional  

template_name  string  

Name of the template to be used for the Invoice PDF.

items  object[] optional  

items[].name  string  

Name of Item.

items[].quantity  string  

Item Quantity.

items[].price  string  

Item Price.

items[].description  string optional  

Item Description.

items[].item_id  string optional  

Item ID.

items[].sub_total  string optional  

Item Sub Total Amount in Cents.

items[].total  string optional  

Item Total Amount in Cents.

items[].unit_name  string optional  

Item Unit Name.

items[].discount  string optional  

Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

items[].discount_type  string optional  

Type of discount: fixed or percentage.

items[].discount_val  string optional  

Total discount amount in cents.

total  number optional  

Total amount of the invoice in cents. Must be at least 50. Must not be greater than 99999999.

attachments  file[] optional  

Must be a file. Must not be greater than 10240 kilobytes.

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"
    }
}
 

Request   

GET api/v2/invoices/{id}

URL Parameters

id  integer  

The ID of the invoice.

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));

Request   

PUT api/v2/invoices/{id}

PATCH api/v2/invoices/{id}

URL Parameters

id  integer  

The ID of the invoice.

Body Parameters

invoice_number  string  

Invoice Number.

invoice_date  string  

Date of the invoice.

due_date  string optional  

Due Date.

customer_id  string  

Customer ID.

sub_total  string  

Subtotal amount of the invoice in cents.

discount_type  string optional  

Type of discount: fixed or percentage.

tax_type_ids  string optional  

discount  string optional  

Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

discount_val  string optional  

Total discount amount in cents.

notes  string optional  

template_name  string  

Name of the template to be used for the Invoice PDF.

items  object[] optional  

items[].name  string  

Name of Item.

items[].quantity  string  

Item Quantity.

items[].price  string  

Item Price.

items[].description  string optional  

Item Description.

items[].item_id  string optional  

Item ID.

items[].sub_total  string optional  

Item Sub Total Amount in Cents.

items[].total  string optional  

Item Total Amount in Cents.

items[].unit_name  string optional  

Item Unit Name.

items[].discount  string optional  

Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

items[].discount_type  string optional  

Type of discount: fixed or percentage.

items[].discount_val  string optional  

Total discount amount in cents.

total  number optional  

Total amount of the invoice in cents. Must be at least 50. Must not be greater than 99999999.

attachments  file[] optional  

Must be a file. Must not be greater than 10240 kilobytes.

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));

Request   

DELETE api/v2/invoices/{id}

URL Parameters

id  integer  

The ID of the invoice.

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));

Request   

POST api/v2/payments/{payment_id}/send-email

URL Parameters

payment_id  integer  

The ID of the payment.

Body Parameters

subject  string  

body  string  

reply_to  string  

to  string  

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"
        }
    ]
}
 

Request   

GET api/v2/payments

Query Parameters

limit  integer optional  

A limit on the number of payments to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

payment_number  integer optional  

Filter records by payment_number

customer_id  string optional  

Filter records by customer_id

payment_method_id  string optional  

Filter records by payment_method_id

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"
    }
}
 

Request   

GET api/v2/payments/{id}

URL Parameters

id  integer  

The ID of the payment.

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
        }
    ]
}
 

Request   

GET api/v2/items

Query Parameters

limit  integer optional  

A limit on the number of items to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

price  string optional  

Filter records by price

unit_id  string optional  

Filter records by unit_id

name  string optional  

Filter records by name

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));

Request   

POST api/v2/items

Body Parameters

name  string  

Name of the item.

price  integer  

unit_id  string optional  

ID of unit.

description  string optional  

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
    }
}
 

Request   

GET api/v2/items/{id}

URL Parameters

id  integer  

The ID of the item.

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));

Request   

PUT api/v2/items/{id}

PATCH api/v2/items/{id}

URL Parameters

id  integer  

The ID of the item.

Body Parameters

name  string  

Name of the item.

price  integer  

unit_id  string optional  

ID of unit.

description  string optional  

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));

Request   

DELETE api/v2/items/{id}

URL Parameters

id  integer  

The ID of the item.

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
        }
    ]
}
 

Request   

GET api/v2/item-units

Query Parameters

limit  integer optional  

A limit on the number of item units to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

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));

Request   

POST api/v2/item-units

Body Parameters

name  string  

Name of the unit.

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
    }
}
 

Request   

GET api/v2/item-units/{id}

URL Parameters

id  integer  

The ID of the item unit.

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));

Request   

PUT api/v2/item-units/{id}

PATCH api/v2/item-units/{id}

URL Parameters

id  integer  

The ID of the item unit.

Body Parameters

name  string  

Name of the unit.

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));

Request   

DELETE api/v2/item-units/{id}

URL Parameters

id  integer  

The ID of the item unit.

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
}
 

Request   

GET api/v2/next-number

URL Parameters

model  string  

invoice or estimate or payment.

model_id  integer  

ID of the invoice, estimate or payment.

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."
        }
    ]
}
 

Request   

GET api/v2/notes

Query Parameters

limit  integer optional  

A limit on the number of notes to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

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));

Request   

POST api/v2/notes

Body Parameters

name  string  

Name of the note.

type  string  

Type of the note. Must be one of Invoice, Estimate, or Payment.

notes  string  

Description for what you are writing this note for.

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."
    }
}
 

Request   

GET api/v2/notes/{id}

URL Parameters

id  integer  

The ID of the note.

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));

Request   

PUT api/v2/notes/{id}

PATCH api/v2/notes/{id}

URL Parameters

id  integer  

The ID of the note.

Body Parameters

name  string  

Name of the note.

type  string  

Type of the note. Must be one of Invoice, Estimate, or Payment.

notes  string  

Description for what you are writing this note for.

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));

Request   

DELETE api/v2/notes/{id}

URL Parameters

id  integer  

The ID of the note.

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
        }
    ]
}
 

Request   

GET api/v2/payments/methods

Query Parameters

limit  integer optional  

A limit on the number of payment methods to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

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
        }
    ]
}
 

Request   

GET api/v2/payments/methods/{id}

URL Parameters

id  integer  

The ID of the method.

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
        }
    ]
}
 

Request   

GET api/v2/tax-types

Query Parameters

limit  integer optional  

A limit on the number of tax types to be returned on a single page (use value: "all" if there's no limit).

page  integer optional  

Number of page (For Pagination).

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
        }
    ]
}
 

Request   

POST api/v2/tax-types

Body Parameters

name  string  

Name of the tax type.

percent  string  

percentage of tax.

description  string optional  

Description about the tax type.

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
        }
    ]
}
 

Request   

GET api/v2/tax-types/{id}

URL Parameters

id  integer  

The ID of the tax type.

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));

Request   

PUT api/v2/tax-types/{id}

PATCH api/v2/tax-types/{id}

URL Parameters

id  integer  

The ID of the tax type.

Body Parameters

name  string  

Name of the tax type.

percent  string  

percentage of tax.

description  string optional  

Description about the tax type.

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));

Request   

DELETE api/v2/tax-types/{id}

URL Parameters

id  integer  

The ID of the tax type.