DeprecatedImage Validation API

Image Validation API

Submit receipt captures and photographs for validation and track them through the validation process.

The Image Validation API is no longer supported for new integrations.

Image Validation objects allow a customer to submit images such as receipt captures for validation or photographs. Using this API, receipt capture images can be tracked through the validation process. The number of images per image validation record is configurable. SessionM can work with a variety of partners to validate receipts, but the API is validation provider agnostic.

Consider the following image format requirements:

  • Image can be submitted base64 encoded or binary.
  • Image needs to be under 10MB in file size.
  • Supported formats include JPG, PNG, TIFF, PDF and GIF.

Note that some setup and configuration is required before this API can be utilized. For more information, please contact your Customer Success representative for assistance.

API Contingencies and Combinations:

  • Since image validations exist to validate receipts and images from customers, you must create the customers that engage in this process. Use the Standard Profile API to create customers and specify the attributes for their standard profiles.
  • Image validation records are often tied to campaigns, which are created in advance by via the SessionM UI. Campaign identifiers can then be passed in with request object from the Image Validation API. Campaign IDs determine how SessionM analyzes the image and awards specific incentives accordingly. For example, people submit receipts and images of themselves. Image validation logic considers if the receipts are tied to specific retailers.

This API provides the following methods:

Create a New Image Validation Record

Adds a new image validation record. This method allows customers to submit a receipt.

Endpoints for Create a New Image Validation Record

This method offers the following endpoints:

REST Endpoints

POST /priv/v1/apps/:api_key/image_validations?auth_token=xxxx-yyyy-zzzz
POST /priv/v1/apps/:api_key/users/:user_id/image_validations
POST /priv/v1/apps/:api_key/external/users/:external_id/image_validations

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Create a New Image Validation Record

The following parameters are available when specifying the endpoint for this method:

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
user_idInternal identifier for the customer within the SessionM Platform.
external_idIdentifier for a customer in an external system integrating with the SessionM Platform.
auth_tokenSpecified authorization token. For example: auth_token=xxxx-yyyy-zzzz.

Request Object for Create a New Image Validation Record

When this method runs, it passes in a request object that contains an image_validation object, which is shown below:

JSON Request

{
  "image_validation": {
    "validation_type": "receipt",
    "campaign_permalink": "my-receipt-campaign",
    "placement_id" : 54321,
    "external_id" : "my-tracking-id",
    "images" : [
        { "id" : "100", "base64_data"  : "....", "mime_type" : "image/jpg" },
        { "id" : "101", "base64_data"  : "....", "mime_type" : "image/png" }
    ],
    "data" : {
    }
  }
}

This object is detailed in the following table:

Request Attributes for Image Validation

AttributeType
Required/Optional
Description
validation_typestring
required
Specifies validation type. Use "receipt" to explicitly specify a receipt capture and validation. Use "image" for regular image validation.
campaign_permalinkstring
required
SessionM campaign identifier for the image. Each campaign has a defined set of rules and desired customer actions.
placement_idstring
optional
Your placement ID. Format: placement_id=your-placement-id.
external_idstring
optional
Use for local tracking.
image_countinteger
optional
Used for uploading one image at a time through the /images route.
imagesarray
required
Must be at least length 1.
dataobject
optional
Free form hash.

Note too that every image accepts an optional, client-defined ID for tracking purposes; these IDs are returned in the response.

Response Object for Create a New Image Validation Record

In addition to a status value-pair for the transaction, the response object returned by the method contains an image_validation object, which is shown below:

JSON Response

{
  "status": "ok",
  "image_validation": {
    "id": 111111,
    "validation_type": "receipt",
    "campaign_id" : 12345,
    "campaign_permalink" : "my-receipt-campaign",
    "placement_id" : 54321,
    "external_id" : "my-tracking-id",
    "user_id": "xxxxx",
    "status": "pending",
    "created_at": "2015-01-20 13:04:45",
    "updated_at": "2015-01-21 13:04:45",
    "image_count": 2,
    "images": [
        { "id" : "100", "url" : "https://content.sessionm.com/images/12345/example/54321/image1.jpg", "mime_type" : "image/jpg" },
        { "id" : "101", "url": "https://content.sessionm.com/images/12345/example/54321/image2.png", "mime_type" : "image/png" },
    ],
    "data" : {
    }
  }
}

The following table documents this object:

Response Attributes for Image Validation

AttributeTypeDescription
idintegerImage validation ID.
validation_typestringShows validation type: receipt to explicitly specify a receipt capture and validation; image for regular image validation.
campaign_idintegerSessionM campaign identifier for the image. Each campaign has a defined set of rules and actions.
campaign_permalinkstringSessionM campaign identifier for the image. Each campaign has a defined set of rules and desired customer actions.
placement_idstringYour placement ID. Format: placement_id=your-placement-id.
external_idstringUse for local tracking.
user_idstringSessionM customer identifier.
statusstringOne of pending, valid, invalid, incomplete.
created_atstringImage validation creation UTC date time.
updated_atstringImage validation last updated UTC date time.
image_countintegerUsed for uploading one image at a time through the /images route.
imagesarrayList of image objects attached to the image validation with URLs.
dataobjectFree form hash.

