MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Base URL

http://crater.test

Authenticating requests

This API is authenticated 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 api/v1/auth/login endpoint. Also because Crater supports multiple companies, you must pass the header "company" with value as the ID of the company you are requesting.

Admin / Authentication

API Endpoints for Admin Authentication / Token Management

Login

Crater uses API Tokens for authentication. The endpoint will return the plain-text API token which may then be stored and used to make additional API requests.

Internally, Crater uses Laravel Sanctum package for handling authentication. You can check this URL to know more: https://laravel.com/docs/8.x/sanctum#how-it-works-api-tokens

Example request:
curl --request POST \
    "http://crater.test/api/v1/auth/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"username\": \"johndoe@craterapp.com\",
    \"password\": \"password\",
    \"device_name\": \"mobile_app\"
}"
const url = new URL(
    "http://crater.test/api/v1/auth/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "username": "johndoe@craterapp.com",
    "password": "password",
    "device_name": "mobile_app"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/auth/login',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'username' => 'johndoe@craterapp.com',
            'password' => 'password',
            'device_name' => 'mobile_app',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/auth/login

Body Parameters

username  string  

Email ID of the user.

password  string  

Password of the user.

device_name  string  

Any Device name identifier.

Logout

requires authentication

This will invalidate the API Token so it cannot be used anymore.

Example request:
curl --request POST \
    "http://crater.test/api/v1/auth/logout" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/auth/logout"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/auth/logout',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/auth/logout

Token Validity Check

requires authentication

Check if the token is valid.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/auth/check" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/auth/check"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/auth/check',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
content-type: text/html; charset=UTF-8
cache-control: no-cache, private
x-ratelimit-limit: 180
x-ratelimit-remaining: 179
 

1
 

Request   

GET api/v1/auth/check

Admin / Backups

API Endpoints for managing file & database backups of your crater installation

List all backups

requires authentication

Returns a list of your backups.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/backups" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/backups"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/backups',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 169
 

{
    "backups": [],
    "disks": [
        "local"
    ]
}
 

Request   

GET api/v1/backups

Create a backup

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/backups" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/backups"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/backups',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/backups

Delete a backup

requires authentication

Permanently delete a backup from storage.

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/backups/neque" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"path\": \"atque\"
}"
const url = new URL(
    "http://crater.test/api/v1/backups/neque"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "path": "atque"
};

fetch(url, {
    method: "DELETE",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/backups/neque',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'path' => 'atque',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

DELETE api/v1/backups/{id}

URL Parameters

id  string  

The ID of the backup.

Body Parameters

path  string  

Admin / Companies

API Endpoints for managing companies

Retrieve a company

requires authentication

Retrieves a company object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/current-company" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/current-company"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/current-company',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 11,
        "name": "Jacynthe D'Amore IV",
        "logo": null,
        "logo_path": null,
        "unique_hash": "L1ByQV6WrzoK8eXEQsAg",
        "owner_id": 1,
        "slug": "atque"
    }
}
 

Request   

GET api/v1/current-company

Update a company

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/company" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"Crater Invoice\",
    \"slug\": \"crater-invoice\",
    \"address\": {
        \"country_id\": 231,
        \"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(
    "http://crater.test/api/v1/company"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "Crater Invoice",
    "slug": "crater-invoice",
    "address": {
        "country_id": 231,
        "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(
    'http://crater.test/api/v1/company',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'Crater Invoice',
            'slug' => 'crater-invoice',
            'address' => [
                'country_id' => 231,
                '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/v1/company

Body Parameters

name  string  

slug  string optional  

address  object optional  

address.country_id  integer  

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 company settings

requires authentication

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/company/settings" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"settings\": [
        \"currency\",
        \"language\"
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/company/settings"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "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(
    'http://crater.test/api/v1/company/settings',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'settings' => [
                'currency',
                'language',
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 162
 

{
    "currency": "12",
    "language": "en"
}
 

Request   

GET api/v1/company/settings

Body Parameters

settings  string[]  

Update company settings

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/company/settings" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"settings\": {
        \"discount_per_item\": \"YES\",
        \"automatically_expire_public_links\": \"NO\"
    }
}"
const url = new URL(
    "http://crater.test/api/v1/company/settings"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "settings": {
        "discount_per_item": "YES",
        "automatically_expire_public_links": "NO"
    }
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/company/settings',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'settings' => [
                'discount_per_item' => 'YES',
                'automatically_expire_public_links' => 'NO',
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/company/settings

Body Parameters

settings  string  

Array of setting keys.

Create a company

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/companies" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"Crater Invoice\",
    \"currency\": 1,
    \"address\": {
        \"country_id\": \"231\",
        \"address_street_1\": \"Address 1\",
        \"address_street_2\": \"Address 2\",
        \"city\": \"Los Angeles\",
        \"state\": \"California\",
        \"zip\": \"91504\",
        \"phone\": \"123-123-123\",
        \"website\": \"https:\\/\\/craterapp.com\"
    }
}"
const url = new URL(
    "http://crater.test/api/v1/companies"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "Crater Invoice",
    "currency": 1,
    "address": {
        "country_id": "231",
        "address_street_1": "Address 1",
        "address_street_2": "Address 2",
        "city": "Los Angeles",
        "state": "California",
        "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(
    'http://crater.test/api/v1/companies',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'Crater Invoice',
            'currency' => 1,
            'address' => [
                'country_id' => '231',
                'address_street_1' => 'Address 1',
                'address_street_2' => 'Address 2',
                'city' => 'Los Angeles',
                'state' => 'California',
                'zip' => '91504',
                'phone' => '123-123-123',
                'website' => 'https://craterapp.com',
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/companies

Body Parameters

name  string  

currency  string  

address  object optional  

address.country_id  string  

address.address_street_1  string optional  

address.address_street_2  string optional  

address.city  string optional  

address.state  string optional  

address.zip  string optional  

address.phone  string optional  

address.website  string optional  

Transfer company ownership

requires authentication

Transfer your ownership rights to another user of the company.

Example request:
curl --request POST \
    "http://crater.test/api/v1/transfer/ownership/vitae" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/transfer/ownership/vitae"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/transfer/ownership/vitae',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/transfer/ownership/{user}

URL Parameters

user  string  

ID of the user whom you wish to transfer your current company.

Delete a company

requires authentication

Permanently deletes a company and all of its data. Only an owner of the company is allowed to delete the company.

Example request:
curl --request POST \
    "http://crater.test/api/v1/companies/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"Crater Invoice\"
}"
const url = new URL(
    "http://crater.test/api/v1/companies/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "Crater Invoice"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/companies/delete',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'Crater Invoice',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/companies/delete

Body Parameters

name  required optional  

string Name of the company to match against the actual name of the company. (Required in order to confirm the deletion).

List all companies

requires authentication

Returns a list of your companies.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/companies" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/companies"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/companies',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 12,
            "name": "Donavon Simonis",
            "logo": null,
            "logo_path": null,
            "unique_hash": "BSprFCGmirClfjbcTQyB",
            "owner_id": 1,
            "slug": "nisi"
        },
        {
            "id": 13,
            "name": "Ransom Keeling",
            "logo": null,
            "logo_path": null,
            "unique_hash": "0yTui27m403YevMLrrnV",
            "owner_id": 1,
            "slug": "magnam"
        }
    ]
}
 

Request   

GET api/v1/companies

Admin / Currencies

API Endpoints for managing currencies and exchange rate providers

Get exchange rate of a given currency

requires authentication

This endpoint returns exchange rate for a given currency from a provider (if you have configured a provider) or returns the most recently used exchange rate.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/currencies/1/exchange-rate" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/currencies/1/exchange-rate"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/currencies/1/exchange-rate',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 166
 

{
    "error": "no_exchange_rate_available"
}
 

Request   

GET api/v1/currencies/{currency}/exchange-rate

URL Parameters

currency  integer  

Check if a given currency has a exchange rate provider configured.

requires authentication

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/currencies/1/active-provider" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/currencies/1/active-provider"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/currencies/1/active-provider',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 165
 

{
    "error": "no_active_provider"
}
 

Request   

GET api/v1/currencies/{currency}/active-provider

URL Parameters

currency  integer  

List all exchange rate providers

requires authentication

Returns a list of your configured exchange rate providers.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/exchange-rate-providers" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/exchange-rate-providers"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/exchange-rate-providers',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 10,
            "key": "yYoQHkRNeL",
            "driver": "qui",
            "currencies": null,
            "driver_config": null,
            "company_id": null,
            "active": false
        },
        {
            "id": 11,
            "key": "wNGpWFq1bh",
            "driver": "beatae",
            "currencies": null,
            "driver_config": null,
            "company_id": null,
            "active": true
        }
    ]
}
 

Request   

GET api/v1/exchange-rate-providers

Create an exchange rate provider

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/exchange-rate-providers" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"driver\": \"ipsum\",
    \"key\": \"quia\",
    \"currencies\": [
        null
    ],
    \"active\": false
}"
const url = new URL(
    "http://crater.test/api/v1/exchange-rate-providers"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "driver": "ipsum",
    "key": "quia",
    "currencies": [
        null
    ],
    "active": false
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/exchange-rate-providers',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'driver' => 'ipsum',
            'key' => 'quia',
            'currencies' => [
                null,
            ],
            'active' => false,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/exchange-rate-providers

Body Parameters

driver  string  

key  string  

currencies  string[] optional  

driver_config  string optional  

active  boolean optional  

Retrieve an exchange rate provider

requires authentication

Retrieves an Exchange Rate Provider object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/exchange-rate-providers/15" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/exchange-rate-providers/15"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/exchange-rate-providers/15',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 12,
        "key": "oM9RkH029x",
        "driver": "ducimus",
        "currencies": null,
        "driver_config": null,
        "company_id": null,
        "active": true
    }
}
 

Request   

GET api/v1/exchange-rate-providers/{id}

URL Parameters

id  integer  

The ID of the exchange rate provider.

Update an exchange rate provider

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/exchange-rate-providers/20" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"driver\": \"vel\",
    \"key\": \"officiis\",
    \"currencies\": [
        null
    ],
    \"active\": true
}"
const url = new URL(
    "http://crater.test/api/v1/exchange-rate-providers/20"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "driver": "vel",
    "key": "officiis",
    "currencies": [
        null
    ],
    "active": true
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/exchange-rate-providers/20',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'driver' => 'vel',
            'key' => 'officiis',
            'currencies' => [
                null,
            ],
            'active' => true,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/exchange-rate-providers/{id}

PATCH api/v1/exchange-rate-providers/{id}

URL Parameters

id  integer  

The ID of the exchange rate provider.

Body Parameters

driver  string  

key  string  

currencies  string[] optional  

driver_config  string optional  

active  boolean optional  

Delete an exchange rate provider

requires authentication

Permanently delete an exchange rate provider. Note: You cannot delete an active exchange rate provider.

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/exchange-rate-providers/17" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/exchange-rate-providers/17"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/exchange-rate-providers/17',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

DELETE api/v1/exchange-rate-providers/{id}

URL Parameters

id  integer  

The ID of the exchange rate provider.

Admin / Custom Fields

API Endpoints for managing custom fields

List all custom fields

requires authentication

Returns a list of your custom fields.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/custom-fields" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/custom-fields"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/custom-fields',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 10,
            "name": "Eva Crooks",
            "slug": "CUSTOM_INVOICE_PROF_ORAL_BARTOLETTI_SR",
            "label": "Prof. Oral Bartoletti Sr.",
            "model_type": "Invoice",
            "type": "DateTime",
            "placeholder": null,
            "options": null,
            "boolean_answer": null,
            "date_answer": null,
            "time_answer": null,
            "string_answer": null,
            "number_answer": null,
            "date_time_answer": null,
            "is_required": true,
            "in_use": false,
            "order": 9,
            "company_id": 1,
            "default_answer": null
        },
        {
            "id": 11,
            "name": "Rafaela Rolfson",
            "slug": "CUSTOM_EXPENSE_DOUG_SMITHAM",
            "label": "Doug Smitham",
            "model_type": "Expense",
            "type": "Dropdown",
            "placeholder": null,
            "options": null,
            "boolean_answer": null,
            "date_answer": null,
            "time_answer": null,
            "string_answer": null,
            "number_answer": null,
            "date_time_answer": null,
            "is_required": true,
            "in_use": false,
            "order": 9,
            "company_id": 1,
            "default_answer": null
        }
    ]
}
 

Request   

GET api/v1/custom-fields

Create a custom field

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/custom-fields" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"GST\",
    \"label\": \"GST\",
    \"model_type\": \"Customer\",
    \"order\": 1,
    \"type\": \"Input\",
    \"is_required\": false,
    \"options\": [
        \"Option 1\",
        \"Option 2\"
    ],
    \"placeholder\": \"Enter GST\"
}"
const url = new URL(
    "http://crater.test/api/v1/custom-fields"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "GST",
    "label": "GST",
    "model_type": "Customer",
    "order": 1,
    "type": "Input",
    "is_required": false,
    "options": [
        "Option 1",
        "Option 2"
    ],
    "placeholder": "Enter GST"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/custom-fields',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'GST',
            'label' => 'GST',
            'model_type' => 'Customer',
            'order' => 1,
            'type' => 'Input',
            'is_required' => false,
            'options' => [
                'Option 1',
                'Option 2',
            ],
            'placeholder' => 'Enter GST',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/custom-fields

Body Parameters

name  string  

Name of the field to identify the field.

label  string  

Label of the field which will be displayed on the UI.

model_type  string  

Supports following values: Customer, Invoice, Estimate, Payment or Expense.

order  string  

Numeric Order of the input on the Interface.

type  string  

Input Type for the field. It Supports following values: Input, TextArea, Phone, Url, Number, Dropdown, Switch, Date, Time or DateTime.

is_required  boolean  

Specify whether the field is required or optional.

options  string[] optional  

This is only required for Dropdown type. Supports a string of options for the Select Input.

placeholder  string optional  

Placeholder for the input.

Retrieve a custom field

requires authentication

Retrieves a Custom Field object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/custom-fields/2" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/custom-fields/2"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/custom-fields/2',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 12,
        "name": "Miss Amalia Gutkowski I",
        "slug": "CUSTOM_CUSTOMER_DR_LAWRENCE_FEENEY_DVM",
        "label": "Dr. Lawrence Feeney DVM",
        "model_type": "Customer",
        "type": "Phone",
        "placeholder": null,
        "options": null,
        "boolean_answer": null,
        "date_answer": null,
        "time_answer": null,
        "string_answer": null,
        "number_answer": null,
        "date_time_answer": null,
        "is_required": true,
        "in_use": false,
        "order": 7,
        "company_id": 1,
        "default_answer": null
    }
}
 

Request   

GET api/v1/custom-fields/{id}

URL Parameters

id  integer  

The ID of the custom field.

Update a custom field

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/custom-fields/15" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"GST\",
    \"label\": \"GST\",
    \"model_type\": \"Customer\",
    \"order\": 1,
    \"type\": \"Input\",
    \"is_required\": false,
    \"options\": [
        \"Option 1\",
        \"Option 2\"
    ],
    \"placeholder\": \"Enter GST\"
}"
const url = new URL(
    "http://crater.test/api/v1/custom-fields/15"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "GST",
    "label": "GST",
    "model_type": "Customer",
    "order": 1,
    "type": "Input",
    "is_required": false,
    "options": [
        "Option 1",
        "Option 2"
    ],
    "placeholder": "Enter GST"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/custom-fields/15',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'GST',
            'label' => 'GST',
            'model_type' => 'Customer',
            'order' => 1,
            'type' => 'Input',
            'is_required' => false,
            'options' => [
                'Option 1',
                'Option 2',
            ],
            'placeholder' => 'Enter GST',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/custom-fields/{id}

PATCH api/v1/custom-fields/{id}

URL Parameters

id  integer  

The ID of the custom field.

Body Parameters

name  string  

Name of the field to identify the field.

label  string  

Label of the field which will be displayed on the UI.

model_type  string  

Supports following values: Customer, Invoice, Estimate, Payment or Expense.

order  string  

Numeric Order of the input on the Interface.

type  string  

Input Type for the field. It Supports following values: Input, TextArea, Phone, Url, Number, Dropdown, Switch, Date, Time or DateTime.

is_required  boolean  

Specify whether the field is required or optional.

options  string[] optional  

This is only required for Dropdown type. Supports a string of options for the Select Input.

placeholder  string optional  

Placeholder for the input.

Delete a custom field

requires authentication

Permanently delete a custom field. Please note, that if you delete a custom field, all of it's existing values for any transactions like Invoice, Estimate, etc will be deleted too.

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/custom-fields/3" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/custom-fields/3"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/custom-fields/3',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

DELETE api/v1/custom-fields/{id}

URL Parameters

id  integer  

The ID of the custom field.

Admin / Customer

Customer Stats

requires authentication

Endpoint may be used to fetch the stats for a given customer.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/customers/5/stats" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/customers/5/stats"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/customers/5/stats',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
 "data":
  {
      "name": [],
      "contact_name": "",
      "company_name": "",
      "website": "",
      ...
  },
  "meta" : {
      "months": [],
      "invoiceTotals": 1,
      "expenseTotals": 1,
      "receiptTotals": 1,
      "netProfit": 1,
      "netProfits": 1,
      "salesTotal": 1,
      "totalReceipts": 1,
      "totalExpenses": 1,
  }
}
 

Request   

GET api/v1/customers/{customer}/stats

URL Parameters

customer  integer  

Dashboard Stats

requires authentication

Dashboard Endpoint may be used to fetch the data required on the Dashboard.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/dashboard" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/dashboard"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/dashboard',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
 "data": [
  {
      "due_amount": 1,
      "invoice_count":1,
      "estimate_count": 1,
      "payment_count": 1,
      "recentInvoices": [],
      "recentEstimates": [],
  },
 ]
}
 

Request   

GET api/v1/{company_slug}/customer/dashboard

URL Parameters

company_slug  string optional  

Company Slug.

Admin / Customers

API Endpoints for managing customers

Delete customers

requires authentication

Delete a list of Customers along side all of their resources (ie. Estimates, Invoices, Payments and Addresses)

Example request:
curl --request POST \
    "http://crater.test/api/v1/customers/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"ids\": [
        1,
        2
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/customers/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "ids": [
        1,
        2
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/customers/delete',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'ids' => [
                1,
                2,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/customers/delete

Body Parameters

ids  string[]  

List all customers

requires authentication

Returns a list of your customers.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/customers?limit=5&page=15&display_name=provident&contact_name=exercitationem&phone=atque" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/customers"
);

