Quickstart

This guide will get you all set up and ready to use the Crater API. We'll also look at where to go next to find all the information you need to take full advantage of our powerful REST API.

Crater API can be accessed using two types of access tokens:

  1. Platform access tokens: Used to manage businesses, users, and other resources across the platform.
  2. Business access tokens. Used to manage resources within a specific business.

1. Create Platform Access Token

After creating an API Client, you can create a platform access token by sending a POST request to the /oauth/token endpoint. The request should include the following parameters:

  • Name
    grant_type
    Type
    string
    Field Type
    Description

    Pass personal_access as the grant type.

  • Name
    client_id
    Type
    string
    Field Type
    Description

    Pass your client id copied from Crater API Clients page.

  • Name
    client_secret
    Type
    string
    Field Type
    Description

    Pass your client secret copied from Crater API Clients page.

  • Name
    user_id
    Type
    string
    Field Type
    Description

    Pass user_id of the super admin account provided by us.

cURL

curl --request POST \
  "https://payments.your-domain.com/oauth/token" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --data "{
    \"grant_type\": \"personal_access\",
    \"client_id\": \"your-client-id\",
    \"client_secret\": \"your-client-secret\",
    \"user_id\": \"your-crater-platform-user-id\"
  }"

Above request will return a response with a platform access token that you can use it on your backend for managing businesses, users, and other resources.

2. Setup Roles & Permissions

You can manage the roles from the Roles page in your Crater instance under Team and Security menu. or You can also use the platform access token to directly manage roles using our API. You can read more about it in the Roles endpoint documentation.

3. Create Business

Once the roles are setup correctly, you can start creating businesses using the platform access token. You can create a business by sending a POST request to the /api/v1/businesses endpoint. For more information on how to create a business, you can read the Businesses endpoint documentation.

A business is like an entity that can have its own users, settings, and resources such as invoices, estimates, etc.

You can also manage your businesses directly from the Crater UI under the Businesses page.

3. Create Business User

After creating a business, you can create a user for the business by sending a POST request to the /api/v1/users endpoint. For more information on how to create/update a business user, you can read the Users endpoint documentation.

4. Generate Business User Access Token

After creating a business user, you can generate a business access token by sending a POST request to the /oauth/token endpoint. The request should include the same parameters as the platform access token request, but with the newly created user's ID.

cURL

curl --request POST \
  "https://payments.your-domain.com/oauth/token" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --data "{
    \"grant_type\": \"personal_access\",
    \"client_id\": \"your-client-id\",
    \"client_secret\": \"your-client-secret\",
    \"user_id\": \"your-crater-business-user-id\"
  }"

What's next?

The above steps will get you all set up and ready to use the Crater API. Here are some next steps to help you understand the API better: