Quick Start Guide

This is a very short description of what is needed to get started with the Magic Receipts API

General Implementation

1. Retrieving Available Offers

To obtain a list of all available offers for the currently logged-in user, call the offer short endpoint.

  • Utilize imageUrl or squareImageUrl for the offer image, supporting multiple formats (e.g., JPG, SVG, PNG).
  • Reference line1 as the title of the offer.
  • Use line4 to display the pre-formatted reward amount.
  • Provide an "Add offer to cart/list" button to allow users to clip the offer.

2. Managing Offers in the Cart

Use the clipping endpoint to add offers to the cart. The cart logic is handled internally.

3. Retrieving Offer Details

For detailed information about an offer, call the offer details endpoint.

  • Utilize imageUrl or squareImageUrl for the offer image, supporting multiple formats (e.g., JPG, SVG, PNG).
  • Reference line1 as the title of the offer.
  • Use line4 to display the pre-formatted reward amount.
  • Apply restrictToMerchants to indicate which merchants the offer is available for.
  • Use longDescription to provide a comprehensive description of the offer.
  • Utilize buyingOptions to present the available purchase options (e.g., rewards for buying one or two units of the same product).
  • Reference line7 to display a disclaimer.

4. Retrieving Categories

Call the categories endpoint to obtain a list of all available categories.

5. Retrieving Merchants

Call the merchants endpoint to retrieve a complete list of merchants.

6. Uploading Receipts

Receipt uploads involve multiple scenarios. It is generally recommended that users clip at least one offer before proceeding with receipt uploads.

  • Ensure that users specify the quantity of purchased items (e.g., 2 cookies, 1 apple, etc.).
  • Upon upload, the system will return a response indicating whether the process was successful. All possible scenarios have been documented accordingly.

Endpoints

Credentials

my app token
<YOUR_TOKEN_HERE>

get 2 hour's access token

\-X GET <https://api.bitlabs.ai/v1/client/magic-receipts/access-token> -H "X-Api-Token: \<YOUR_TOKEN_HERE>" -H "X-User-Id: 124"

This is your header with the token that authenticates your user

\-H "Authorization: Bearer ODAxOTAzN34xNzE5NDQ5NzQ5fmI5ODUyMTc5ODhlMjU1ZDhjMjE1M2E4MmIxNmE2ZDczNWM0YjdmMWFmOWVjOGJhYzM0NmZiYjYyYjRhZDQ0OTI="

Check specific offer

curl '<https://receipts.bitlabs.ai/?cmd=mp-mr-api-offer-details&offerID=7174682&_bg=false'> -H "Authorization: Bearer ODAxOTAzN34xNzE5NDQ5NzQ5fmI5ODUyMTc5ODhlMjU1ZDhjMjE1M2E4MmIxNmE2ZDczNWM0YjdmMWFmOWVjOGJhYzM0NmZiYjYyYjRhZDQ0OTI="

Check for all offers

curl '<https://receipts.bitlabs.ai/?cmd=mp-mr-api-offers-short'> -H "Authorization: Bearer ODAxOTAzN34xNzE5NDQ5NzQ5fmI5ODUyMTc5ODhlMjU1ZDhjMjE1M2E4MmIxNmE2ZDczNWM0YjdmMWFmOWVjOGJhYzM0NmZiYjYyYjRhZDQ0OTI="

Clip offer

curl '<https://receipts.bitlabs.ai/?cmd=mp-mr-api-offer-action'> -H "Authorization: Bearer ODAxOTAzN34xNzE5NDQ5NzQ5fmI5ODUyMTc5ODhlMjU1ZDhjMjE1M2E4MmIxNmE2ZDczNWM0YjdmMWFmOWVjOGJhYzM0NmZiYjYyYjRhZDQ0OTI=" --data-raw 'offerID=7215012&action=add'

Check clipped offers

curl '<https://receipts.bitlabs.ai/?cmd=mp-mr-api-offers-short&sortType=0&myList=true'> -H "Authorization: Bearer ODAxOTAzN34xNzE5NDQ5NzQ5fmI5ODUyMTc5ODhlMjU1ZDhjMjE1M2E4MmIxNmE2ZDczNWM0YjdmMWFmOWVjOGJhYzM0NmZiYjYyYjRhZDQ0OTI="

Upload a receipt

curl -X POST '<https://receipts.bitlabs.ai/?cmd=mp-mr-api-upload-receipt&imageCount=1&offerIDs=7215012&merchantID=11'> -H "Authorization: Bearer ODAxOTAzN34xNzE5NDQ5NzQ5fmI5ODUyMTc5ODhlMjU1ZDhjMjE1M2E4MmIxNmE2ZDczNWM0YjdmMWFmOWVjOGJhYzM0NmZiYjYyYjRhZDQ0OTI=" -F 'img0=@/Users/eric.h/Desktop/testimage2.png;type=image/png' -F 'imgName0=testimage2.png'

Request manual review

curl '<https://receipts.bitlabs.ai/?cmd=mp-mr-api-manual-review&uploadOfferIDs=170563011'> -X 'POST' -H "Authorization: Bearer ODAxOTAzN34xNzE5NDQ5NzQ5fmI5ODUyMTc5ODhlMjU1ZDhjMjE1M2E4MmIxNmE2ZDczNWM0YjdmMWFmOWVjOGJhYzM0NmZiYjYyYjRhZDQ0OTI="

Did this page help you?