Statuses and Errors for Create a New Image Validation Record

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
missing_dataRequired parameter is missing.
campaign_unavailableThe campaign identifier sent in could not be found.
campaign_unavailableThe customer is ineligible for this campaign or has hit the cap.
validationCustomer has exceeded daily limit.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Create a New Image in an Image Validation Record

Adds a new image to an image validation record.

In more technical terms, it adds an image to an image validation record with a status of incomplete. It then returns an updated image validation object. Image validation objects with a status of incomplete change to pending once the initial image_count is reached.

Endpoints for Create a New Image in an Image Validation Record

This method offers the following endpoints:

REST Endpoints

POST /api/v1/apps/:api_key/image_validations/:image_validation_id/images?auth_token=xxxx-yyyy-zzzz
POST /priv/v1/apps/:api_key/users/:user_id/image_validations/:image_validation_id/images
POST /priv/v1/apps/:api_key/external/users/:external_id/image_validations/:image_validation_id/images

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Create a New Image in an Image Validation Record

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
user_idInternal identifier for the customer within the SessionM Platform.
external_idIdentifier for a customer in an external system integrating with the SessionM Platform.
auth_tokenSpecified authorization token. For example: auth_token=xxxx-yyyy-zzzz.

Request Object for Create a New Image in an Image Validation Record

When this method runs, it passes in a request object that contains an image object, which is shown below:

JSON Request

{
  "image" : {
    "id" : "101",
    "base64_data"  : "....",
    "mime_type" : "image/jpg"
  }
}

This object is detailed in the following table:

Request Attributes for Image

AttributeType
Required/Optional
Description
idstring
optional
Use for local tracking.
base64_datastring
required
Base64 encoded image data.
mime_typestring
optional
Mime type of the image.

Response Object for Create a New Image in an Image Validation Record

This object is identical to the response object returned for the method that creates a new validation record, as shown below:

JSON Response

{
  "status": "ok",
  "image_validation": {
    "id": 111111,
    "validation_type": "receipt",
    "campaign_id" : 12345,
    "campaign_permalink" : "example",
    "placement_id" : 54321,
    "user_id": "xxxxx",
    "status": "pending",
    "created_at": "2015-01-20 13:04:45",
    "updated_at": "2015-01-21 13:04:45",
    "image_count": 2,
    "images": [
        { "id" : "100", "url" : "https://content.sessionm.com/images/12345/example/54321/image1.jpg", "mime_type" : "image/jpg" },
        { "id" : "101", "url": "https://content.sessionm.com/images/12345/example/54321/image2.png", "mime_type" : "image/png" },
    ],
    "data" : {
    }
  }
}

For more information, see the image_validation object.

Statuses and Errors for Create a New Image in an Image Validation Record

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. The platform returns the following error messages for this method:

CodeReason
validationInvalid image data sent in.
image_not_foundNo image data sent in.
validationToo many images passed in.
validationAn image passed in is over 10MB.

For information on the generic statuses and errors returned for any object, see the associated section in Generic Statuses and Errors.

Retrieve an Image Validation Record

Retrieves an image validation record.

Endpoints for Retrieve an Image Validation Record

This method offers the following endpoints:

REST Endpoints

GET /api/v1/apps/:api_key/image_validations?auth_token=xxxx-yyyy-zzzz
GET /priv/v1/apps/:api_key/users/:user_id/image_validations
GET /priv/v1/apps/:api_key/external/users/:external_id/image_validations

For more information on how to specify an endpoint as part of an actual URL, see Before You Begin. The procedure in this section includes a sample URL for a customer transaction.

Endpoint Parameters for Retrieve an Image Validation Record

Endpoint ParameterDescription
api_keySupplied by the SessionM Platform, the API key is necessary to authenticate any HTTP request to a SessionM API. This key is associated to an API secret, which ties the authentication to a specific application or web site within the organization. The platform maintains each application or site as a digital property, something that can be configured using the SessionM UI.
user_idInternal identifier for the customer within the SessionM Platform.
external_idIdentifier for a customer in an external system integrating with the SessionM Platform.
auth_tokenSpecified authorization token. For example: auth_token=xxxx-yyyy-zzzz.
limitDefault is 100.
pageDefault is 1.

Request Object for Retrieve an Image Validation Record

Not applicable.

Response Object for Retrieve an Image Validation Record

In addition to a status value-pair for the transaction, the response object returned by the method contains an image_validations array, which is shown below:

JSON Response

