This document outlines the planned specification for two new authenticated endpoints to the Cardigan API.

<aside> ⚠️ This specification has been superseded by the Cardigan API Spec v1.1.

</aside>



Overview

The Cardigan API is a REST-based API that uses a simple JSON data format for requests and responses.

Authentication

Authentication is achieved via a JSON Web Token (JWT) provided in the Authorization header as a Bearer token. The token in use is scoped to a specific Shopify store and can be retrieved from the Cardigan settings page for each store.

An example token may look like this:

eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2Njk2ODI4OTEsImlzcyI6ImNhcmRpZ2FuIiwibmJmIjoxNjY5NjgyODkxLCJqdGkiOiI4YjhhYTFhOC00ODM2LTQxZDQtYmJjOC1mYmE2M2I3MzI1M2QiLCJhdWQiOiJtZXJjaGFudCIsInN1YiI6Im15LXN0b3JlLm15c2hvcGlmeS5jb20ifQ.mktMr0WB2l6InvPOmOTJZKPmyw4uKVq6qpmY8zCkHE4

with the corresponding header looking like this:

Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2Njk2ODI4OTEsImlzcyI6ImNhcmRpZ2FuIiwibmJmIjoxNjY5NjgyODkxLCJqdGkiOiI4YjhhYTFhOC00ODM2LTQxZDQtYmJjOC1mYmE2M2I3MzI1M2QiLCJhdWQiOiJtZXJjaGFudCIsInN1YiI6Im15LXN0b3JlLm15c2hvcGlmeS5jb20ifQ.mktMr0WB2l6InvPOmOTJZKPmyw4uKVq6qpmY8zCkHE4

Endpoints

The base URL for the API is https://app.runcardigan.com/api/v1/:shopify_subdomain, where :shopify_subdomain is the Shopify subdomain for the relevant store — for example, the store my-store.myshopify.com would have an API base URL of https://app.runcardigan.com/api/v1/my-store.

Activate card

The activate endpoint allows integrators to request the activation of an existing physical card with a specified value.

Example request

To activate a card with the number 892302452925087802753 and a value of CAD$100.00, the following request would be made:

POST <https://app.runcardigan.com/api/v1/my-store/cards/892302452925087802753/activate.json>
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2Njk2ODI4OTEsImlzcyI6ImNhcmRpZ2FuIiwibmJmIjoxNjY5NjgyODkxLCJqdGkiOiI4YjhhYTFhOC00ODM2LTQxZDQtYmJjOC1mYmE2M2I3MzI1M2QiLCJhdWQiOiJtZXJjaGFudCIsInN1YiI6Im15LXN0b3JlLm15c2hvcGlmeS5jb20ifQ.mktMr0WB2l6InvPOmOTJZKPmyw4uKVq6qpmY8zCkHE4
Content-Type: application/json
{
  "amount": "100.00",
  "currency": "CAD",
  "source_name": "Return RA45738953"
}