const params = {
    "limit": "5",
    "page": "15",
    "display_name": "provident",
    "contact_name": "exercitationem",
    "phone": "atque",
};
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",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/customers',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'query' => [
            'limit'=> '5',
            'page'=> '15',
            'display_name'=> 'provident',
            'contact_name'=> 'exercitationem',
            'phone'=> 'atque',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 109,
            "name": "Jacey Legros",
            "email": "daugherty.junior@example.org",
            "phone": "1-778-598-6170 x774",
            "contact_name": "Prof. Haylie Jakubowski V",
            "company_name": "Jerde-Bartoletti",
            "website": "http://schaden.com/commodi-sed-eum-quis",
            "enable_portal": true,
            "password_added": true,
            "currency_id": 1,
            "company_id": null,
            "facebook_id": null,
            "google_id": null,
            "github_id": null,
            "created_at": "2022-03-14T09:35:42.000000Z",
            "formatted_created_at": "2022/03/14",
            "updated_at": "2022-03-14T09:35:42.000000Z",
            "avatar": 0,
            "due_amount": null,
            "base_due_amount": null,
            "prefix": 3
        },
        {
            "id": 110,
            "name": "Anika Carter",
            "email": "willy.toy@example.org",
            "phone": "+1-376-532-2307",
            "contact_name": "Ressie Howell",
            "company_name": "Marks-Wilkinson",
            "website": "http://schiller.com/",
            "enable_portal": true,
            "password_added": true,
            "currency_id": 1,
            "company_id": null,
            "facebook_id": null,
            "google_id": null,
            "github_id": null,
            "created_at": "2022-03-14T09:35:42.000000Z",
            "formatted_created_at": "2022/03/14",
            "updated_at": "2022-03-14T09:35:42.000000Z",
            "avatar": 0,
            "due_amount": null,
            "base_due_amount": null,
            "prefix": 8
        }
    ]
}
 

Request   

GET api/v1/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).

display_name  string optional  

Filter records by display_name

contact_name  string optional  

Filter records by contact_name

phone  string optional  

Filter records by phone

Create a customer

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/customers" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"aut\",
    \"email\": \"jenkins.shanelle@example.org\",
    \"enable_portal\": true,
    \"billing\": [],
    \"shipping\": []
}"
const url = new URL(
    "http://crater.test/api/v1/customers"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "aut",
    "email": "jenkins.shanelle@example.org",
    "enable_portal": true,
    "billing": [],
    "shipping": []
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/customers',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'aut',
            'email' => 'jenkins.shanelle@example.org',
            'enable_portal' => true,
            'billing' => [],
            'shipping' => [],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/customers

Body Parameters

name  string  

email  string optional  

Must be a valid email address.

password  string optional  

phone  string optional  

company_name  string optional  

contact_name  string optional  

website  string optional  

prefix  string optional  

enable_portal  boolean optional  

currency_id  string optional  

billing  object optional  

billing.name  string optional  

billing.address_street_1  string optional  

billing.address_street_2  string optional  

billing.city  string optional  

billing.state  string optional  

billing.country_id  string optional  

billing.zip  string optional  

billing.phone  string optional  

shipping  object optional  

shipping.name  string optional  

shipping.address_street_1  string optional  

shipping.address_street_2  string optional  

shipping.city  string optional  

shipping.state  string optional  

shipping.country_id  string optional  

shipping.zip  string optional  

shipping.phone  string optional  

Retrieve a customer

requires authentication

Retrieves a Customer object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/customers/13" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/customers/13"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/customers/13',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 111,
        "name": "Ms. Stacey Doyle III",
        "email": "carolyn77@example.com",
        "phone": "890.553.6805 x032",
        "contact_name": "Carlo Grady",
        "company_name": "Schinner, Gibson and Hane",
        "website": "https://baumbach.com/eum-alias-non-dolorum-libero-architecto-nam-enim.html",
        "enable_portal": true,
        "password_added": true,
        "currency_id": 1,
        "company_id": null,
        "facebook_id": null,
        "google_id": null,
        "github_id": null,
        "created_at": "2022-03-14T09:35:42.000000Z",
        "formatted_created_at": "2022/03/14",
        "updated_at": "2022-03-14T09:35:42.000000Z",
        "avatar": 0,
        "due_amount": null,
        "base_due_amount": null,
        "prefix": 7
    }
}
 

Request   

GET api/v1/customers/{id}

URL Parameters

id  integer  

The ID of the customer.

Update a customer

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/customers/14" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"vel\",
    \"email\": \"obauch@example.org\",
    \"enable_portal\": true,
    \"billing\": [],
    \"shipping\": []
}"
const url = new URL(
    "http://crater.test/api/v1/customers/14"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "vel",
    "email": "obauch@example.org",
    "enable_portal": true,
    "billing": [],
    "shipping": []
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/customers/14',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'vel',
            'email' => 'obauch@example.org',
            'enable_portal' => true,
            'billing' => [],
            'shipping' => [],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/customers/{id}

PATCH api/v1/customers/{id}

URL Parameters

id  integer  

The ID of the customer.

Body Parameters

name  string  

email  string optional  

Must be a valid email address.

password  string optional  

phone  string optional  

company_name  string optional  

contact_name  string optional  

website  string optional  

prefix  string optional  

enable_portal  boolean optional  

currency_id  string optional  

billing  object optional  

billing.name  string optional  

billing.address_street_1  string optional  

billing.address_street_2  string optional  

billing.city  string optional  

billing.state  string optional  

billing.country_id  string optional  

billing.zip  string optional  

billing.phone  string optional  

shipping  object optional  

shipping.name  string optional  

shipping.address_street_1  string optional  

shipping.address_street_2  string optional  

shipping.city  string optional  

shipping.state  string optional  

shipping.country_id  string optional  

shipping.zip  string optional  

shipping.phone  string optional  

Admin / Estimates

API Endpoints for managing estimates

Preview an estimate email

requires authentication

Returns html view for previewing an estimate email before sending it to customer.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/estimates/16/send/preview" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"subject\": \"expedita\",
    \"body\": \"consequuntur\",
    \"from\": \"ut\",
    \"to\": \"dolor\"
}"
const url = new URL(
    "http://crater.test/api/v1/estimates/16/send/preview"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "subject": "expedita",
    "body": "consequuntur",
    "from": "ut",
    "to": "dolor"
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/estimates/16/send/preview',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'subject' => 'expedita',
            'body' => 'consequuntur',
            'from' => 'ut',
            'to' => 'dolor',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 172
 

{
    "message": "No query results for model [Crater\\Models\\Estimate] 16"
}
 

Request   

GET api/v1/estimates/{estimate}/send/preview

URL Parameters

estimate  integer  

Body Parameters

subject  string  

body  string  

from  string  

to  string  

Send an estimate

requires authentication

Mail a specific estimate to the corresponding customer's email address.

Example request:
curl --request POST \
    "http://crater.test/api/v1/estimates/20/send" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"subject\": \"qui\",
    \"body\": \"ut\",
    \"from\": \"sequi\",
    \"to\": \"laborum\"
}"
const url = new URL(
    "http://crater.test/api/v1/estimates/20/send"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "subject": "qui",
    "body": "ut",
    "from": "sequi",
    "to": "laborum"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/estimates/20/send',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'subject' => 'qui',
            'body' => 'ut',
            'from' => 'sequi',
            'to' => 'laborum',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/estimates/{estimate}/send

URL Parameters

estimate  integer  

Body Parameters

subject  string  

body  string  

from  string  

to  string  

Update status of an estimate

requires authentication

This endpoint is mainly used to mark an estimate as sent, accepted or completed etc

Example request:
curl --request POST \
    "http://crater.test/api/v1/estimates/17/status?status=iure" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/estimates/17/status"
);

const params = {
    "status": "iure",
};
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",
    "company": "1",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/estimates/17/status',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'query' => [
            'status'=> 'iure',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/estimates/{estimate}/status

URL Parameters

estimate  integer  

Query Parameters

status  string optional  

Status of the estimate. Accepts values: DRAFT, SENT, VIEWED, EXPIRED, ACCEPTED, REJECTED

Convert an estimate into invoice.

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/estimates/8/convert-to-invoice" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/estimates/8/convert-to-invoice"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/estimates/8/convert-to-invoice',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/estimates/{estimate}/convert-to-invoice

URL Parameters

estimate  integer  

List all estimate templates

requires authentication

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/estimates/templates" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/estimates/templates"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/estimates/templates',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 171
 

{
    "estimateTemplates": [
        {
            "name": "estimate1",
            "path": "http://crater.test/build//img/PDF/estimate1.png"
        },
        {
            "name": "estimate2",
            "path": "http://crater.test/build//img/PDF/estimate2.png"
        },
        {
            "name": "estimate3",
            "path": "http://crater.test/build//img/PDF/estimate3.png"
        }
    ]
}
 

Request   

GET api/v1/estimates/templates

Delete estimates

requires authentication

Delete a list of estimates

Example request:
curl --request POST \
    "http://crater.test/api/v1/estimates/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"ids\": [
        1,
        2
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/estimates/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "ids": [
        1,
        2
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/estimates/delete',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'ids' => [
                1,
                2,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/estimates/delete

Body Parameters

ids  string[]  

List all estimates

requires authentication

Returns a list of your estimates.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/estimates" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/estimates"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/estimates',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 19,
            "estimate_date": "1998-03-24T18:30:00.000000Z",
            "expiry_date": "1998-09-22T18:30:00.000000Z",
            "estimate_number": "EST-000001",
            "status": "DRAFT",
            "reference_number": "EST-000001",
            "tax_per_item": "YES",
            "discount_per_item": "No",
            "notes": "Quis recusandae ut maxime nesciunt repellat.",
            "discount": 2,
            "discount_type": "fixed",
            "discount_val": 2,
            "sub_total": 9,
            "total": 7,
            "tax": 1,
            "unique_hash": "whVh5HZYHrPqVstI6jZhJw3vkhbD2LZlIi9eASDeciuHf02zIYlFBXicjHge",
            "creator_id": null,
            "template_name": "estimate1",
            "customer_id": 121,
            "exchange_rate": 6,
            "base_discount_val": 6,
            "base_sub_total": 7,
            "base_total": 2,
            "base_tax": 3,
            "sequence_number": 1,
            "currency_id": 1,
            "formatted_expiry_date": "1998/09/23",
            "formatted_estimate_date": "1998/03/25",
            "estimate_pdf_url": "http://crater.test/estimates/pdf/whVh5HZYHrPqVstI6jZhJw3vkhbD2LZlIi9eASDeciuHf02zIYlFBXicjHge",
            "sales_tax_type": null,
            "sales_tax_address_type": null
        },
        {
            "id": 20,
            "estimate_date": "1978-03-09T18:30:00.000000Z",
            "expiry_date": "1978-11-16T18:30:00.000000Z",
            "estimate_number": "EST-000002",
            "status": "DRAFT",
            "reference_number": "EST-000002",
            "tax_per_item": "YES",
            "discount_per_item": "No",
            "notes": "Fugiat omnis officia hic sunt est laudantium dolorem.",
            "discount": 9,
            "discount_type": "fixed",
            "discount_val": 9,
            "sub_total": 6,
            "total": 7,
            "tax": 7,
            "unique_hash": "OmYX1ywrxsDJ2AFYn6abcyGbJqUz6g683wANyVBLFzhVY9KXs3RO7di0wJv1",
            "creator_id": null,
            "template_name": "estimate1",
            "customer_id": 122,
            "exchange_rate": 1,
            "base_discount_val": 7,
            "base_sub_total": 9,
            "base_total": 3,
            "base_tax": 5,
            "sequence_number": 2,
            "currency_id": 1,
            "formatted_expiry_date": "1978/11/17",
            "formatted_estimate_date": "1978/03/10",
            "estimate_pdf_url": "http://crater.test/estimates/pdf/OmYX1ywrxsDJ2AFYn6abcyGbJqUz6g683wANyVBLFzhVY9KXs3RO7di0wJv1",
            "sales_tax_type": null,
            "sales_tax_address_type": null
        }
    ]
}
 

Request   

GET api/v1/estimates

Create an estimate

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/estimates" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"estimate_date\": \"2022-02-13\",
    \"expiry_date\": \"2022-02-16\",
    \"customer_id\": 1,
    \"estimate_number\": \"EST-000001\",
    \"exchange_rate\": 1,
    \"discount_type\": \"fixed\",
    \"discount\": 50,
    \"discount_val\": 5000,
    \"sub_total\": 10000,
    \"total\": 5000,
    \"tax\": 0,
    \"template_name\": \"estimate1\",
    \"items\": [
        {
            \"name\": \"Apple Macbook\",
            \"quantity\": 1,
            \"price\": 10000,
            \"description\": \"Light and powerful laptop\",
            \"item_id\": 5,
            \"sub_total\": 10000,
            \"total\": 10000,
            \"unit_name\": \"box\",
            \"discount\": 0,
            \"discount_type\": \"fixed\",
            \"discount_val\": 0
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/estimates"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "estimate_date": "2022-02-13",
    "expiry_date": "2022-02-16",
    "customer_id": 1,
    "estimate_number": "EST-000001",
    "exchange_rate": 1,
    "discount_type": "fixed",
    "discount": 50,
    "discount_val": 5000,
    "sub_total": 10000,
    "total": 5000,
    "tax": 0,
    "template_name": "estimate1",
    "items": [
        {
            "name": "Apple Macbook",
            "quantity": 1,
            "price": 10000,
            "description": "Light and powerful laptop",
            "item_id": 5,
            "sub_total": 10000,
            "total": 10000,
            "unit_name": "box",
            "discount": 0,
            "discount_type": "fixed",
            "discount_val": 0
        }
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/estimates',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'estimate_date' => '2022-02-13',
            'expiry_date' => '2022-02-16',
            'customer_id' => 1,
            'estimate_number' => 'EST-000001',
            'exchange_rate' => 1,
            'discount_type' => 'fixed',
            'discount' => 50,
            'discount_val' => 5000,
            'sub_total' => 10000,
            'total' => 5000,
            'tax' => 0,
            'template_name' => 'estimate1',
            'items' => [
                [
                    'name' => 'Apple Macbook',
                    'quantity' => 1,
                    'price' => 10000,
                    'description' => 'Light and powerful laptop',
                    'item_id' => 5,
                    'sub_total' => 10000,
                    'total' => 10000,
                    'unit_name' => 'box',
                    'discount' => 0,
                    'discount_type' => 'fixed',
                    'discount_val' => 0,
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/estimates

Body Parameters

estimate_date  string  

Date of the estimate.

expiry_date  string optional  

Due Date.

customer_id  string  

Customer ID.

estimate_number  string  

Estimate Number.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

discount_type  string optional  

Type of discount: fixed or percentage.

discount  string  

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

discount_val  string  

Total discount amount in cents.

sub_total  string  

Subtotal amount of the estimate in cents.

total  string  

Total amount of the estimate 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[].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.

Retrieve an estimate

requires authentication

Retrieves an Estimate object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/estimates/4" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/estimates/4"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/estimates/4',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 21,
        "estimate_date": "1983-03-18T18:30:00.000000Z",
        "expiry_date": "2021-12-24T18:30:00.000000Z",
        "estimate_number": "EST-000001",
        "status": "DRAFT",
        "reference_number": "EST-000001",
        "tax_per_item": "YES",
        "discount_per_item": "No",
        "notes": "Maiores est neque qui.",
        "discount": 6.37,
        "discount_type": "percentage",
        "discount_val": 91,
        "sub_total": 6,
        "total": 7,
        "tax": 4,
        "unique_hash": "IY168rp87BZsL0UZvDNfpBnaud4baemxhNvbw4tKmq6wgGF6vE4MpXTUzjC6",
        "creator_id": null,
        "template_name": "estimate1",
        "customer_id": 123,
        "exchange_rate": 4,
        "base_discount_val": 6,
        "base_sub_total": 8,
        "base_total": 8,
        "base_tax": 5,
        "sequence_number": 1,
        "currency_id": 1,
        "formatted_expiry_date": "2021/12/25",
        "formatted_estimate_date": "1983/03/19",
        "estimate_pdf_url": "http://crater.test/estimates/pdf/IY168rp87BZsL0UZvDNfpBnaud4baemxhNvbw4tKmq6wgGF6vE4MpXTUzjC6",
        "sales_tax_type": null,
        "sales_tax_address_type": null
    }
}
 

Request   

GET api/v1/estimates/{id}

URL Parameters

id  integer  

The ID of the estimate.

Update an estimate

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/estimates/7" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"estimate_date\": \"2022-02-13\",
    \"expiry_date\": \"2022-02-16\",
    \"customer_id\": 1,
    \"estimate_number\": \"EST-000001\",
    \"exchange_rate\": 1,
    \"discount_type\": \"fixed\",
    \"discount\": 50,
    \"discount_val\": 5000,
    \"sub_total\": 10000,
    \"total\": 5000,
    \"tax\": 0,
    \"template_name\": \"estimate1\",
    \"items\": [
        {
            \"name\": \"Apple Macbook\",
            \"quantity\": 1,
            \"price\": 10000,
            \"description\": \"Light and powerful laptop\",
            \"item_id\": 5,
            \"sub_total\": 10000,
            \"total\": 10000,
            \"unit_name\": \"box\",
            \"discount\": 0,
            \"discount_type\": \"fixed\",
            \"discount_val\": 0
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/estimates/7"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "estimate_date": "2022-02-13",
    "expiry_date": "2022-02-16",
    "customer_id": 1,
    "estimate_number": "EST-000001",
    "exchange_rate": 1,
    "discount_type": "fixed",
    "discount": 50,
    "discount_val": 5000,
    "sub_total": 10000,
    "total": 5000,
    "tax": 0,
    "template_name": "estimate1",
    "items": [
        {
            "name": "Apple Macbook",
            "quantity": 1,
            "price": 10000,
            "description": "Light and powerful laptop",
            "item_id": 5,
            "sub_total": 10000,
            "total": 10000,
            "unit_name": "box",
            "discount": 0,
            "discount_type": "fixed",
            "discount_val": 0
        }
    ]
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/estimates/7',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'estimate_date' => '2022-02-13',
            'expiry_date' => '2022-02-16',
            'customer_id' => 1,
            'estimate_number' => 'EST-000001',
            'exchange_rate' => 1,
            'discount_type' => 'fixed',
            'discount' => 50,
            'discount_val' => 5000,
            'sub_total' => 10000,
            'total' => 5000,
            'tax' => 0,
            'template_name' => 'estimate1',
            'items' => [
                [
                    'name' => 'Apple Macbook',
                    'quantity' => 1,
                    'price' => 10000,
                    'description' => 'Light and powerful laptop',
                    'item_id' => 5,
                    'sub_total' => 10000,
                    'total' => 10000,
                    'unit_name' => 'box',
                    'discount' => 0,
                    'discount_type' => 'fixed',
                    'discount_val' => 0,
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/estimates/{id}

PATCH api/v1/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  

Customer ID.

estimate_number  string  

Estimate Number.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

discount_type  string optional  

Type of discount: fixed or percentage.

discount  string  

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

discount_val  string  

Total discount amount in cents.

sub_total  string  

Subtotal amount of the estimate in cents.

total  string  

Total amount of the estimate 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[].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.

Admin / Expense Categories

API Endpoints for managing expense categories

List all expense categories

requires authentication

Returns a list of your expense categories.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/categories" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/categories"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/categories',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 31,
            "name": "fuga",
            "description": "Ex nostrum iure maxime recusandae et ullam. Cupiditate explicabo cumque voluptas molestias pariatur qui. Ullam suscipit nobis atque atque. Culpa explicabo consequatur consequatur.",
            "company_id": 1,
            "amount": 0,
            "formatted_created_at": "2022/03/14"
        },
        {
            "id": 32,
            "name": "in",
            "description": "Et quibusdam unde aut ducimus exercitationem. Dolores optio mollitia blanditiis dicta consequuntur omnis eum. Sit aut autem distinctio tempora sequi est et.",
            "company_id": 1,
            "amount": 0,
            "formatted_created_at": "2022/03/14"
        }
    ]
}
 

Request   

GET api/v1/categories

Create an expense category

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/categories" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"facilis\"
}"
const url = new URL(
    "http://crater.test/api/v1/categories"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "facilis"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/categories',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'facilis',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/categories

Body Parameters

name  string  

description  string optional  

Retrieve an expense category

requires authentication

Retrieves an Expense Category object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/categories/11" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/categories/11"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/categories/11',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 33,
        "name": "accusamus",
        "description": "Quaerat et quisquam asperiores reprehenderit minima. Consequuntur nobis quam sequi fugiat porro saepe. Possimus sequi veniam laborum ut.",
        "company_id": 1,
        "amount": 0,
        "formatted_created_at": "2022/03/14"
    }
}
 

Request   

GET api/v1/categories/{id}

URL Parameters

id  integer  

The ID of the category.

Update an expense category

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/categories/17" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"non\"
}"
const url = new URL(
    "http://crater.test/api/v1/categories/17"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "non"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/categories/17',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'non',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/categories/{id}

PATCH api/v1/categories/{id}

URL Parameters

id  integer  

The ID of the category.

Body Parameters

name  string  

description  string optional  

Delete an expense category

requires authentication

Permanently delete an expense category.

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/categories/7" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/categories/7"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/categories/7',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

DELETE api/v1/categories/{id}

URL Parameters

id  integer  

The ID of the category.

Admin / Expenses

API Endpoints for managing expenses

Upload expense receipt

requires authentication

Upload a new expense receipt for a given expense.

Example request:
curl --request POST \
    "http://crater.test/api/v1/expenses/17/upload/receipts" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
const url = new URL(
    "http://crater.test/api/v1/expenses/17/upload/receipts"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/expenses/17/upload/receipts',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/expenses/{expense}/upload/receipts

URL Parameters

expense  integer  

Body Parameters

upload_receipt  string optional  

Delete expenses

requires authentication

Delete a list of expenses

Example request:
curl --request POST \
    "http://crater.test/api/v1/expenses/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"ids\": [
        1,
        2
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/expenses/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "ids": [
        1,
        2
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/expenses/delete',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'ids' => [
                1,
                2,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/expenses/delete

Body Parameters

ids  string[]  

List all expenses

requires authentication

Returns a list of your expenses.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/expenses" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/expenses"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/expenses',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 19,
            "expense_date": "1983-07-27T18:30:00.000000Z",
            "amount": 6,
            "notes": "Animi earum aut voluptatem nam necessitatibus consectetur laborum error. Architecto harum explicabo quibusdam omnis enim est. Expedita deserunt quia cum et magnam et.",
            "customer_id": 124,
            "attachment_receipt_url": null,
            "attachment_receipt": null,
            "attachment_receipt_meta": null,
            "company_id": 1,
            "expense_category_id": 28,
            "creator_id": null,
            "formatted_expense_date": "1983/07/28",
            "formatted_created_at": "2022/03/14",
            "exchange_rate": 4,
            "currency_id": 1,
            "base_amount": 2,
            "payment_method_id": null
        },
        {
            "id": 20,
            "expense_date": "1985-03-12T18:30:00.000000Z",
            "amount": 1,
            "notes": "Aliquid saepe distinctio nulla in doloribus fuga. Quis et iste asperiores et aliquid ad. Quam ut atque dolore. Mollitia voluptatem ipsum omnis iure quasi natus dolores.",
            "customer_id": 125,
            "attachment_receipt_url": null,
            "attachment_receipt": null,
            "attachment_receipt_meta": null,
            "company_id": 1,
            "expense_category_id": 29,
            "creator_id": null,
            "formatted_expense_date": "1985/03/13",
            "formatted_created_at": "2022/03/14",
            "exchange_rate": 1,
            "currency_id": 1,
            "base_amount": 9,
            "payment_method_id": null
        }
    ]
}
 

Request   

GET api/v1/expenses

Create an expense

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/expenses" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --form "expense_date=2022-02-13" \
    --form "expense_category_id=1" \
    --form "exchange_rate=1" \
    --form "payment_method_id=1" \
    --form "amount=5000" \
    --form "customer_id=1" \
    --form "currency_id=17" \
    --form "attachment_receipt=@/tmp/php31OwWC" 
const url = new URL(
    "http://crater.test/api/v1/expenses"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
    "company": "1",
};

const body = new FormData();
body.append('expense_date', '2022-02-13');
body.append('expense_category_id', '1');
body.append('exchange_rate', '1');
body.append('payment_method_id', '1');
body.append('amount', '5000');
body.append('customer_id', '1');
body.append('currency_id', '17');
body.append('attachment_receipt', document.querySelector('input[name="attachment_receipt"]').files[0]);

fetch(url, {
    method: "POST",
    headers,
    body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/expenses',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'multipart/form-data',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'multipart' => [
            [
                'name' => 'expense_date',
                'contents' => '2022-02-13'
            ],
            [
                'name' => 'expense_category_id',
                'contents' => '1'
            ],
            [
                'name' => 'exchange_rate',
                'contents' => '1'
            ],
            [
                'name' => 'payment_method_id',
                'contents' => '1'
            ],
            [
                'name' => 'amount',
                'contents' => '5000'
            ],
            [
                'name' => 'customer_id',
                'contents' => '1'
            ],
            [
                'name' => 'currency_id',
                'contents' => '17'
            ],
            [
                'name' => 'attachment_receipt',
                'contents' => fopen('/tmp/php31OwWC', 'r')
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/expenses

Body Parameters

expense_date  string  

Must be a valid date.

expense_category_id  integer  

ID for Expense Category.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

payment_method_id  string optional  

ID for Payment Method.

amount  integer  

Total amount of the expense in cents.

customer_id  integer optional  

(Optional) ID of the customer for which you wish to record the expense. .

notes  string optional  

Some notes.

currency_id  integer  

ID of the currency in which you wish to record the expense.

attachment_receipt  file optional  

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

Retrieve an expense

requires authentication

Retrieves an Expense object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/expenses/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/expenses/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/expenses/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 21,
        "expense_date": "2001-12-22T18:30:00.000000Z",
        "amount": 8,
        "notes": "Dolorum nam adipisci est nam voluptatem molestias. Libero aut natus rerum consequuntur atque. Porro perspiciatis doloremque aut exercitationem. Dolorem dolores ab et voluptas.",
        "customer_id": 126,
        "attachment_receipt_url": null,
        "attachment_receipt": null,
        "attachment_receipt_meta": null,
        "company_id": 1,
        "expense_category_id": 30,
        "creator_id": null,
        "formatted_expense_date": "2001/12/23",
        "formatted_created_at": "2022/03/14",
        "exchange_rate": 4,
        "currency_id": 1,
        "base_amount": 2,
        "payment_method_id": null
    }
}
 

Request   

GET api/v1/expenses/{id}

URL Parameters

id  integer  

The ID of the expense.

Update an expense

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/expenses/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --form "expense_date=2022-02-13" \
    --form "expense_category_id=1" \
    --form "exchange_rate=1" \
    --form "payment_method_id=1" \
    --form "amount=5000" \
    --form "customer_id=1" \
    --form "currency_id=10" \
    --form "attachment_receipt=@/tmp/phpYYNTY9" 
const url = new URL(
    "http://crater.test/api/v1/expenses/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
    "company": "1",
};

const body = new FormData();
body.append('expense_date', '2022-02-13');
body.append('expense_category_id', '1');
body.append('exchange_rate', '1');
body.append('payment_method_id', '1');
body.append('amount', '5000');
body.append('customer_id', '1');
body.append('currency_id', '10');
body.append('attachment_receipt', document.querySelector('input[name="attachment_receipt"]').files[0]);

fetch(url, {
    method: "PUT",
    headers,
    body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/expenses/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'multipart/form-data',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'multipart' => [
            [
                'name' => 'expense_date',
                'contents' => '2022-02-13'
            ],
            [
                'name' => 'expense_category_id',
                'contents' => '1'
            ],
            [
                'name' => 'exchange_rate',
                'contents' => '1'
            ],
            [
                'name' => 'payment_method_id',
                'contents' => '1'
            ],
            [
                'name' => 'amount',
                'contents' => '5000'
            ],
            [
                'name' => 'customer_id',
                'contents' => '1'
            ],
            [
                'name' => 'currency_id',
                'contents' => '10'
            ],
            [
                'name' => 'attachment_receipt',
                'contents' => fopen('/tmp/phpYYNTY9', 'r')
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/expenses/{id}

PATCH api/v1/expenses/{id}

URL Parameters

id  integer  

The ID of the expense.

Body Parameters

expense_date  string  

Must be a valid date.

expense_category_id  integer  

ID for Expense Category.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

payment_method_id  string optional  

ID for Payment Method.

amount  integer  

Total amount of the expense in cents.

customer_id  integer optional  

(Optional) ID of the customer for which you wish to record the expense. .

notes  string optional  

Some notes.

currency_id  integer  

ID of the currency in which you wish to record the expense.

attachment_receipt  file optional  

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

Admin / File Disks

API Endpoints for managing file disks

List all file disks

requires authentication

Returns a list of your file disks.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/disks" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/disks"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/disks',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 9,
            "name": "eos",
            "type": null,
            "driver": "local",
            "set_as_default": false,
            "credentials": "{\"driver\":\"local\",\"root\":\"\\/home\\/forge\\/api-docs.craterapp.com\\/storage\\/app\"}",
            "company_id": null
        },
        {
            "id": 10,
            "name": "inventore",
            "type": null,
            "driver": "local",
            "set_as_default": false,
            "credentials": "{\"driver\":\"local\",\"root\":\"\\/home\\/forge\\/api-docs.craterapp.com\\/storage\\/app\"}",
            "company_id": null
        }
    ]
}
 

Request   

GET api/v1/disks

Create a file disk

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/disks" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"eos\",
    \"driver\": \"et\"
}"
const url = new URL(
    "http://crater.test/api/v1/disks"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "eos",
    "driver": "et"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/disks',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'eos',
            'driver' => 'et',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/disks

Body Parameters

name  string  

driver  string  

Retrieve a file disk

requires authentication

Retrieves a File Disk object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/disks/distinctio" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/disks/distinctio"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/disks/distinctio',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 168
 

[]
 

Request   

GET api/v1/disks/{id}

URL Parameters

id  string  

The ID of the disk.

Update a file disk

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/disks/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/disks/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/disks/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/disks/{id}

PATCH api/v1/disks/{id}

URL Parameters

id  integer  

The ID of the disk.

Remove the specified resource from storage.

requires authentication

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/disks/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/disks/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/disks/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

DELETE api/v1/disks/{id}

URL Parameters

id  integer  

The ID of the disk.

List all file disk drivers

requires authentication

Returns a list of supported file disk drivers

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/disk/drivers" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/disk/drivers"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/disk/drivers',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 167
 

{
    "drivers": [
        {
            "name": "Local",
            "value": "local"
        },
        {
            "name": "Amazon S3",
            "value": "s3"
        },
        {
            "name": "Digital Ocean Spaces",
            "value": "doSpaces"
        },
        {
            "name": "Dropbox",
            "value": "dropbox"
        }
    ],
    "default": "temp_local"
}
 

Request   

GET api/v1/disk/drivers

Admin / General

Bootstrap

requires authentication

This endpoint is used to retrieve all the basic required data when the user logs in. It's mainly used to prevent additional unnecessary requests.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/bootstrap" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/bootstrap"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/bootstrap',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
 "data": [
  {
      "current_user": {},
      "current_user_settings": {},
      "companies": [],
      "current_company": {},
      "current_company_settings": {},
      "current_company_currency": {},
      "config": {},
      "global_settings": {},
      "main_menu": [],
      "setting_menu": [],
      "modules: []
  },
 ]
}
 

Request   

GET api/v1/bootstrap

Dashboard Stats

requires authentication

Dashboard Endpoint may be used to fetch the data required on the Dashboard.

It returns the Chart dataset, Recent due invoices & Estimates.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/dashboard" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/dashboard"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/dashboard',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
 "data": [
  {
      "total_amount_due": 1,
      "total_customer_count":1,
      "total_invoice_count": 1,
      "total_estimate_count": 1,
      "recent_due_invoices": [],
      "recent_estimates": [],
      "chart_data": [],
      "total_sales": 100,
      "total_receipts": 100,
      "total_expenses": 100,
      "total_net_income: 100
  },
 ]
}
 

Request   

GET api/v1/dashboard

requires authentication

Returns all matching customers or users for the given search text (works based on name, email & phone)

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/search?search=tempore" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/search"
);

const params = {
    "search": "tempore",
};
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",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/search',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'query' => [
            'search'=> 'tempore',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 179
 

{
    "customers": {
        "current_page": 1,
        "data": [],
        "first_page_url": "http://crater.test/api/v1/search?page=1",
        "from": null,
        "last_page": 1,
        "last_page_url": "http://crater.test/api/v1/search?page=1",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://crater.test/api/v1/search?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Next »",
                "active": false
            }
        ],
        "next_page_url": null,
        "path": "http://crater.test/api/v1/search",
        "per_page": 10,
        "prev_page_url": null,
        "to": null,
        "total": 0
    },
    "users": {
        "current_page": 1,
        "data": [],
        "first_page_url": "http://crater.test/api/v1/search?page=1",
        "from": null,
        "last_page": 1,
        "last_page_url": "http://crater.test/api/v1/search?page=1",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://crater.test/api/v1/search?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Next »",
                "active": false
            }
        ],
        "next_page_url": null,
        "path": "http://crater.test/api/v1/search",
        "per_page": 10,
        "prev_page_url": null,
        "to": null,
        "total": 0
    }
}
 

Get Config By Key

requires authentication

Returns the value for the given key.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/config" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"key\": \"et\"
}"
const url = new URL(
    "http://crater.test/api/v1/config"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "key": "et"
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/config',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'key' => 'et',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 178
 

{
    "et": null
}
 

Request   

GET api/v1/config

Body Parameters

key  required optional  

Currencies

requires authentication

Returns a list of countries

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/currencies" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/currencies"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/currencies',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 78,
            "name": "US Dollar",
            "code": "USD",
            "symbol": "$",
            "precision": 2,
            "thousand_separator": ",",
            "decimal_separator": ".",
            "swap_currency_symbol": true,
            "exchange_rate": null
        },
        {
            "id": 79,
            "name": "US Dollar",
            "code": "USD",
            "symbol": "$",
            "precision": 2,
            "thousand_separator": ",",
            "decimal_separator": ".",
            "swap_currency_symbol": true,
            "exchange_rate": null
        }
    ]
}
 

Request   

GET api/v1/currencies

Time Zones

requires authentication

Returns a list of supported time zones.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/timezones" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/timezones"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/timezones',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
 "data": [
     {
        "key": "(UTC-08:00) Los Angeles",
        "value": "America/Los_Angeles",
    },
    {...},
  ]
}
 

Request   

GET api/v1/timezones

Date Formats

requires authentication

Returns a list of supported date formats.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/date/formats" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/date/formats"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/date/formats',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 177
 

{
    "date_formats": [
        {
            "display_date": "2022 Mar 14",
            "carbon_format_value": "Y M d",
            "moment_format_value": "YYYY MMM DD"
        },
        {
            "display_date": "14 Mar 2022",
            "carbon_format_value": "d M Y",
            "moment_format_value": "DD MMM YYYY"
        },
        {
            "display_date": "14/03/2022",
            "carbon_format_value": "d/m/Y",
            "moment_format_value": "DD/MM/YYYY"
        },
        {
            "display_date": "14.03.2022",
            "carbon_format_value": "d.m.Y",
            "moment_format_value": "DD.MM.YYYY"
        },
        {
            "display_date": "14-03-2022",
            "carbon_format_value": "d-m-Y",
            "moment_format_value": "DD-MM-YYYY"
        },
        {
            "display_date": "03/14/2022",
            "carbon_format_value": "m/d/Y",
            "moment_format_value": "MM/DD/YYYY"
        },
        {
            "display_date": "2022/03/14",
            "carbon_format_value": "Y/m/d",
            "moment_format_value": " YYYY/MM/DD"
        },
        {
            "display_date": "2022-03-14",
            "carbon_format_value": "Y-m-d",
            "moment_format_value": "YYYY-MM-DD"
        }
    ]
}
 

Request   

GET api/v1/date/formats

Next Sequence Number

requires authentication

