Basics

This page provides an overview on Card Minting API, user authentication for App2App API, pagination, return codes and abbreviations.

Card Minting API

Authentication

Before you can start working with Card Minting API, you need a JWT access token. You can obtain the token using the ID and password that you used for registering as Klip Partners. Tokens are valid for 24 hours and have to be refreshed before they expire. Issued tokens should be provided in the Authrization field of the request header when making the API request.

If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).

Pagination

When you want to retrieve the information for a large number of Cards, you may have to make multiple requests in order to avoid being overwhelmed with too many results. That's where next_cursor comes in handy. GET API requests will return next_cursor, which is a pointer to a specific item in the dataset. So, say you make a GET request for over 100 Cards, it will return 100 items in the result and a next_cursor value. To retrieve the rest of the Cards, set the cursor parameter with next_cursor and make another request to the same endpoint.

Here's an example request to retrieve your Card information:

//Get Card Information By BApp
curl "https://global.api.klipwallet.com/v2/wallet/bapp" \
-H "Authorization: ACCESS_TOKEN" -H "Content-Type: application/json"

You will get the following response:

{
  "bapps": [...],
  "next_cursor": "N2r8KY...XOadEG"
}

To retrieve the rest of the Cards, use next_cursor in the next request. You can get a complete list of all the Cards by continuing to make calls until the next_cursor field is returned empty.

//Get Card Information By BApp
curl "https://global.api.klipwallet.com/v2/wallet/bapp?cursor=N2r8KY...XOadEG" \
-H "Authorization: ACCESS_TOKEN" -H "Content-Type: application/json"

If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).

Success Codes/Error Codes

If a request is successful, the server returns HTTP code 200. In case of an error, it returns HTTP codes 400, 401, or 500. 400 indicates that the request has incorrect syntax. 401 means that the access token is invalid. And 500 means that the server encountered an unexpected error. The 400 or 401 series errors are returned with a specific error code with a message.

The error message is in JSON format with the following fields:

{
  "code": number,
  "err": string
}

Below is the list of error messages:

If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).

Glossary

If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).

App2App API

Authentication

App2App API doesn't require authentication. But a request key for different API requests is issued to distinguish between different BApps. This key allows Klip server to keep the requests separate and organized. The steps for obtaining and using a request key are described below:

  • Pass the authentication or signature data via the prepare function and obtain the request key in the response.

  • Request a deep link(URI that sends users directly to a specific location in an app) using the returned request key, and run the mobile app Klip.

  • You can send a polling request to Result API, specifying which request you want the results for in the query parameter request_key.

If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).

Pagination

When you want to retrieve the information for a large number of Cards, you may have to make multiple requests in order to avoid being overwhelmed with too many results. That's where next_cursor comes in handy. GET API requests will return next_cursor, which is a pointer to a specific item in the dataset. So, say you make a GET request for over 100 Cards, it will return 100 items in the result and a next_cursor value. To retrieve the rest of the Cards, set the cursor parameter with next_cursor and make another request to the same endpoint.

Here's an example request for retrieving your Card information:

//Get card list
curl "https://global.api.klipwallet.com/v2/a2a/cards?sca=SCA&eoa=EOA" \
-H "Content-Type: application/json"

You will get the following response:

{
  "name": "KLIP",
  "symbol_img": "image url",
  "cards": [...],
  "next_cursor": "N2r8KY...XOadEG"
}

To retrieve the rest of the Cards, use next_cursor in the next request. You can get a complete list of all the Cards by continuing to make calls until the next_cursor field is returned empty.

//Get card list
curl "https://global.api.klipwallet.com/v2/a2a/cards?sca=SCA&eoa=EOA&cursor=N2r8KY...XOadEG" \
-H "Content-Type: application/json"

If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).

SDK

App2App API is primarily a RESTful API, but it also supports SDKs for the different development environments of each BApp. Currently available are SDKs for Android, iOS, and JavaScript for mobile web. See SDK Page for more details.

Success Codes/Error Codes

If a request is successful, the server returns HTTP code 200. In case of an error, it returns the HTTP codes 400 or 500. 400 indicates that the request has incorrect syntax, or the request_key is invalid. 500 means that the server encountered an unexpected error. The 400 series errors are returned with a specific error code with a message. Refer to each API for detailed explanations.

The error message is in JSON format with the following fields:

{
  "request_key": "random key",
  "expiration_time": unix timestamp,
  "status": "error",
  "error": {
    "code": int,
    "err": "error message"
  }
}

Since the Get Card Information API (/v2/a2a/cards) is not relevant to request_key, an error looks like this:

{
  "code": number,
  "err": string
}

Here is list of error messages:

If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).

Glossary

If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).

Last updated