{
  "image_validations": [
    {
      "id": 111111,
      "validation_type": "receipt",
      "campaign_id" : 12345,
      "campaign_permalink" : "example",
      "placement_id" : 54321,
      "user_id" : "xxxxx",
      "status": "pending",
      "created_at": "2015-01-20 13:04:45",
      "updated_at": "2015-01-21 13:04:45",
      "image_count" : 2,
      "images": [
        { "id" : "100", "url" : "https://content.sessionm.com/images/12345/example/54321/image1.jpg", "mime_type" : "image/jpg" },
        { "id" : "101", "url" : "https://content.sessionm.com/images/12345/example/54321/image2.png", "mime_type" : "image/png" },
      ],
      "data" : {
      }
    },
    {
      "id":111112,
      "validation_type":"receipt",
      "campaign_id":12345,
      "campaign_permalink" : "example",
      "placement_id" : 54321,
      "user_id":"xxxxx",
      "status":"valid",
      "store_name":"ACME Pharmacy",
      "receipt_date":"2016-02-16 14:21:10",
      "created_at":"2016-02-11 06:48:23",
      "updated_at":"2016-02-16 14:21:10",
      "image_count":1,
      "images":[
         { "id" : "200", "url" : "https://content.sessionm.com/images/12345/example/54321/image1.jpg", "mime_type" : "image/jpg" }
      ],
      "data":{
      },
      "results":[
        {
          "id" : "111112-1",
          "name" : "3600000001",
          "description" : "example",
          "price" : 1.05,
          "quantity" : 2,
          "points" : 10
        },
        {
          "id" : "111112-2",
          "name" : "3600000002",
          "description" : "example 2",
          "price" : 2.50,
          "quantity" : 1,
          "points" : 10
        }
      ]
    },
    {
      "id":111113,
      "validation_type":"receipt",
      "campaign_id":12345,
      "campaign_permalink" : "example",
      "placement_id" : 54321,
      "user_id":"xxxxx",
      "status":"invalid",
      "invalid_code":1,
      "invalid_reason":"We cannot read your receipt clearly. Please make sure to take the picture with ample lighting showing your qualifying purchase.",
      "created_at":"2016-02-11 06:49:23",
      "updated_at":"2016-02-16 14:22:59",
      "image_count":1,
      "images":[
         { "id" : "300", "url" : "https://content.sessionm.com/images/12345/example/54321/image1.jpg", "mime_type" : "image/jpg" }
      ],
      "data":{
      }
    }
  ]
}

The following tables document this array:

Response Attributes for Image Validation

AttributeTypeDescription
idintegerImage Validation ID.
validation_typestringShows validation type: receipt to explicitly specify a receipt capture and validation; image for regular image validation.
campaign_idintegerSessionM campaign identifier for the image. Each campaign has a defined set of rules and actions.
campaign_permalinkstringSessionM campaign identifier for the image. Each campaign has a defined set of rules and desired customer actions.
placement_idstringYour placement ID. Format: placement_id=your-placement-id.
user_idstringSessionM customer identifier.
statusstringStatuses include: incomplete, pending, valid and invalid. Note that invalid validations include the invalid_code and the invalid_reason keys.
invalid_codeintegerFor a list of invalid image codes, see the table in Invalid Image Codes.
invalid_reasonstringFor a list of invalid image code reasons, see the table in Invalid Image Codes.
created_atstringImage validation creation UTC date time.
updated_atstringImage validation last updated UTC date time.
image_countintegerUsed for uploading one image at a time through the /images route.
imagesarrayList of image objects attached to the image validation with URLs.
dataobjectFree form hash.
resultsarrayFor more information on the objects in the results array, see table below.

Response Attributes for Results

AttributeTypeDescription
idstringImage Validation ID and a result identifier combined with a hyphen.
namestringUPC / SKU code or product name.
descriptionstringProduct description.
pricefloatPrice payed for the receipt line item.
quantityintegerNumber of products purchased.
pointsintegerNumber of points earned for the receipt line item.

Invalid Image codes

The following table details the codes for invalid images:

Invalid Image Codes

CodeDescription
0Unknown
1Receipt cannot be read clearly
2Receipt is cropped
3Receipt submitted twice
4Receipt submitted outside of campaign dates
5Image is not a receipt
6No valid purchases found
7Purchases are from a non-qualifying store
8Image cannot be read clearly
9Image is unrelated to campaign
10Image submitted twice
11Image submitted outside of campaign dates
12Image has no valid purchases found, similar to 6
13Multiple submissions not allowed for this campaign
14Required fields missing from the receipt
15Loyalty card linked to same retailer
16Award limit reached
17Image appears to have been altered.
18Non-participating region

Statuses and Errors for Retrieve an Image Validation Record

When this method makes a successful call to the platform, it returns a 200-level status code. When the string returned with a 200-level status code is ok, the transaction did process. But, if the string returned is error, you need to discover what type of error occurred.

Returned errors can be either method-specific or generic. No error messages are defined for this method except for the generic statuses and errors returned for any object. For more information, see the associated section in Generic Statuses and Errors.