Get Next Number for Invoices or Estimates or Payments

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/next-number" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/next-number"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/next-number',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
content-type: text/html; charset=UTF-8
cache-control: no-cache, private
x-ratelimit-limit: 180
x-ratelimit-remaining: 176
 


 

Request   

GET api/v1/next-number

Admin / Invoices

API Endpoints for managing invoices

Preview an invoice email

requires authentication

Returns html view for previewing an invoice email before sending it to customer.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/invoices/13/send/preview" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"body\": \"et\",
    \"subject\": \"voluptatem\",
    \"from\": \"minus\",
    \"to\": \"odio\"
}"
const url = new URL(
    "http://crater.test/api/v1/invoices/13/send/preview"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "body": "et",
    "subject": "voluptatem",
    "from": "minus",
    "to": "odio"
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/invoices/13/send/preview',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'body' => 'et',
            'subject' => 'voluptatem',
            'from' => 'minus',
            'to' => 'odio',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 175
 

{
    "message": "No query results for model [Crater\\Models\\Invoice] 13"
}
 

Request   

GET api/v1/invoices/{invoice}/send/preview

URL Parameters

invoice  integer  

Body Parameters

body  string  

subject  string  

from  string  

to  string  

Send an invoice

requires authentication

Mail a specific invoice to the corresponding customer's email address.

Example request:
curl --request POST \
    "http://crater.test/api/v1/invoices/8/send" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"body\": \"quod\",
    \"subject\": \"molestiae\",
    \"from\": \"fuga\",
    \"to\": \"numquam\"
}"
const url = new URL(
    "http://crater.test/api/v1/invoices/8/send"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "body": "quod",
    "subject": "molestiae",
    "from": "fuga",
    "to": "numquam"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/invoices/8/send',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'body' => 'quod',
            'subject' => 'molestiae',
            'from' => 'fuga',
            'to' => 'numquam',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/invoices/{invoice}/send

URL Parameters

invoice  integer  

Body Parameters

body  string  

subject  string  

from  string  

to  string  

Clone an invoice

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/invoices/8/clone" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/invoices/8/clone"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/invoices/8/clone',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/invoices/{invoice}/clone

URL Parameters

invoice  integer  

Update status of an invoice

requires authentication

This endpoint is mainly used to mark an invoice as sent or completed.

Example request:
curl --request POST \
    "http://crater.test/api/v1/invoices/2/status" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/invoices/2/status"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/invoices/2/status',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/invoices/{invoice}/status

URL Parameters

invoice  integer  

Delete invoices

requires authentication

Delete a list of invoices

Example request:
curl --request POST \
    "http://crater.test/api/v1/invoices/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"ids\": [
        1,
        2
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/invoices/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "ids": [
        1,
        2
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/invoices/delete',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'ids' => [
                1,
                2,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/invoices/delete

Body Parameters

ids  string[]  

List all invoice templates

requires authentication

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/invoices/templates" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/invoices/templates"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/invoices/templates',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 174
 

{
    "invoiceTemplates": [
        {
            "name": "invoice1",
            "path": "http://crater.test/build/img/PDF/invoice1.png"
        },
        {
            "name": "invoice2",
            "path": "http://crater.test/build/img/PDF/invoice2.png"
        },
        {
            "name": "invoice3",
            "path": "http://crater.test/build/img/PDF/invoice3.png"
        }
    ]
}
 

Request   

GET api/v1/invoices/templates

List all invoices

requires authentication

Returns a list of your invoices.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/invoices" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/invoices"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/invoices',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 19,
            "invoice_date": "1972-08-10T18:30:00.000000Z",
            "due_date": "1977-05-06T18:30:00.000000Z",
            "invoice_number": "INV-000001",
            "reference_number": "INV-000001",
            "status": "DRAFT",
            "paid_status": "UNPAID",
            "tax_per_item": "NO",
            "discount_per_item": "NO",
            "notes": "Enim repellendus animi voluptatem magni aut quae ut vitae.",
            "discount_type": "fixed",
            "discount": 4,
            "discount_val": 4,
            "sub_total": 3,
            "total": 2,
            "tax": 8,
            "due_amount": 2,
            "sent": null,
            "viewed": null,
            "unique_hash": "fpYPPkZGSZVe5mgHwwNNptrg0QUJBKMx5CYg4r9cE12IHHCuMTiI3SjtHW5y",
            "template_name": "invoice1",
            "customer_id": 112,
            "recurring_invoice_id": 28,
            "sequence_number": 1,
            "exchange_rate": 2,
            "base_discount_val": 6,
            "base_sub_total": 2,
            "base_total": 5,
            "creator_id": null,
            "base_tax": 9,
            "base_due_amount": 4,
            "currency_id": 1,
            "formatted_created_at": "2022/03/14",
            "invoice_pdf_url": "http://crater.test/invoices/pdf/fpYPPkZGSZVe5mgHwwNNptrg0QUJBKMx5CYg4r9cE12IHHCuMTiI3SjtHW5y",
            "formatted_invoice_date": "1972/08/11",
            "formatted_due_date": "1977/05/07",
            "allow_edit": true,
            "payment_module_enabled": false,
            "sales_tax_type": null,
            "sales_tax_address_type": null
        },
        {
            "id": 20,
            "invoice_date": "1976-03-13T18:30:00.000000Z",
            "due_date": "1994-09-20T18:30:00.000000Z",
            "invoice_number": "INV-000002",
            "reference_number": "INV-000002",
            "status": "DRAFT",
            "paid_status": "UNPAID",
            "tax_per_item": "NO",
            "discount_per_item": "NO",
            "notes": "Ut placeat natus beatae enim aut. Et hic consequatur ducimus fugit placeat non.",
            "discount_type": "percentage",
            "discount": 0.99,
            "discount_val": 99,
            "sub_total": 1,
            "total": 1,
            "tax": 4,
            "due_amount": 1,
            "sent": null,
            "viewed": null,
            "unique_hash": "vJUHSesc58DNEJHN2DVqwHewBJQBuO3eRzDgxQmPRHnwNnrkBRQ13vVWMuVC",
            "template_name": "invoice1",
            "customer_id": 114,
            "recurring_invoice_id": 29,
            "sequence_number": 2,
            "exchange_rate": 9,
            "base_discount_val": 7,
            "base_sub_total": 2,
            "base_total": 7,
            "creator_id": null,
            "base_tax": 4,
            "base_due_amount": 6,
            "currency_id": 1,
            "formatted_created_at": "2022/03/14",
            "invoice_pdf_url": "http://crater.test/invoices/pdf/vJUHSesc58DNEJHN2DVqwHewBJQBuO3eRzDgxQmPRHnwNnrkBRQ13vVWMuVC",
            "formatted_invoice_date": "1976/03/14",
            "formatted_due_date": "1994/09/21",
            "allow_edit": true,
            "payment_module_enabled": false,
            "sales_tax_type": null,
            "sales_tax_address_type": null
        }
    ]
}
 

Request   

GET api/v1/invoices

Create an invoice

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/invoices" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"invoice_date\": \"2022-02-13\",
    \"due_date\": \"2022-02-16\",
    \"customer_id\": 1,
    \"invoice_number\": \"INV-000001\",
    \"exchange_rate\": 1,
    \"discount_type\": \"fixed\",
    \"discount\": 50,
    \"discount_val\": 5000,
    \"sub_total\": 10000,
    \"total\": 5000,
    \"tax\": 0,
    \"template_name\": \"invoice1\",
    \"items\": [
        {
            \"name\": \"Apple Macbook\",
            \"quantity\": 1,
            \"price\": 10000,
            \"description\": \"Light and powerful laptop\",
            \"item_id\": 5,
            \"sub_total\": 10000,
            \"total\": 10000,
            \"unit_name\": \"box\",
            \"discount\": 0,
            \"discount_type\": \"fixed\",
            \"discount_val\": 0
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/invoices"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "invoice_date": "2022-02-13",
    "due_date": "2022-02-16",
    "customer_id": 1,
    "invoice_number": "INV-000001",
    "exchange_rate": 1,
    "discount_type": "fixed",
    "discount": 50,
    "discount_val": 5000,
    "sub_total": 10000,
    "total": 5000,
    "tax": 0,
    "template_name": "invoice1",
    "items": [
        {
            "name": "Apple Macbook",
            "quantity": 1,
            "price": 10000,
            "description": "Light and powerful laptop",
            "item_id": 5,
            "sub_total": 10000,
            "total": 10000,
            "unit_name": "box",
            "discount": 0,
            "discount_type": "fixed",
            "discount_val": 0
        }
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/invoices',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'invoice_date' => '2022-02-13',
            'due_date' => '2022-02-16',
            'customer_id' => 1,
            'invoice_number' => 'INV-000001',
            'exchange_rate' => 1,
            'discount_type' => 'fixed',
            'discount' => 50,
            'discount_val' => 5000,
            'sub_total' => 10000,
            'total' => 5000,
            'tax' => 0,
            'template_name' => 'invoice1',
            'items' => [
                [
                    'name' => 'Apple Macbook',
                    'quantity' => 1,
                    'price' => 10000,
                    'description' => 'Light and powerful laptop',
                    'item_id' => 5,
                    'sub_total' => 10000,
                    'total' => 10000,
                    'unit_name' => 'box',
                    'discount' => 0,
                    'discount_type' => 'fixed',
                    'discount_val' => 0,
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/invoices

Body Parameters

invoice_date  string  

Date of the invoice. Must be a valid date.

due_date  string optional  

Due Date. Must be a valid date.

customer_id  string  

Customer ID.

invoice_number  string  

Invoice Number.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

discount_type  string optional  

Type of discount: fixed or percentage.

discount  string  

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

discount_val  string  

Total discount amount in cents.

sub_total  string  

Subtotal amount of the invoice in cents.

total  integer  

Total amount of the invoice in cents.

notes  string optional  

tax  string  

Total tax on the invoice in cents.

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.

Retrieve an invoice

requires authentication

Retrieves an Invoice object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/invoices/9" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/invoices/9"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/invoices/9',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 21,
        "invoice_date": "2002-11-18T18:30:00.000000Z",
        "due_date": "1978-09-22T18:30:00.000000Z",
        "invoice_number": "INV-000001",
        "reference_number": "INV-000001",
        "status": "DRAFT",
        "paid_status": "UNPAID",
        "tax_per_item": "NO",
        "discount_per_item": "NO",
        "notes": "Eos inventore voluptatem eveniet aut incidunt.",
        "discount_type": "percentage",
        "discount": 0.76,
        "discount_val": 76,
        "sub_total": 4,
        "total": 1,
        "tax": 5,
        "due_amount": 1,
        "sent": null,
        "viewed": null,
        "unique_hash": "koVh0AjROb4cSFIY0r0wjPsSDdnBx0ZMkudenkqry3oV1c5USnCzMptaChPS",
        "template_name": "invoice1",
        "customer_id": 116,
        "recurring_invoice_id": 30,
        "sequence_number": 1,
        "exchange_rate": 3,
        "base_discount_val": 5,
        "base_sub_total": 4,
        "base_total": 8,
        "creator_id": null,
        "base_tax": 9,
        "base_due_amount": 3,
        "currency_id": 1,
        "formatted_created_at": "2022/03/14",
        "invoice_pdf_url": "http://crater.test/invoices/pdf/koVh0AjROb4cSFIY0r0wjPsSDdnBx0ZMkudenkqry3oV1c5USnCzMptaChPS",
        "formatted_invoice_date": "2002/11/19",
        "formatted_due_date": "1978/09/23",
        "allow_edit": true,
        "payment_module_enabled": false,
        "sales_tax_type": null,
        "sales_tax_address_type": null
    }
}
 

Request   

GET api/v1/invoices/{id}

URL Parameters

id  integer  

The ID of the invoice.

Update an invoice

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/invoices/7" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"invoice_date\": \"2022-02-13\",
    \"due_date\": \"2022-02-16\",
    \"customer_id\": 1,
    \"invoice_number\": \"INV-000001\",
    \"exchange_rate\": 1,
    \"discount_type\": \"fixed\",
    \"discount\": 50,
    \"discount_val\": 5000,
    \"sub_total\": 10000,
    \"total\": 5000,
    \"tax\": 0,
    \"template_name\": \"invoice1\",
    \"items\": [
        {
            \"name\": \"Apple Macbook\",
            \"quantity\": 1,
            \"price\": 10000,
            \"description\": \"Light and powerful laptop\",
            \"item_id\": 5,
            \"sub_total\": 10000,
            \"total\": 10000,
            \"unit_name\": \"box\",
            \"discount\": 0,
            \"discount_type\": \"fixed\",
            \"discount_val\": 0
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/invoices/7"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "invoice_date": "2022-02-13",
    "due_date": "2022-02-16",
    "customer_id": 1,
    "invoice_number": "INV-000001",
    "exchange_rate": 1,
    "discount_type": "fixed",
    "discount": 50,
    "discount_val": 5000,
    "sub_total": 10000,
    "total": 5000,
    "tax": 0,
    "template_name": "invoice1",
    "items": [
        {
            "name": "Apple Macbook",
            "quantity": 1,
            "price": 10000,
            "description": "Light and powerful laptop",
            "item_id": 5,
            "sub_total": 10000,
            "total": 10000,
            "unit_name": "box",
            "discount": 0,
            "discount_type": "fixed",
            "discount_val": 0
        }
    ]
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/invoices/7',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'invoice_date' => '2022-02-13',
            'due_date' => '2022-02-16',
            'customer_id' => 1,
            'invoice_number' => 'INV-000001',
            'exchange_rate' => 1,
            'discount_type' => 'fixed',
            'discount' => 50,
            'discount_val' => 5000,
            'sub_total' => 10000,
            'total' => 5000,
            'tax' => 0,
            'template_name' => 'invoice1',
            'items' => [
                [
                    'name' => 'Apple Macbook',
                    'quantity' => 1,
                    'price' => 10000,
                    'description' => 'Light and powerful laptop',
                    'item_id' => 5,
                    'sub_total' => 10000,
                    'total' => 10000,
                    'unit_name' => 'box',
                    'discount' => 0,
                    'discount_type' => 'fixed',
                    'discount_val' => 0,
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/invoices/{id}

PATCH api/v1/invoices/{id}

URL Parameters

id  integer  

The ID of the invoice.

Body Parameters

invoice_date  string  

Date of the invoice. Must be a valid date.

due_date  string optional  

Due Date. Must be a valid date.

customer_id  string  

Customer ID.

invoice_number  string  

Invoice Number.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

discount_type  string optional  

Type of discount: fixed or percentage.

discount  string  

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

discount_val  string  

Total discount amount in cents.

sub_total  string  

Subtotal amount of the invoice in cents.

total  integer  

Total amount of the invoice in cents.

notes  string optional  

tax  string  

Total tax on the invoice in cents.

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.

Admin / 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 "http://crater.test/api/v1/units" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/units"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/units',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 36,
            "name": "Albertha Herman PhD",
            "company_id": 1
        },
        {
            "id": 37,
            "name": "Alexandrine Bauch",
            "company_id": 1
        }
    ]
}
 

Request   

GET api/v1/units

Create an item unit

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/units" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"ullam\"
}"
const url = new URL(
    "http://crater.test/api/v1/units"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "ullam"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/units',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'ullam',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/units

Body Parameters

name  string  

Retrieve an item unit

requires authentication

Retrieves an Item unit object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/units/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/units/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/units/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 38,
        "name": "Araceli Grady",
        "company_id": 1
    }
}
 

Request   

GET api/v1/units/{id}

URL Parameters

id  integer  

The ID of the unit.

Update an item unit

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/units/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"dolorem\"
}"
const url = new URL(
    "http://crater.test/api/v1/units/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "dolorem"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/units/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'dolorem',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/units/{id}

PATCH api/v1/units/{id}

URL Parameters

id  integer  

The ID of the unit.

Body Parameters

name  string  

Delete an item unit

requires authentication

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/units/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/units/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/units/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

DELETE api/v1/units/{id}

URL Parameters

id  integer  

The ID of the unit.

Admin / Items

API Endpoints for managing items

Delete items

requires authentication

Delete a list of Items.

Example request:
curl --request POST \
    "http://crater.test/api/v1/items/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"ids\": [
        1,
        2
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/items/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "ids": [
        1,
        2
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/items/delete',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'ids' => [
                1,
                2,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/items/delete

Body Parameters

ids  string[]  

List all items

requires authentication

Returns a list of your items.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/items" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/items"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/items',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 13,
            "name": "Missouri King",
            "description": "Minima ad ipsam mollitia eum autem natus animi. Facilis error suscipit fuga et. Voluptatibus maiores est rerum id iusto.",
            "price": 9,
            "unit_id": 33,
            "company_id": 1,
            "creator_id": null,
            "currency_id": 1,
            "created_at": "2022-03-14T09:35:42.000000Z",
            "updated_at": "2022-03-14T09:35:42.000000Z",
            "tax_per_item": true,
            "formatted_created_at": ""
        },
        {
            "id": 14,
            "name": "Dr. Kaylie Powlowski III",
            "description": "Sed maiores hic autem voluptatem omnis. Iste esse quis eaque sit ratione. Nihil odit omnis illum ea est unde nesciunt.",
            "price": 6,
            "unit_id": 34,
            "company_id": 1,
            "creator_id": null,
            "currency_id": 1,
            "created_at": "2022-03-14T09:35:42.000000Z",
            "updated_at": "2022-03-14T09:35:42.000000Z",
            "tax_per_item": true,
            "formatted_created_at": ""
        }
    ]
}
 

Request   

GET api/v1/items

Create an item

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/items" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"Laptop\",
    \"price\": 14,
    \"unit_id\": 1
}"
const url = new URL(
    "http://crater.test/api/v1/items"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "Laptop",
    "price": 14,
    "unit_id": 1
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/items',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'Laptop',
            'price' => 14,
            'unit_id' => 1,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/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 "http://crater.test/api/v1/items/19" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/items/19"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/items/19',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 15,
        "name": "Nicholaus Rau",
        "description": "Ullam officiis doloribus ipsum et repellendus fugiat error provident. Autem nam aperiam praesentium. Qui quas et voluptatibus quidem sed rem quisquam necessitatibus.",
        "price": 5,
        "unit_id": 35,
        "company_id": 1,
        "creator_id": null,
        "currency_id": 1,
        "created_at": "2022-03-14T09:35:42.000000Z",
        "updated_at": "2022-03-14T09:35:42.000000Z",
        "tax_per_item": true,
        "formatted_created_at": ""
    }
}
 

Request   

GET api/v1/items/{id}

URL Parameters

id  integer  

The ID of the item.

Update an item

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/items/5" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"Laptop\",
    \"price\": 17,
    \"unit_id\": 1
}"
const url = new URL(
    "http://crater.test/api/v1/items/5"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "Laptop",
    "price": 17,
    "unit_id": 1
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/items/5',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'Laptop',
            'price' => 17,
            'unit_id' => 1,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/items/{id}

PATCH api/v1/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  

Admin / Me

API Endpoints for managing currently logged-in user

Retrieve current user account

requires authentication

Retrieve the current user account

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/me" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/me"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/me',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 164
 

{
    "data": {
        "id": 1,
        "name": "Jane Doe",
        "email": "admin@craterapp.com",
        "phone": null,
        "role": "super admin",
        "contact_name": null,
        "company_name": null,
        "website": null,
        "enable_portal": null,
        "currency_id": null,
        "facebook_id": null,
        "google_id": null,
        "github_id": null,
        "created_at": "2022-02-12T10:10:34.000000Z",
        "updated_at": "2022-02-12T10:10:34.000000Z",
        "avatar": 0,
        "is_owner": true,
        "roles": [
            {
                "id": 1,
                "name": "super admin",
                "title": "Super Admin",
                "level": null,
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z",
                "pivot": {
                    "entity_id": 1,
                    "role_id": 1,
                    "entity_type": "Crater\\Models\\User",
                    "scope": 1
                }
            }
        ],
        "formatted_created_at": "2022/02/12"
    }
}
 

Request   

GET api/v1/me

Update profile

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/me" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"cum\",
    \"password\": \"nv\",
    \"email\": \"hoconnell@example.org\"
}"
const url = new URL(
    "http://crater.test/api/v1/me"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "cum",
    "password": "nv",
    "email": "hoconnell@example.org"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/me',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'cum',
            'password' => 'nv',
            'email' => 'hoconnell@example.org',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/me

Body Parameters

name  string  

password  string optional  

Must be at least 8 characters.

email  string  

Must be a valid email address.

Get user settings

requires authentication

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/me/settings" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"settings\": [
        \"currency\",
        \"language\"
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/me/settings"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "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(
    'http://crater.test/api/v1/me/settings',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'settings' => [
                'currency',
                'language',
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 163
 

{
    "language": "en"
}
 

Request   

GET api/v1/me/settings

Body Parameters

settings  string[]  

Update user settings

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/me/settings" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"settings\": {
        \"discount_per_item\": \"YES\",
        \"automatically_expire_public_links\": \"NO\"
    }
}"
const url = new URL(
    "http://crater.test/api/v1/me/settings"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "settings": {
        "discount_per_item": "YES",
        "automatically_expire_public_links": "NO"
    }
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/me/settings',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'settings' => [
                'discount_per_item' => 'YES',
                'automatically_expire_public_links' => 'NO',
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/me/settings

Body Parameters

settings  string  

Array of setting keys.

Upload avatar

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/me/upload-avatar" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --form "admin_avatar=@/tmp/php1uA5SI" 
const url = new URL(
    "http://crater.test/api/v1/me/upload-avatar"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
    "company": "1",
};

const body = new FormData();
body.append('admin_avatar', document.querySelector('input[name="admin_avatar"]').files[0]);

fetch(url, {
    method: "POST",
    headers,
    body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/me/upload-avatar',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'multipart/form-data',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'multipart' => [
            [
                'name' => 'admin_avatar',
                'contents' => fopen('/tmp/php1uA5SI', 'r')
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/me/upload-avatar

Body Parameters

admin_avatar  file optional  

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

avatar  string optional  

Admin / Notes

API Endpoints for managing notes

List all notes

requires authentication

Returns a list of your notes.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/notes" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/notes"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/notes',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 10,
            "type": "Payment",
            "name": "qui",
            "notes": "Nobis voluptatem est recusandae dolor. Iure earum fugiat aperiam. Voluptates molestiae fuga esse rerum voluptatibus fugiat. Provident dolor quia cupiditate cum deserunt quaerat."
        },
        {
            "id": 11,
            "type": "Estimate",
            "name": "quia",
            "notes": "Consectetur consequatur modi velit pariatur. Unde assumenda rem error et voluptatibus."
        }
    ]
}
 

Request   

GET api/v1/notes

Create a note

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/notes" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"aut\",
    \"type\": \"Payment\",
    \"notes\": \"quia\"
}"
const url = new URL(
    "http://crater.test/api/v1/notes"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "aut",
    "type": "Payment",
    "notes": "quia"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/notes',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'aut',
            'type' => 'Payment',
            'notes' => 'quia',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/notes

Body Parameters

name  string  

type  string  

Must be one of Invoice, Estimate, or Payment.

notes  string  

Retrieve a note

requires authentication

Retrieves a note object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/notes/4" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/notes/4"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/notes/4',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 12,
        "type": "Payment",
        "name": "et",
        "notes": "Vel fugit dolore quos laborum quam inventore adipisci. Et molestias voluptas beatae deleniti. Fuga est minima quis. Omnis aut a harum. Neque ipsam aut numquam."
    }
}
 

Request   

GET api/v1/notes/{id}

URL Parameters

id  integer  

The ID of the note.

Update a note

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/notes/12" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"qui\",
    \"type\": \"Payment\",
    \"notes\": \"quas\"
}"
const url = new URL(
    "http://crater.test/api/v1/notes/12"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "qui",
    "type": "Payment",
    "notes": "quas"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/notes/12',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'qui',
            'type' => 'Payment',
            'notes' => 'quas',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/notes/{id}

PATCH api/v1/notes/{id}

URL Parameters

id  integer  

The ID of the note.

Body Parameters

name  string  

type  string  

Must be one of Invoice, Estimate, or Payment.

notes  string  

Delete a note

requires authentication

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/notes/11" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/notes/11"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/notes/11',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

DELETE api/v1/notes/{id}

URL Parameters

id  integer  

The ID of the note.

Admin / 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 "http://crater.test/api/v1/payment-methods" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/payment-methods"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/payment-methods',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 20,
            "name": "Dr. Alexzander Schimmel",
            "company_id": 1,
            "type": null
        },
        {
            "id": 21,
            "name": "Turner Trantow",
            "company_id": 1,
            "type": null
        }
    ]
}
 

Request   

GET api/v1/payment-methods

Create a payment method

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/payment-methods" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"voluptate\"
}"
const url = new URL(
    "http://crater.test/api/v1/payment-methods"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "voluptate"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/payment-methods',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'voluptate',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/payment-methods

Body Parameters

name  string  

Retrieve a payment method

requires authentication

Retrieves a Payment Method object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/payment-methods/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/payment-methods/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/payment-methods/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 22,
        "name": "Felicita Lockman",
        "company_id": 1,
        "type": null
    }
}
 

Request   

GET api/v1/payment-methods/{id}

URL Parameters

id  integer  

The ID of the payment method.

Update a payment method

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/payment-methods/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"exercitationem\"
}"
const url = new URL(
    "http://crater.test/api/v1/payment-methods/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "exercitationem"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/payment-methods/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'exercitationem',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/payment-methods/{id}

PATCH api/v1/payment-methods/{id}

URL Parameters

id  integer  

The ID of the payment method.

Body Parameters

name  string  

Delete a payment method

requires authentication

Permanently delete a payment method. Note: You cannot delete payment methods which are already being used on expenses or payments.

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/payment-methods/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/payment-methods/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/payment-methods/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

DELETE api/v1/payment-methods/{id}

URL Parameters

id  integer  

The ID of the payment method.

Admin / Payments

API Endpoints for managing payments

Preview payment receipt email

requires authentication

Returns html view for previewing a payment receipt email before sending it to customer.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/payments/15/send/preview" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/payments/15/send/preview"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/payments/15/send/preview',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 170
 

{
    "message": "No query results for model [Crater\\Models\\Payment] 15"
}
 

Request   

GET api/v1/payments/{payment}/send/preview

URL Parameters

payment  integer  

Send payment receipt

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/payments/13/send" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"subject\": \"et\",
    \"body\": \"odit\",
    \"from\": \"velit\",
    \"to\": \"exercitationem\"
}"
const url = new URL(
    "http://crater.test/api/v1/payments/13/send"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "subject": "et",
    "body": "odit",
    "from": "velit",
    "to": "exercitationem"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/payments/13/send',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'subject' => 'et',
            'body' => 'odit',
            'from' => 'velit',
            'to' => 'exercitationem',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/payments/{payment}/send

URL Parameters

payment  integer  

Body Parameters

subject  string  

body  string  

from  string  

to  string  

Delete payments

requires authentication

Delete a list of payments

Example request:
curl --request POST \
    "http://crater.test/api/v1/payments/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"ids\": [
        1,
        2
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/payments/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "ids": [
        1,
        2
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/payments/delete',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'ids' => [
                1,
                2,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/payments/delete

Body Parameters

ids  string[]  

List all payments

requires authentication

Returns a list of your payments.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/payments" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/payments"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/payments',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 19,
            "payment_number": "PAY-000001",
            "payment_date": "2020-03-13T18:30:00.000000Z",
            "notes": "Deleniti et odio porro. Sed veritatis magnam qui fugiat qui quae maxime.",
            "amount": 1,
            "unique_hash": "IOGdCEqpFSe4PQRACQLLq5EAThcABgCHuZwyZjr0fC5vHrEXgaIxiND70shI",
            "invoice_id": null,
            "company_id": 1,
            "payment_method_id": 1,
            "creator_id": null,
            "customer_id": 127,
            "exchange_rate": null,
            "base_amount": 4,
            "currency_id": 1,
            "transaction_id": null,
            "sequence_number": 1,
            "formatted_created_at": "2022/03/14",
            "formatted_payment_date": "2020/03/14",
            "payment_pdf_url": "http://crater.test/payments/pdf/IOGdCEqpFSe4PQRACQLLq5EAThcABgCHuZwyZjr0fC5vHrEXgaIxiND70shI"
        },
        {
            "id": 20,
            "payment_number": "PAY-000002",
            "payment_date": "1985-02-05T18:30:00.000000Z",
            "notes": "Voluptas harum et vitae ut occaecati quae omnis.",
            "amount": 5,
            "unique_hash": "7Xw1Y1uCOoO5efXsZAYTKTq2RQkRexMhLlVMePoqOVRdmrWb1znhQAqQ92LS",
            "invoice_id": null,
            "company_id": 1,
            "payment_method_id": 1,
            "creator_id": null,
            "customer_id": 128,
            "exchange_rate": null,
            "base_amount": 9,
            "currency_id": 1,
            "transaction_id": null,
            "sequence_number": 2,
            "formatted_created_at": "2022/03/14",
            "formatted_payment_date": "1985/02/06",
            "payment_pdf_url": "http://crater.test/payments/pdf/7Xw1Y1uCOoO5efXsZAYTKTq2RQkRexMhLlVMePoqOVRdmrWb1znhQAqQ92LS"
        }
    ]
}
 

Request   

GET api/v1/payments

Create a payment

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/payments" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"payment_date\": \"2022-02-13\",
    \"customer_id\": 1,
    \"exchange_rate\": 1,
    \"amount\": 5000,
    \"payment_number\": \"PAY-000001\",
    \"invoice_id\": 1,
    \"payment_method_id\": 1
}"
const url = new URL(
    "http://crater.test/api/v1/payments"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "payment_date": "2022-02-13",
    "customer_id": 1,
    "exchange_rate": 1,
    "amount": 5000,
    "payment_number": "PAY-000001",
    "invoice_id": 1,
    "payment_method_id": 1
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/payments',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'payment_date' => '2022-02-13',
            'customer_id' => 1,
            'exchange_rate' => 1,
            'amount' => 5000,
            'payment_number' => 'PAY-000001',
            'invoice_id' => 1,
            'payment_method_id' => 1,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/payments

Body Parameters

payment_date  string  

customer_id  string  

ID of the customer.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

amount  string  

Total amount of the payment in cents.

payment_number  string  

Payment Number.

invoice_id  string optional  

ID of the Invoice for which you received the payment.

payment_method_id  string optional  

ID of the Payment Method.

notes  string optional  

Some notes.

Retrieve a payment

requires authentication

Retrieves a Payment object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/payments/6" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/payments/6"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/payments/6',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 21,
        "payment_number": "PAY-000001",
        "payment_date": "1985-07-23T18:30:00.000000Z",
        "notes": "Consequatur sit quibusdam sed aut. Amet ex in in et nesciunt culpa qui.",
        "amount": 7,
        "unique_hash": "BFYFwz9hy311HP69MOTT8ZdoR5xmucbI7C4IuZDYl9T0LBslhr67THCyYZNs",
        "invoice_id": null,
        "company_id": 1,
        "payment_method_id": 1,
        "creator_id": null,
        "customer_id": 129,
        "exchange_rate": null,
        "base_amount": 3,
        "currency_id": 1,
        "transaction_id": null,
        "sequence_number": 1,
        "formatted_created_at": "2022/03/14",
        "formatted_payment_date": "1985/07/24",
        "payment_pdf_url": "http://crater.test/payments/pdf/BFYFwz9hy311HP69MOTT8ZdoR5xmucbI7C4IuZDYl9T0LBslhr67THCyYZNs"
    }
}
 

Request   

GET api/v1/payments/{id}

URL Parameters

id  integer  

The ID of the payment.

Update a payment

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/payments/7" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"payment_date\": \"2022-02-13\",
    \"customer_id\": 1,
    \"exchange_rate\": 1,
    \"amount\": 5000,
    \"payment_number\": \"PAY-000001\",
    \"invoice_id\": 1,
    \"payment_method_id\": 1
}"
const url = new URL(
    "http://crater.test/api/v1/payments/7"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "payment_date": "2022-02-13",
    "customer_id": 1,
    "exchange_rate": 1,
    "amount": 5000,
    "payment_number": "PAY-000001",
    "invoice_id": 1,
    "payment_method_id": 1
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/payments/7',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'payment_date' => '2022-02-13',
            'customer_id' => 1,
            'exchange_rate' => 1,
            'amount' => 5000,
            'payment_number' => 'PAY-000001',
            'invoice_id' => 1,
            'payment_method_id' => 1,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/payments/{id}

PATCH api/v1/payments/{id}

URL Parameters

id  integer  

The ID of the payment.

Body Parameters

payment_date  string  

customer_id  string  

ID of the customer.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

amount  string  

Total amount of the payment in cents.

payment_number  string  

Payment Number.

invoice_id  string optional  

ID of the Invoice for which you received the payment.

payment_method_id  string optional  

ID of the Payment Method.

notes  string optional  

Some notes.

Admin / Recurring Invoices

API Endpoints for managing recurring invoices

Get next invoice date by given frequency and start_date

requires authentication

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/recurring-invoice-frequency" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/recurring-invoice-frequency"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/recurring-invoice-frequency',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (500):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 173
 

{
    "message": "Server Error"
}
 

Request   

GET api/v1/recurring-invoice-frequency

Delete recurring invoices

requires authentication

Delete a list of recurring invoices

Example request:
curl --request POST \
    "http://crater.test/api/v1/recurring-invoices/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/recurring-invoices/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/recurring-invoices/delete',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/recurring-invoices/delete

List all recurring invoices

requires authentication

Returns a list of your recurring invoices.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/recurring-invoices" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/recurring-invoices"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/recurring-invoices',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 31,
            "starts_at": "2004-03-15T14:49:13.000000Z",
            "formatted_starts_at": "2004/03/15",
            "formatted_created_at": "2022/03/14",
            "formatted_next_invoice_at": "2022/03/14",
            "formatted_limit_date": "1971/08/04",
            "send_automatically": false,
            "customer_id": 118,
            "company_id": 1,
            "creator_id": null,
            "status": "ON_HOLD",
            "next_invoice_at": null,
            "frequency": "* * 18 * *",
            "limit_by": "NONE",
            "limit_count": 1,
            "limit_date": "1971-08-04",
            "exchange_rate": 7,
            "tax_per_item": "NO",
            "discount_per_item": "NO",
            "notes": null,
            "discount_type": null,
            "discount": 9,
            "discount_val": 2,
            "sub_total": 9,
            "total": 7,
            "tax": 4,
            "due_amount": 8,
            "template_name": null,
            "sales_tax_type": null,
            "sales_tax_address_type": null
        },
        {
            "id": 32,
            "starts_at": "1987-08-25T19:38:18.000000Z",
            "formatted_starts_at": "1987/08/26",
            "formatted_created_at": "2022/03/14",
            "formatted_next_invoice_at": "2022/03/14",
            "formatted_limit_date": "2020/12/29",
            "send_automatically": false,
            "customer_id": 119,
            "company_id": 1,
            "creator_id": null,
            "status": "COMPLETED",
            "next_invoice_at": null,
            "frequency": "* * 18 * *",
            "limit_by": "COUNT",
            "limit_count": 1,
            "limit_date": "2020-12-29",
            "exchange_rate": 7,
            "tax_per_item": "NO",
            "discount_per_item": "NO",
            "notes": null,
            "discount_type": null,
            "discount": 4,
            "discount_val": 6,
            "sub_total": 8,
            "total": 1,
            "tax": 6,
            "due_amount": 1,
            "template_name": null,
            "sales_tax_type": null,
            "sales_tax_address_type": null
        }
    ]
}
 

Request   

GET api/v1/recurring-invoices

Create a recurring invoice

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/recurring-invoices" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"starts_at\": \"2022-02-13\",
    \"send_automatically\": false,
    \"customer_id\": 1,
    \"exchange_rate\": 1,
    \"discount\": 50,
    \"discount_val\": 5000,
    \"sub_total\": 10000,
    \"total\": 5000,
    \"tax\": 0,
    \"status\": \"ACTIVE\",
    \"frequency\": \"* * * * *\",
    \"limit_by\": \"COUNT\",
    \"limit_count\": \"5\",
    \"items\": [
        {
            \"name\": \"Apple Macbook\",
            \"description\": \"Powerful and light\",
            \"quantity\": 1,
            \"price\": 10000,
            \"item_id\": 5,
            \"sub_total\": 10000,
            \"total\": 10000,
            \"discount\": 0,
            \"discount_type\": \"fixed\",
            \"discount_val\": 0,
            \"unit_name\": \"box\"
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/recurring-invoices"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "starts_at": "2022-02-13",
    "send_automatically": false,
    "customer_id": 1,
    "exchange_rate": 1,
    "discount": 50,
    "discount_val": 5000,
    "sub_total": 10000,
    "total": 5000,
    "tax": 0,
    "status": "ACTIVE",
    "frequency": "* * * * *",
    "limit_by": "COUNT",
    "limit_count": "5",
    "items": [
        {
            "name": "Apple Macbook",
            "description": "Powerful and light",
            "quantity": 1,
            "price": 10000,
            "item_id": 5,
            "sub_total": 10000,
            "total": 10000,
            "discount": 0,
            "discount_type": "fixed",
            "discount_val": 0,
            "unit_name": "box"
        }
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/recurring-invoices',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'starts_at' => '2022-02-13',
            'send_automatically' => false,
            'customer_id' => 1,
            'exchange_rate' => 1,
            'discount' => 50,
            'discount_val' => 5000,
            'sub_total' => 10000,
            'total' => 5000,
            'tax' => 0,
            'status' => 'ACTIVE',
            'frequency' => '* * * * *',
            'limit_by' => 'COUNT',
            'limit_count' => '5',
            'items' => [
                [
                    'name' => 'Apple Macbook',
                    'description' => 'Powerful and light',
                    'quantity' => 1,
                    'price' => 10000,
                    'item_id' => 5,
                    'sub_total' => 10000,
                    'total' => 10000,
                    'discount' => 0,
                    'discount_type' => 'fixed',
                    'discount_val' => 0,
                    'unit_name' => 'box',
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/recurring-invoices

Body Parameters

starts_at  string  

Starts At.

send_automatically  boolean  

Send Automatically.

customer_id  string  

Customer ID.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

discount  string  

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

discount_val  string  

Total discount amount in cents.

sub_total  string  

Subtotal amount of the invoice in cents.

total  string  

Total amount of the invoice in cents.

tax  string  

Total tax on the invoice in cents.

status  string  

Current Status. Must be one of ACTIVE, ON_HOLD, or COMPLETED.

frequency  string  

Frequency for creating invoices. Accepts CRON Format. You can find your format using a tool like: https://crontab.guru/.

limit_by  string  

Limit By Date or Count. Must be one of NONE, DATE, or COUNT.

limit_count  string optional  

Limit Count. This field is required when limit_by is COUNT.

limit_date  string optional  

Limit Date. This field is required when limit_by is DATE.

items  string[]  

Retrieve a recurring invoice

requires authentication

Retrieves a Recurring Invoice object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/recurring-invoices/14" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/recurring-invoices/14"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/recurring-invoices/14',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 33,
        "starts_at": "1988-05-26T17:34:00.000000Z",
        "formatted_starts_at": "1988/05/26",
        "formatted_created_at": "2022/03/14",
        "formatted_next_invoice_at": "2022/03/14",
        "formatted_limit_date": "2001/12/30",
        "send_automatically": false,
        "customer_id": 120,
        "company_id": 1,
        "creator_id": null,
        "status": "ON_HOLD",
        "next_invoice_at": null,
        "frequency": "* * 18 * *",
        "limit_by": "DATE",
        "limit_count": 5,
        "limit_date": "2001-12-30",
        "exchange_rate": 6,
        "tax_per_item": "NO",
        "discount_per_item": "NO",
        "notes": null,
        "discount_type": null,
        "discount": 7,
        "discount_val": 7,
        "sub_total": 2,
        "total": 9,
        "tax": 7,
        "due_amount": 6,
        "template_name": null,
        "sales_tax_type": null,
        "sales_tax_address_type": null
    }
}
 

Request   

GET api/v1/recurring-invoices/{id}

URL Parameters

id  integer  

The ID of the recurring invoice.

Update a recurring invoice

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/recurring-invoices/20" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"starts_at\": \"2022-02-13\",
    \"send_automatically\": false,
    \"customer_id\": 1,
    \"exchange_rate\": 1,
    \"discount\": 50,
    \"discount_val\": 5000,
    \"sub_total\": 10000,
    \"total\": 5000,
    \"tax\": 0,
    \"status\": \"ACTIVE\",
    \"frequency\": \"* * * * *\",
    \"limit_by\": \"COUNT\",
    \"limit_count\": \"5\",
    \"items\": [
        {
            \"name\": \"Apple Macbook\",
            \"description\": \"Powerful and light\",
            \"quantity\": 1,
            \"price\": 10000,
            \"item_id\": 5,
            \"sub_total\": 10000,
            \"total\": 10000,
            \"discount\": 0,
            \"discount_type\": \"fixed\",
            \"discount_val\": 0,
            \"unit_name\": \"box\"
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/recurring-invoices/20"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "starts_at": "2022-02-13",
    "send_automatically": false,
    "customer_id": 1,
    "exchange_rate": 1,
    "discount": 50,
    "discount_val": 5000,
    "sub_total": 10000,
    "total": 5000,
    "tax": 0,
    "status": "ACTIVE",
    "frequency": "* * * * *",
    "limit_by": "COUNT",
    "limit_count": "5",
    "items": [
        {
            "name": "Apple Macbook",
            "description": "Powerful and light",
            "quantity": 1,
            "price": 10000,
            "item_id": 5,
            "sub_total": 10000,
            "total": 10000,
            "discount": 0,
            "discount_type": "fixed",
            "discount_val": 0,
            "unit_name": "box"
        }
    ]
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/recurring-invoices/20',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'starts_at' => '2022-02-13',
            'send_automatically' => false,
            'customer_id' => 1,
            'exchange_rate' => 1,
            'discount' => 50,
            'discount_val' => 5000,
            'sub_total' => 10000,
            'total' => 5000,
            'tax' => 0,
            'status' => 'ACTIVE',
            'frequency' => '* * * * *',
            'limit_by' => 'COUNT',
            'limit_count' => '5',
            'items' => [
                [
                    'name' => 'Apple Macbook',
                    'description' => 'Powerful and light',
                    'quantity' => 1,
                    'price' => 10000,
                    'item_id' => 5,
                    'sub_total' => 10000,
                    'total' => 10000,
                    'discount' => 0,
                    'discount_type' => 'fixed',
                    'discount_val' => 0,
                    'unit_name' => 'box',
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/recurring-invoices/{id}

PATCH api/v1/recurring-invoices/{id}

URL Parameters

id  integer  

The ID of the recurring invoice.

Body Parameters

starts_at  string  

Starts At.

send_automatically  boolean  

Send Automatically.

customer_id  string  

Customer ID.

exchange_rate  string optional  

Exchange Rate (Only required when currency of customer is different than company currency).

discount  string  

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

discount_val  string  

Total discount amount in cents.

sub_total  string  

Subtotal amount of the invoice in cents.

total  string  

Total amount of the invoice in cents.

tax  string  

Total tax on the invoice in cents.

status  string  

Current Status. Must be one of ACTIVE, ON_HOLD, or COMPLETED.

frequency  string  

Frequency for creating invoices. Accepts CRON Format. You can find your format using a tool like: https://crontab.guru/.

limit_by  string  

Limit By Date or Count. Must be one of NONE, DATE, or COUNT.

limit_count  string optional  

Limit Count. This field is required when limit_by is COUNT.

limit_date  string optional  

Limit Date. This field is required when limit_by is DATE.

items  string[]  

Admin / Roles & Abilities

API Endpoints for managing roles & abilities

List all abilities

requires authentication

Returns a list of all abilities

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/abilities" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/abilities"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/abilities',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 1,
            "name": "view-customer",
            "entity_id": null,
            "entity_type": "Crater\\Models\\Customer",
            "only_owned": false,
            "options": [],
            "scope": 1
        },
        {
            "id": 1,
            "name": "view-customer",
            "entity_id": null,
            "entity_type": "Crater\\Models\\Customer",
            "only_owned": false,
            "options": [],
            "scope": 1
        }
    ]
}
 

Request   

GET api/v1/abilities

List all roles

requires authentication

Returns a list of all available roles

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/roles" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/roles"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/roles',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 1,
            "name": "super admin",
            "title": "Super Admin",
            "level": null,
            "formatted_created_at": "2022/02/12",
            "abilities": [
                {
                    "id": 1,
                    "name": "view-customer",
                    "title": "View customer customers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Customer",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 2,
                    "name": "create-customer",
                    "title": "Create customer customers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Customer",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 3,
                    "name": "edit-customer",
                    "title": "Edit customer customers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Customer",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 4,
                    "name": "delete-customer",
                    "title": "Delete customer customers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Customer",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 5,
                    "name": "view-item",
                    "title": "View item items",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Item",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 6,
                    "name": "create-item",
                    "title": "Create item items",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Item",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 7,
                    "name": "edit-item",
                    "title": "Edit item items",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Item",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 8,
                    "name": "delete-item",
                    "title": "Delete item items",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Item",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 9,
                    "name": "view-tax-type",
                    "title": "View tax type tax types",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\TaxType",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 10,
                    "name": "create-tax-type",
                    "title": "Create tax type tax types",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\TaxType",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 11,
                    "name": "edit-tax-type",
                    "title": "Edit tax type tax types",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\TaxType",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 12,
                    "name": "delete-tax-type",
                    "title": "Delete tax type tax types",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\TaxType",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 13,
                    "name": "view-estimate",
                    "title": "View estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 14,
                    "name": "create-estimate",
                    "title": "Create estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 15,
                    "name": "edit-estimate",
                    "title": "Edit estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 16,
                    "name": "delete-estimate",
                    "title": "Delete estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 17,
                    "name": "send-estimate",
                    "title": "Send estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 18,
                    "name": "view-invoice",
                    "title": "View invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 19,
                    "name": "create-invoice",
                    "title": "Create invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 20,
                    "name": "edit-invoice",
                    "title": "Edit invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 21,
                    "name": "delete-invoice",
                    "title": "Delete invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 22,
                    "name": "send-invoice",
                    "title": "Send invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 23,
                    "name": "view-recurring-invoice",
                    "title": "View recurring invoice recurring invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\RecurringInvoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 24,
                    "name": "create-recurring-invoice",
                    "title": "Create recurring invoice recurring invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\RecurringInvoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 25,
                    "name": "edit-recurring-invoice",
                    "title": "Edit recurring invoice recurring invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\RecurringInvoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 26,
                    "name": "delete-recurring-invoice",
                    "title": "Delete recurring invoice recurring invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\RecurringInvoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 27,
                    "name": "view-payment",
                    "title": "View payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 28,
                    "name": "create-payment",
                    "title": "Create payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 29,
                    "name": "edit-payment",
                    "title": "Edit payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 30,
                    "name": "delete-payment",
                    "title": "Delete payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 31,
                    "name": "send-payment",
                    "title": "Send payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 32,
                    "name": "view-expense",
                    "title": "View expense expenses",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Expense",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 33,
                    "name": "create-expense",
                    "title": "Create expense expenses",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Expense",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 34,
                    "name": "edit-expense",
                    "title": "Edit expense expenses",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Expense",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 35,
                    "name": "delete-expense",
                    "title": "Delete expense expenses",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Expense",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 36,
                    "name": "view-custom-field",
                    "title": "View custom field custom fields",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\CustomField",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 37,
                    "name": "create-custom-field",
                    "title": "Create custom field custom fields",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\CustomField",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 38,
                    "name": "edit-custom-field",
                    "title": "Edit custom field custom fields",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\CustomField",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 39,
                    "name": "delete-custom-field",
                    "title": "Delete custom field custom fields",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\CustomField",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 40,
                    "name": "view-financial-reports",
                    "title": "View financial reports",
                    "entity_id": null,
                    "entity_type": null,
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 41,
                    "name": "view-exchange-rate-provider",
                    "title": "View exchange rate provider exchange rate providers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\ExchangeRateProvider",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 42,
                    "name": "create-exchange-rate-provider",
                    "title": "Create exchange rate provider exchange rate providers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\ExchangeRateProvider",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 43,
                    "name": "edit-exchange-rate-provider",
                    "title": "Edit exchange rate provider exchange rate providers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\ExchangeRateProvider",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 44,
                    "name": "delete-exchange-rate-provider",
                    "title": "Delete exchange rate provider exchange rate providers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\ExchangeRateProvider",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 45,
                    "name": "dashboard",
                    "title": "Dashboard",
                    "entity_id": null,
                    "entity_type": null,
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 46,
                    "name": "view-all-notes",
                    "title": "View all notes notes",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Note",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 47,
                    "name": "manage-all-notes",
                    "title": "Manage all notes notes",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Note",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                }
            ]
        },
        {
            "id": 1,
            "name": "super admin",
            "title": "Super Admin",
            "level": null,
            "formatted_created_at": "2022/02/12",
            "abilities": [
                {
                    "id": 1,
                    "name": "view-customer",
                    "title": "View customer customers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Customer",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 2,
                    "name": "create-customer",
                    "title": "Create customer customers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Customer",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 3,
                    "name": "edit-customer",
                    "title": "Edit customer customers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Customer",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 4,
                    "name": "delete-customer",
                    "title": "Delete customer customers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Customer",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 5,
                    "name": "view-item",
                    "title": "View item items",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Item",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 6,
                    "name": "create-item",
                    "title": "Create item items",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Item",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 7,
                    "name": "edit-item",
                    "title": "Edit item items",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Item",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 8,
                    "name": "delete-item",
                    "title": "Delete item items",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Item",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 9,
                    "name": "view-tax-type",
                    "title": "View tax type tax types",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\TaxType",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 10,
                    "name": "create-tax-type",
                    "title": "Create tax type tax types",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\TaxType",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 11,
                    "name": "edit-tax-type",
                    "title": "Edit tax type tax types",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\TaxType",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 12,
                    "name": "delete-tax-type",
                    "title": "Delete tax type tax types",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\TaxType",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 13,
                    "name": "view-estimate",
                    "title": "View estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 14,
                    "name": "create-estimate",
                    "title": "Create estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 15,
                    "name": "edit-estimate",
                    "title": "Edit estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 16,
                    "name": "delete-estimate",
                    "title": "Delete estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 17,
                    "name": "send-estimate",
                    "title": "Send estimate estimates",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Estimate",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 18,
                    "name": "view-invoice",
                    "title": "View invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 19,
                    "name": "create-invoice",
                    "title": "Create invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 20,
                    "name": "edit-invoice",
                    "title": "Edit invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 21,
                    "name": "delete-invoice",
                    "title": "Delete invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 22,
                    "name": "send-invoice",
                    "title": "Send invoice invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Invoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 23,
                    "name": "view-recurring-invoice",
                    "title": "View recurring invoice recurring invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\RecurringInvoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 24,
                    "name": "create-recurring-invoice",
                    "title": "Create recurring invoice recurring invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\RecurringInvoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 25,
                    "name": "edit-recurring-invoice",
                    "title": "Edit recurring invoice recurring invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\RecurringInvoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 26,
                    "name": "delete-recurring-invoice",
                    "title": "Delete recurring invoice recurring invoices",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\RecurringInvoice",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 27,
                    "name": "view-payment",
                    "title": "View payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 28,
                    "name": "create-payment",
                    "title": "Create payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 29,
                    "name": "edit-payment",
                    "title": "Edit payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 30,
                    "name": "delete-payment",
                    "title": "Delete payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 31,
                    "name": "send-payment",
                    "title": "Send payment payments",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Payment",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 32,
                    "name": "view-expense",
                    "title": "View expense expenses",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Expense",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 33,
                    "name": "create-expense",
                    "title": "Create expense expenses",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Expense",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 34,
                    "name": "edit-expense",
                    "title": "Edit expense expenses",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Expense",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 35,
                    "name": "delete-expense",
                    "title": "Delete expense expenses",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Expense",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 36,
                    "name": "view-custom-field",
                    "title": "View custom field custom fields",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\CustomField",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 37,
                    "name": "create-custom-field",
                    "title": "Create custom field custom fields",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\CustomField",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 38,
                    "name": "edit-custom-field",
                    "title": "Edit custom field custom fields",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\CustomField",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 39,
                    "name": "delete-custom-field",
                    "title": "Delete custom field custom fields",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\CustomField",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 40,
                    "name": "view-financial-reports",
                    "title": "View financial reports",
                    "entity_id": null,
                    "entity_type": null,
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 41,
                    "name": "view-exchange-rate-provider",
                    "title": "View exchange rate provider exchange rate providers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\ExchangeRateProvider",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 42,
                    "name": "create-exchange-rate-provider",
                    "title": "Create exchange rate provider exchange rate providers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\ExchangeRateProvider",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 43,
                    "name": "edit-exchange-rate-provider",
                    "title": "Edit exchange rate provider exchange rate providers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\ExchangeRateProvider",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 44,
                    "name": "delete-exchange-rate-provider",
                    "title": "Delete exchange rate provider exchange rate providers",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\ExchangeRateProvider",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 45,
                    "name": "dashboard",
                    "title": "Dashboard",
                    "entity_id": null,
                    "entity_type": null,
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 46,
                    "name": "view-all-notes",
                    "title": "View all notes notes",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Note",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                },
                {
                    "id": 47,
                    "name": "manage-all-notes",
                    "title": "Manage all notes notes",
                    "entity_id": null,
                    "entity_type": "Crater\\Models\\Note",
                    "only_owned": false,
                    "options": [],
                    "scope": 1,
                    "created_at": "2022-02-12T10:10:34.000000Z",
                    "updated_at": "2022-02-12T10:10:34.000000Z"
                }
            ]
        }
    ]
}
 

Request   

GET api/v1/roles

Create a role

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/roles" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"Accountant\",
    \"abilities\": [
        {
            \"ability\": \"view-invoice\",
            \"model\": \"Crater\\\\Models\\\\Invoice\"
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/roles"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "Accountant",
    "abilities": [
        {
            "ability": "view-invoice",
            "model": "Crater\\Models\\Invoice"
        }
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/roles',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'Accountant',
            'abilities' => [
                [
                    'ability' => 'view-invoice',
                    'model' => 'Crater\\Models\\Invoice',
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/roles

Body Parameters

name  string  

Name of the role.

abilities  object[] optional  

abilities[].ability  string  

Slug of the ability.

abilities[].model  string  

Model Name of the ability.

Retrieve a role

requires authentication

Retrieves a Role object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/roles/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/roles/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/roles/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 1,
        "name": "super admin",
        "title": "Super Admin",
        "level": null,
        "formatted_created_at": "2022/02/12",
        "abilities": [
            {
                "id": 1,
                "name": "view-customer",
                "title": "View customer customers",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Customer",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 2,
                "name": "create-customer",
                "title": "Create customer customers",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Customer",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 3,
                "name": "edit-customer",
                "title": "Edit customer customers",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Customer",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 4,
                "name": "delete-customer",
                "title": "Delete customer customers",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Customer",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 5,
                "name": "view-item",
                "title": "View item items",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Item",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 6,
                "name": "create-item",
                "title": "Create item items",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Item",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 7,
                "name": "edit-item",
                "title": "Edit item items",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Item",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 8,
                "name": "delete-item",
                "title": "Delete item items",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Item",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 9,
                "name": "view-tax-type",
                "title": "View tax type tax types",
                "entity_id": null,
                "entity_type": "Crater\\Models\\TaxType",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 10,
                "name": "create-tax-type",
                "title": "Create tax type tax types",
                "entity_id": null,
                "entity_type": "Crater\\Models\\TaxType",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 11,
                "name": "edit-tax-type",
                "title": "Edit tax type tax types",
                "entity_id": null,
                "entity_type": "Crater\\Models\\TaxType",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 12,
                "name": "delete-tax-type",
                "title": "Delete tax type tax types",
                "entity_id": null,
                "entity_type": "Crater\\Models\\TaxType",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 13,
                "name": "view-estimate",
                "title": "View estimate estimates",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Estimate",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 14,
                "name": "create-estimate",
                "title": "Create estimate estimates",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Estimate",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 15,
                "name": "edit-estimate",
                "title": "Edit estimate estimates",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Estimate",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 16,
                "name": "delete-estimate",
                "title": "Delete estimate estimates",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Estimate",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 17,
                "name": "send-estimate",
                "title": "Send estimate estimates",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Estimate",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 18,
                "name": "view-invoice",
                "title": "View invoice invoices",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Invoice",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 19,
                "name": "create-invoice",
                "title": "Create invoice invoices",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Invoice",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 20,
                "name": "edit-invoice",
                "title": "Edit invoice invoices",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Invoice",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 21,
                "name": "delete-invoice",
                "title": "Delete invoice invoices",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Invoice",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 22,
                "name": "send-invoice",
                "title": "Send invoice invoices",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Invoice",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 23,
                "name": "view-recurring-invoice",
                "title": "View recurring invoice recurring invoices",
                "entity_id": null,
                "entity_type": "Crater\\Models\\RecurringInvoice",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 24,
                "name": "create-recurring-invoice",
                "title": "Create recurring invoice recurring invoices",
                "entity_id": null,
                "entity_type": "Crater\\Models\\RecurringInvoice",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 25,
                "name": "edit-recurring-invoice",
                "title": "Edit recurring invoice recurring invoices",
                "entity_id": null,
                "entity_type": "Crater\\Models\\RecurringInvoice",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 26,
                "name": "delete-recurring-invoice",
                "title": "Delete recurring invoice recurring invoices",
                "entity_id": null,
                "entity_type": "Crater\\Models\\RecurringInvoice",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 27,
                "name": "view-payment",
                "title": "View payment payments",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Payment",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 28,
                "name": "create-payment",
                "title": "Create payment payments",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Payment",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 29,
                "name": "edit-payment",
                "title": "Edit payment payments",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Payment",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 30,
                "name": "delete-payment",
                "title": "Delete payment payments",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Payment",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 31,
                "name": "send-payment",
                "title": "Send payment payments",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Payment",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 32,
                "name": "view-expense",
                "title": "View expense expenses",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Expense",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 33,
                "name": "create-expense",
                "title": "Create expense expenses",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Expense",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 34,
                "name": "edit-expense",
                "title": "Edit expense expenses",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Expense",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 35,
                "name": "delete-expense",
                "title": "Delete expense expenses",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Expense",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 36,
                "name": "view-custom-field",
                "title": "View custom field custom fields",
                "entity_id": null,
                "entity_type": "Crater\\Models\\CustomField",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 37,
                "name": "create-custom-field",
                "title": "Create custom field custom fields",
                "entity_id": null,
                "entity_type": "Crater\\Models\\CustomField",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 38,
                "name": "edit-custom-field",
                "title": "Edit custom field custom fields",
                "entity_id": null,
                "entity_type": "Crater\\Models\\CustomField",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 39,
                "name": "delete-custom-field",
                "title": "Delete custom field custom fields",
                "entity_id": null,
                "entity_type": "Crater\\Models\\CustomField",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 40,
                "name": "view-financial-reports",
                "title": "View financial reports",
                "entity_id": null,
                "entity_type": null,
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 41,
                "name": "view-exchange-rate-provider",
                "title": "View exchange rate provider exchange rate providers",
                "entity_id": null,
                "entity_type": "Crater\\Models\\ExchangeRateProvider",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 42,
                "name": "create-exchange-rate-provider",
                "title": "Create exchange rate provider exchange rate providers",
                "entity_id": null,
                "entity_type": "Crater\\Models\\ExchangeRateProvider",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 43,
                "name": "edit-exchange-rate-provider",
                "title": "Edit exchange rate provider exchange rate providers",
                "entity_id": null,
                "entity_type": "Crater\\Models\\ExchangeRateProvider",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 44,
                "name": "delete-exchange-rate-provider",
                "title": "Delete exchange rate provider exchange rate providers",
                "entity_id": null,
                "entity_type": "Crater\\Models\\ExchangeRateProvider",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 45,
                "name": "dashboard",
                "title": "Dashboard",
                "entity_id": null,
                "entity_type": null,
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 46,
                "name": "view-all-notes",
                "title": "View all notes notes",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Note",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            },
            {
                "id": 47,
                "name": "manage-all-notes",
                "title": "Manage all notes notes",
                "entity_id": null,
                "entity_type": "Crater\\Models\\Note",
                "only_owned": false,
                "options": [],
                "scope": 1,
                "created_at": "2022-02-12T10:10:34.000000Z",
                "updated_at": "2022-02-12T10:10:34.000000Z"
            }
        ]
    }
}
 

Request   

GET api/v1/roles/{id}

URL Parameters

id  integer  

The ID of the role.

Update a role

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/roles/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"Accountant\",
    \"abilities\": [
        {
            \"ability\": \"view-invoice\",
            \"model\": \"Crater\\\\Models\\\\Invoice\"
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/roles/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "Accountant",
    "abilities": [
        {
            "ability": "view-invoice",
            "model": "Crater\\Models\\Invoice"
        }
    ]
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/roles/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'Accountant',
            'abilities' => [
                [
                    'ability' => 'view-invoice',
                    'model' => 'Crater\\Models\\Invoice',
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/roles/{id}

PATCH api/v1/roles/{id}

URL Parameters

id  integer  

The ID of the role.

Body Parameters

name  string  

Name of the role.

abilities  object[] optional  

abilities[].ability  string  

Slug of the ability.

abilities[].model  string  

Model Name of the ability.

Delete a role

requires authentication

Permanently deletes a role. Note: You cannot delete a role which is already being used on a user. You must detach the role first.

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/roles/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/roles/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/roles/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

DELETE api/v1/roles/{id}

URL Parameters

id  integer  

The ID of the role.

Admin / Settings

Get app settings

requires authentication

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/settings" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"key\": \"quia\"
}"
const url = new URL(
    "http://crater.test/api/v1/settings"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "key": "quia"
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/settings',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'key' => 'quia',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 161
 

{
    "quia": null
}
 

Request   

GET api/v1/settings

Body Parameters

key  string  

Update app settings

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/settings" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"settings\": \"incidunt\"
}"
const url = new URL(
    "http://crater.test/api/v1/settings"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "settings": "incidunt"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/settings',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'settings' => 'incidunt',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/settings

Body Parameters

settings  string  

Admin / 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 "http://crater.test/api/v1/tax-types" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/tax-types"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/tax-types',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 10,
            "name": "nihil",
            "percent": 62,
            "type": null,
            "compound_tax": false,
            "collective_tax": 0,
            "description": "Qui est et iure quia qui molestias. Maxime sed quisquam culpa recusandae. Voluptatem enim sed distinctio consequatur et et ullam accusantium. Tempore rerum iure eos sunt praesentium.",
            "company_id": 1
        },
        {
            "id": 11,
            "name": "magni",
            "percent": 14,
            "type": null,
            "compound_tax": false,
            "collective_tax": 0,
            "description": "Dolore ab ratione dolorum modi unde molestiae tempora. Consequatur dolorem tenetur ipsa reiciendis. Iusto quae omnis et est ducimus. Assumenda itaque molestiae et dignissimos pariatur voluptate.",
            "company_id": 1
        }
    ]
}
 

Request   

GET api/v1/tax-types

Create a tax type

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/tax-types" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"aspernatur\",
    \"percent\": \"recusandae\"
}"
const url = new URL(
    "http://crater.test/api/v1/tax-types"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "aspernatur",
    "percent": "recusandae"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/tax-types',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'aspernatur',
            'percent' => 'recusandae',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/tax-types

Body Parameters

name  string  

percent  string  

description  string optional  

compound_tax  string optional  

collective_tax  string optional  

Retrieve a tax type

requires authentication

Retrieves a Tax type object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/tax-types/18" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/tax-types/18"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/tax-types/18',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 12,
        "name": "dolorum",
        "percent": 39,
        "type": null,
        "compound_tax": false,
        "collective_tax": 0,
        "description": "Veniam tempora non pariatur laboriosam distinctio consequatur et. Vel quae dignissimos dolores ut. Non voluptatem officiis adipisci neque velit sapiente.",
        "company_id": 1
    }
}
 

Request   

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

URL Parameters

id  integer  

The ID of the tax type.

Update a tax type

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/tax-types/16" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"amet\",
    \"percent\": \"aut\"
}"
const url = new URL(
    "http://crater.test/api/v1/tax-types/16"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "amet",
    "percent": "aut"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/tax-types/16',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'amet',
            'percent' => 'aut',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

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

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

URL Parameters

id  integer  

The ID of the tax type.

Body Parameters

name  string  

percent  string  

description  string optional  

compound_tax  string optional  

collective_tax  string optional  

Delete a tax type

requires authentication

Example request:
curl --request DELETE \
    "http://crater.test/api/v1/tax-types/4" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/tax-types/4"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
    'http://crater.test/api/v1/tax-types/4',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

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

URL Parameters

id  integer  

The ID of the tax type.

Admin / Users

API Endpoints for managing users

Delete users

requires authentication

Delete one or more users by passing an array of ids for users you wish to delete.

Example request:
curl --request POST \
    "http://crater.test/api/v1/users/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"users\": [
        1,
        2
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/users/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "users": [
        1,
        2
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/users/delete',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'users' => [
                1,
                2,
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/users/delete

Body Parameters

users  string[]  

List all users

requires authentication

Returns a list of your users.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/users" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/users"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/users',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 8,
            "name": "Clemens Nicolas",
            "email": "aschultz@example.net",
            "phone": "1-640-825-9370",
            "role": "super admin",
            "contact_name": "Elmo Rippin",
            "company_name": "McCullough-Cormier",
            "website": "http://www.torp.com/quos-qui-saepe-voluptate",
            "enable_portal": true,
            "currency_id": 1,
            "facebook_id": null,
            "google_id": null,
            "github_id": null,
            "created_at": "2022-03-14T09:35:46.000000Z",
            "updated_at": "2022-03-14T09:35:46.000000Z",
            "avatar": 0,
            "is_owner": false,
            "roles": [],
            "formatted_created_at": ""
        },
        {
            "id": 9,
            "name": "Prof. Prudence Boyle IV",
            "email": "feest.maverick@example.org",
            "phone": "915-816-0432 x81758",
            "role": "super admin",
            "contact_name": "Dr. Giuseppe Trantow Sr.",
            "company_name": "Hettinger and Sons",
            "website": "http://monahan.info/voluptatibus-aut-dolores-veniam-iste-sit-ut-accusantium-aut",
            "enable_portal": true,
            "currency_id": 1,
            "facebook_id": null,
            "google_id": null,
            "github_id": null,
            "created_at": "2022-03-14T09:35:46.000000Z",
            "updated_at": "2022-03-14T09:35:46.000000Z",
            "avatar": 0,
            "is_owner": false,
            "roles": [],
            "formatted_created_at": ""
        }
    ]
}
 

Request   

GET api/v1/users

Create a user

requires authentication

Example request:
curl --request POST \
    "http://crater.test/api/v1/users" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"deleniti\",
    \"email\": \"ycruickshank@example.com\",
    \"password\": \"awnxbrsh\",
    \"companies\": [
        {
            \"id\": \"possimus\",
            \"role\": \"explicabo\"
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/users"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "deleniti",
    "email": "ycruickshank@example.com",
    "password": "awnxbrsh",
    "companies": [
        {
            "id": "possimus",
            "role": "explicabo"
        }
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/users',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'deleniti',
            'email' => 'ycruickshank@example.com',
            'password' => 'awnxbrsh',
            'companies' => [
                [
                    'id' => 'possimus',
                    'role' => 'explicabo',
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/users

Body Parameters

name  string  

email  string  

Must be a valid email address.

phone  string optional  

password  string  

Must be at least 8 characters.

companies  object[] optional  

companies[].id  string  

companies[].role  string  

Retrieve a user

requires authentication

Retrieves a User object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/users/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/users/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/users/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 16,
        "name": "Miss Roma Hahn I",
        "email": null,
        "phone": null,
        "role": null,
        "contact_name": null,
        "company_name": null,
        "website": null,
        "enable_portal": null,
        "currency_id": 1,
        "facebook_id": null,
        "google_id": null,
        "github_id": null,
        "created_at": "2022-03-14T09:35:46.000000Z",
        "updated_at": "2022-03-14T09:35:46.000000Z",
        "avatar": null,
        "is_owner": null,
        "roles": null,
        "formatted_created_at": ""
    }
}
 

Request   

GET api/v1/users/{id}

URL Parameters

id  integer  

The ID of the user.

Update a user

requires authentication

Example request:
curl --request PUT \
    "http://crater.test/api/v1/users/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1" \
    --data "{
    \"name\": \"eius\",
    \"email\": \"treutel.don@example.org\",
    \"password\": \"r\",
    \"companies\": [
        {
            \"id\": \"sed\",
            \"role\": \"vel\"
        }
    ]
}"
const url = new URL(
    "http://crater.test/api/v1/users/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

let body = {
    "name": "eius",
    "email": "treutel.don@example.org",
    "password": "r",
    "companies": [
        {
            "id": "sed",
            "role": "vel"
        }
    ]
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
    'http://crater.test/api/v1/users/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
        'json' => [
            'name' => 'eius',
            'email' => 'treutel.don@example.org',
            'password' => 'r',
            'companies' => [
                [
                    'id' => 'sed',
                    'role' => 'vel',
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

PUT api/v1/users/{id}

PATCH api/v1/users/{id}

URL Parameters

id  integer  

The ID of the user.

Body Parameters

name  string  

email  string  

Must be a valid email address.

phone  string optional  

password  string  

Must be at least 8 characters.

companies  object[] optional  

companies[].id  string  

companies[].role  string  

Customer / Authentication

API Endpoints for Customer Authentication / Token Management

Customer Login

Crater uses API Tokens for authentication. The endpoint will return the plain-text API token which may then be stored and used to make additional API requests.

Example request:
curl --request POST \
    "http://crater.test/api/v1/your-company-slug/customer/auth/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"username\": \"johndoe@craterapp.com\",
    \"password\": \"password\",
    \"device_name\": \"mobile_app\"
}"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/auth/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "username": "johndoe@craterapp.com",
    "password": "password",
    "device_name": "mobile_app"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/your-company-slug/customer/auth/login',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'username' => 'johndoe@craterapp.com',
            'password' => 'password',
            'device_name' => 'mobile_app',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/{company_slug}/customer/auth/login

URL Parameters

company_slug  string optional  

Company Slug.

Body Parameters

username  string  

Email ID of the user.

password  string  

Password of the user.

device_name  string  

Any Device name identifier.

Customer Logout

requires authentication

This will invalidate the API Token so it cannot be used anymore.

Example request:
curl --request POST \
    "http://crater.test/api/v1/your-company-slug/customer/auth/logout" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/auth/logout"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/your-company-slug/customer/auth/logout',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/{company_slug}/customer/auth/logout

URL Parameters

company_slug  string optional  

Company Slug.

Customer / Estimates

API Endpoints for fetching customer's estimates

Accept an estimate.

requires authentication

This endpoint can be used to mark an estimate as accepted.

Example request:
curl --request POST \
    "http://crater.test/api/v1/your-company-slug/customer/estimate/15/status" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/estimate/15/status"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/your-company-slug/customer/estimate/15/status',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/{company_slug}/customer/estimate/{estimate}/status

URL Parameters

company_slug  string optional  

Company Slug.

estimate  integer  

List all estimates for customer

requires authentication

Returns a list of estimates for the current customer.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/estimates" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/estimates"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/estimates',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 22,
            "estimate_date": "1992-10-28T18:30:00.000000Z",
            "expiry_date": "1978-10-30T18:30:00.000000Z",
            "estimate_number": "EST-000001",
            "status": "DRAFT",
            "reference_number": "EST-000001",
            "tax_per_item": "YES",
            "discount_per_item": "No",
            "notes": "Eligendi quae voluptatem perferendis perferendis sunt corporis.",
            "discount": 7,
            "discount_type": "fixed",
            "discount_val": 7,
            "sub_total": 5,
            "total": 2,
            "tax": 1,
            "unique_hash": "dVeUGUuP3Vpex5g1phCtL5tra2omrjjtazaj9Ik35hZZjVNrDWXkjuY45jUM",
            "template_name": "estimate1",
            "customer_id": 136,
            "exchange_rate": 3,
            "base_discount_val": 1,
            "base_sub_total": 6,
            "base_total": 1,
            "base_tax": 4,
            "currency_id": 1,
            "formatted_expiry_date": "1978/10/31",
            "formatted_estimate_date": "1992/10/29",
            "estimate_pdf_url": "http://crater.test/estimates/pdf/dVeUGUuP3Vpex5g1phCtL5tra2omrjjtazaj9Ik35hZZjVNrDWXkjuY45jUM"
        },
        {
            "id": 23,
            "estimate_date": "1970-06-05T18:30:00.000000Z",
            "expiry_date": "1996-04-26T18:30:00.000000Z",
            "estimate_number": "EST-000002",
            "status": "DRAFT",
            "reference_number": "EST-000002",
            "tax_per_item": "YES",
            "discount_per_item": "No",
            "notes": "Laboriosam sit nesciunt repudiandae id. Et ea odio aspernatur.",
            "discount": 8,
            "discount_type": "fixed",
            "discount_val": 8,
            "sub_total": 7,
            "total": 8,
            "tax": 6,
            "unique_hash": "gypsMcZKCqUel8TlErXllMUVEzMU5hq3dnnl1jcn4ZdQQkfvqxQC4tH4ctvc",
            "template_name": "estimate1",
            "customer_id": 137,
            "exchange_rate": 8,
            "base_discount_val": 2,
            "base_sub_total": 7,
            "base_total": 8,
            "base_tax": 3,
            "currency_id": 1,
            "formatted_expiry_date": "1996/04/27",
            "formatted_estimate_date": "1970/06/06",
            "estimate_pdf_url": "http://crater.test/estimates/pdf/gypsMcZKCqUel8TlErXllMUVEzMU5hq3dnnl1jcn4ZdQQkfvqxQC4tH4ctvc"
        }
    ]
}
 

Request   

GET api/v1/{company_slug}/customer/estimates

URL Parameters

company_slug  string optional  

Company Slug.

Retrieve a customer estimate

requires authentication

Retrieves a customer's estimate object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/estimates/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/estimates/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/estimates/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 24,
        "estimate_date": "2008-02-15T18:30:00.000000Z",
        "expiry_date": "2020-06-23T18:30:00.000000Z",
        "estimate_number": "EST-000001",
        "status": "DRAFT",
        "reference_number": "EST-000001",
        "tax_per_item": "YES",
        "discount_per_item": "No",
        "notes": "Amet quo saepe illum. Voluptate dignissimos ex odit omnis nisi.",
        "discount": 2.88,
        "discount_type": "percentage",
        "discount_val": 36,
        "sub_total": 8,
        "total": 8,
        "tax": 3,
        "unique_hash": "JpsHMW4y1xHnFn5PN2jigITpbdyP67zCQPdyzZ1ybDkC7pFV28HouGkmS1dl",
        "template_name": "estimate1",
        "customer_id": 138,
        "exchange_rate": 6,
        "base_discount_val": 6,
        "base_sub_total": 2,
        "base_total": 9,
        "base_tax": 4,
        "currency_id": 1,
        "formatted_expiry_date": "2020/06/24",
        "formatted_estimate_date": "2008/02/16",
        "estimate_pdf_url": "http://crater.test/estimates/pdf/JpsHMW4y1xHnFn5PN2jigITpbdyP67zCQPdyzZ1ybDkC7pFV28HouGkmS1dl"
    }
}
 

Request   

GET api/v1/{company_slug}/customer/estimates/{id}

URL Parameters

company_slug  string optional  

Company Slug.

id  integer  

The ID of the estimate.

Customer / Expenses

API Endpoints for fetching customer's expenses

List all expenses for customer

requires authentication

Returns a list of expenses for the current customer.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/expenses" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/expenses"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/expenses',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 22,
            "expense_date": "2009-01-24T18:30:00.000000Z",
            "amount": 4,
            "notes": "Voluptatem ut dicta soluta omnis. Tempora quisquam doloribus est et. Fugit voluptatem nostrum fugit quasi. Quia nesciunt quia quam vero in voluptatem.",
            "customer_id": 142,
            "attachment_receipt_url": null,
            "attachment_receipt": null,
            "attachment_receipt_meta": null,
            "company_id": 1,
            "expense_category_id": 34,
            "formatted_expense_date": "2009/01/25",
            "formatted_created_at": "2022/03/14",
            "exchange_rate": 1,
            "currency_id": 1,
            "base_amount": 3,
            "payment_method_id": null
        },
        {
            "id": 23,
            "expense_date": "1977-12-28T18:30:00.000000Z",
            "amount": 1,
            "notes": "Dolor sunt omnis deleniti atque fugit rerum sint. Optio ratione soluta illo omnis magnam quia.",
            "customer_id": 143,
            "attachment_receipt_url": null,
            "attachment_receipt": null,
            "attachment_receipt_meta": null,
            "company_id": 1,
            "expense_category_id": 35,
            "formatted_expense_date": "1977/12/29",
            "formatted_created_at": "2022/03/14",
            "exchange_rate": 4,
            "currency_id": 1,
            "base_amount": 4,
            "payment_method_id": null
        }
    ]
}
 

Request   

GET api/v1/{company_slug}/customer/expenses

URL Parameters

company_slug  string optional  

Company Slug.

Retrieve a customer expense

requires authentication

Retrieves a customer's Expense object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/expenses/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/expenses/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/expenses/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 24,
        "expense_date": "1982-08-18T18:30:00.000000Z",
        "amount": 5,
        "notes": "Laudantium est nihil ad necessitatibus. Fuga quis qui quidem eos non aut.",
        "customer_id": 144,
        "attachment_receipt_url": null,
        "attachment_receipt": null,
        "attachment_receipt_meta": null,
        "company_id": 1,
        "expense_category_id": 36,
        "formatted_expense_date": "1982/08/19",
        "formatted_created_at": "2022/03/14",
        "exchange_rate": 8,
        "currency_id": 1,
        "base_amount": 4,
        "payment_method_id": null
    }
}
 

Request   

GET api/v1/{company_slug}/customer/expenses/{id}

URL Parameters

company_slug  string optional  

Company Slug.

id  integer  

The ID of the expense.

Customer / General

Bootstrap

requires authentication

This endpoint is used to retrieve all the basic required data when the customer logs in. It's mainly used to prevent additional unnecessary requests.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/bootstrap" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/bootstrap"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/bootstrap',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
 "data":
  {
      "current_user": {},
  },
 "meta": {menu: [], current_customer_currency: {}, modules: []}
}
 

Request   

GET api/v1/{company_slug}/customer/bootstrap

URL Parameters

company_slug  string optional  

Company Slug.

Customer / Invoices

API Endpoints for fetching customer's invoices

List all invoices for customer

requires authentication

Returns a list of invoices for the current customer.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/invoices" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/invoices"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/invoices',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 22,
            "invoice_date": "1977-09-27T18:30:00.000000Z",
            "due_date": "2010-02-08T18:30:00.000000Z",
            "invoice_number": "INV-000001",
            "reference_number": "INV-000001",
            "status": "DRAFT",
            "paid_status": "UNPAID",
            "tax_per_item": "NO",
            "discount_per_item": "NO",
            "notes": "Ut enim neque explicabo blanditiis in culpa rerum magnam.",
            "discount_type": "fixed",
            "discount": 2,
            "discount_val": 2,
            "sub_total": 5,
            "total": 5,
            "tax": 4,
            "due_amount": 5,
            "sent": null,
            "viewed": null,
            "unique_hash": "JQX0bBlEC6gyV9cKYfg8bXoUCxfpqOuwRmE6IY9VoDfMfAbn5opDcPVexJr6",
            "template_name": "invoice1",
            "customer_id": 130,
            "recurring_invoice_id": 34,
            "sequence_number": 1,
            "base_discount_val": 8,
            "base_sub_total": 3,
            "base_total": 7,
            "base_tax": 6,
            "base_due_amount": 6,
            "currency_id": 1,
            "formatted_created_at": "2022/03/14",
            "formatted_notes": "Ut enim neque explicabo blanditiis in culpa rerum magnam.",
            "invoice_pdf_url": "http://crater.test/invoices/pdf/JQX0bBlEC6gyV9cKYfg8bXoUCxfpqOuwRmE6IY9VoDfMfAbn5opDcPVexJr6",
            "formatted_invoice_date": "1977/09/28",
            "formatted_due_date": "2010/02/09",
            "payment_module_enabled": false
        },
        {
            "id": 23,
            "invoice_date": "1992-01-10T18:30:00.000000Z",
            "due_date": "1984-06-23T18:30:00.000000Z",
            "invoice_number": "INV-000002",
            "reference_number": "INV-000002",
            "status": "DRAFT",
            "paid_status": "UNPAID",
            "tax_per_item": "NO",
            "discount_per_item": "NO",
            "notes": "Nihil esse illo nostrum quas. Omnis qui qui esse est omnis qui rem.",
            "discount_type": "fixed",
            "discount": 1,
            "discount_val": 1,
            "sub_total": 4,
            "total": 5,
            "tax": 3,
            "due_amount": 5,
            "sent": null,
            "viewed": null,
            "unique_hash": "2Cv0iSIHVt7CCvgE8TecghUUFFwziqm51D4Nw8AJR0E290dtw1ZOlOtRdWbU",
            "template_name": "invoice1",
            "customer_id": 132,
            "recurring_invoice_id": 35,
            "sequence_number": 2,
            "base_discount_val": 1,
            "base_sub_total": 3,
            "base_total": 1,
            "base_tax": 7,
            "base_due_amount": 6,
            "currency_id": 1,
            "formatted_created_at": "2022/03/14",
            "formatted_notes": "Nihil esse illo nostrum quas. Omnis qui qui esse est omnis qui rem.",
            "invoice_pdf_url": "http://crater.test/invoices/pdf/2Cv0iSIHVt7CCvgE8TecghUUFFwziqm51D4Nw8AJR0E290dtw1ZOlOtRdWbU",
            "formatted_invoice_date": "1992/01/11",
            "formatted_due_date": "1984/06/24",
            "payment_module_enabled": false
        }
    ]
}
 

Request   

GET api/v1/{company_slug}/customer/invoices

URL Parameters

company_slug  string optional  

Company Slug.

Retrieve a customer invoice

requires authentication

Retrieves a customer's Invoice object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/invoices/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/invoices/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/invoices/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 24,
        "invoice_date": "1970-01-07T18:30:00.000000Z",
        "due_date": "1982-07-14T18:30:00.000000Z",
        "invoice_number": "INV-000001",
        "reference_number": "INV-000001",
        "status": "DRAFT",
        "paid_status": "UNPAID",
        "tax_per_item": "NO",
        "discount_per_item": "NO",
        "notes": "Perferendis quia corrupti qui neque nam nesciunt.",
        "discount_type": "percentage",
        "discount": 2.75,
        "discount_val": 55,
        "sub_total": 6,
        "total": 5,
        "tax": 5,
        "due_amount": 5,
        "sent": null,
        "viewed": null,
        "unique_hash": "77LvXzFtd0kd57jZEbneA2hDSiNe0bZYwoMKgEZjiGUM4qus5x4vlgkoQrps",
        "template_name": "invoice1",
        "customer_id": 134,
        "recurring_invoice_id": 36,
        "sequence_number": 1,
        "base_discount_val": 9,
        "base_sub_total": 6,
        "base_total": 8,
        "base_tax": 9,
        "base_due_amount": 7,
        "currency_id": 1,
        "formatted_created_at": "2022/03/14",
        "formatted_notes": "Perferendis quia corrupti qui neque nam nesciunt.",
        "invoice_pdf_url": "http://crater.test/invoices/pdf/77LvXzFtd0kd57jZEbneA2hDSiNe0bZYwoMKgEZjiGUM4qus5x4vlgkoQrps",
        "formatted_invoice_date": "1970/01/08",
        "formatted_due_date": "1982/07/15",
        "payment_module_enabled": false
    }
}
 

Request   

GET api/v1/{company_slug}/customer/invoices/{id}

URL Parameters

company_slug  string optional  

Company Slug.

id  integer  

The ID of the invoice.

Customer / Payments

API Endpoints for fetching customer's payments

List all payments for customer

requires authentication

Returns a list of payments for the current customer.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/payments" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/payments"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/payments',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 22,
            "payment_number": "PAY-000001",
            "payment_date": "1994-07-01T18:30:00.000000Z",
            "notes": "Repellat ratione consequuntur nostrum in inventore.",
            "amount": 3,
            "unique_hash": "0pTk2RLufB3rpCq3WyhlMy335VAVIkUKYJtNuJNiTeooLNEfTNxi2rhtanDR",
            "invoice_id": null,
            "company_id": 1,
            "payment_method_id": 1,
            "customer_id": 139,
            "exchange_rate": null,
            "base_amount": 8,
            "currency_id": 1,
            "transaction_id": null,
            "formatted_created_at": "2022/03/14",
            "formatted_payment_date": "1994/07/02",
            "payment_pdf_url": "http://crater.test/payments/pdf/0pTk2RLufB3rpCq3WyhlMy335VAVIkUKYJtNuJNiTeooLNEfTNxi2rhtanDR"
        },
        {
            "id": 23,
            "payment_number": "PAY-000002",
            "payment_date": "2001-02-22T18:30:00.000000Z",
            "notes": "Animi porro laudantium exercitationem aliquid. Aspernatur enim qui ut quis.",
            "amount": 2,
            "unique_hash": "Tx8vc16efTFzBs6iUDo8wTMELY7GshOcfLckbnP47lVEJXkNx7f7v1BFezS7",
            "invoice_id": null,
            "company_id": 1,
            "payment_method_id": 1,
            "customer_id": 140,
            "exchange_rate": null,
            "base_amount": 2,
            "currency_id": 1,
            "transaction_id": null,
            "formatted_created_at": "2022/03/14",
            "formatted_payment_date": "2001/02/23",
            "payment_pdf_url": "http://crater.test/payments/pdf/Tx8vc16efTFzBs6iUDo8wTMELY7GshOcfLckbnP47lVEJXkNx7f7v1BFezS7"
        }
    ]
}
 

Request   

GET api/v1/{company_slug}/customer/payments

URL Parameters

company_slug  string optional  

Company Slug.

Retrieve a customer payment

requires authentication

Retrieves a customer's Payment object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/quas/customer/payments/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/quas/customer/payments/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/quas/customer/payments/1',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": {
        "id": 24,
        "payment_number": "PAY-000001",
        "payment_date": "1997-03-14T18:30:00.000000Z",
        "notes": "Beatae neque dolorem sed repellat ut repellat nisi autem.",
        "amount": 5,
        "unique_hash": "VxJjHG4SWY8Nauv5DqKcdTJz8IzhL7RLQ89kB4ArC04yd3wzKEnSJ6vDlAY5",
        "invoice_id": null,
        "company_id": 1,
        "payment_method_id": 1,
        "customer_id": 141,
        "exchange_rate": null,
        "base_amount": 8,
        "currency_id": 1,
        "transaction_id": null,
        "formatted_created_at": "2022/03/14",
        "formatted_payment_date": "1997/03/15",
        "payment_pdf_url": "http://crater.test/payments/pdf/VxJjHG4SWY8Nauv5DqKcdTJz8IzhL7RLQ89kB4ArC04yd3wzKEnSJ6vDlAY5"
    }
}
 

Request   

GET api/v1/{company_slug}/customer/payments/{id}

URL Parameters

company_slug  string  

id  integer  

The ID of the payment.

List all payment methods for the customer

requires authentication

Returns a list of payment methods available for the current customer.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/payment-method" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/payment-method"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/payment-method',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 23,
            "name": "Coby Stokes",
            "company_id": 1
        },
        {
            "id": 24,
            "name": "Dr. Tiara Metz",
            "company_id": 1
        }
    ]
}
 

Request   

GET api/v1/{company_slug}/customer/payment-method

URL Parameters

company_slug  string optional  

Company Slug.

Customer / Profile

API Endpoints for Customer Profile Management

Update customer profile

requires authentication

Allows updating customer's profile information such as billing address, shipping address and avatar.

Example request:
curl --request POST \
    "http://crater.test/api/v1/your-company-slug/customer/profile" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --form "password=" \
    --form "email=leopoldo75@example.com" \
    --form "customer_avatar=@/tmp/phpsGnGop" 
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/profile"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('password', '');
body.append('email', 'leopoldo75@example.com');
body.append('customer_avatar', document.querySelector('input[name="customer_avatar"]').files[0]);

fetch(url, {
    method: "POST",
    headers,
    body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'http://crater.test/api/v1/your-company-slug/customer/profile',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'multipart/form-data',
            'Accept' => 'application/json',
        ],
        'multipart' => [
            [
                'name' => 'password',
                'contents' => ''
            ],
            [
                'name' => 'email',
                'contents' => 'leopoldo75@example.com'
            ],
            [
                'name' => 'customer_avatar',
                'contents' => fopen('/tmp/phpsGnGop', 'r')
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request   

POST api/v1/{company_slug}/customer/profile

URL Parameters

company_slug  string optional  

Company Slug.

Body Parameters

name  string optional  

password  string optional  

Must be at least 8 characters.

email  string optional  

Must be a valid email address.

billing  object optional  

billing.name  string optional  

billing.address_street_1  string optional  

billing.address_street_2  string optional  

billing.city  string optional  

billing.state  string optional  

billing.country_id  string optional  

billing.zip  string optional  

billing.phone  string optional  

shipping  object optional  

shipping.name  string optional  

shipping.address_street_1  string optional  

shipping.address_street_2  string optional  

shipping.city  string optional  

shipping.state  string optional  

shipping.country_id  string optional  

shipping.zip  string optional  

shipping.phone  string optional  

customer_avatar  file optional  

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

Get customer profile

requires authentication

Returns the currently logged in customer's object

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/your-company-slug/customer/me" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/your-company-slug/customer/me"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/your-company-slug/customer/me',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 159
 

{
    "message": "Unauthenticated."
}
 

Request   

GET api/v1/{company_slug}/customer/me

URL Parameters

company_slug  string optional  

Company Slug.

Misc

Countries

requires authentication

Returns a list of countries.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/countries" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "company: 1"
const url = new URL(
    "http://crater.test/api/v1/countries"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "company": "1",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/countries',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'company' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "data": [
        {
            "id": 1,
            "code": "AF",
            "name": "Afghanistan",
            "phone_code": null
        },
        {
            "id": 1,
            "code": "AF",
            "name": "Afghanistan",
            "phone_code": null
        }
    ]
}
 

Request   

GET api/v1/countries

App Version

Get the current version of your application.

Example request:
curl --request GET \
    --get "http://crater.test/api/v1/app/version" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://crater.test/api/v1/app/version"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'http://crater.test/api/v1/app/version',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 180
x-ratelimit-remaining: 160
 

{
    "version": "6.0.2"
}
 

Request   

GET api/v1/app/version