Back to top

Blaize public API documentation

Authentication

Login

Login
POST/blaize/login

User Login

Example URI

POST /blaize/login
Request  with body
HideShow
Headers
Content-Type: application/json
cookie: blaize_session=... (optional)
Body
{
  "identifiers": {
    "email_address": "joe.blow@company.com"
  },
  "validators": {
    "password": "mysecurepassword123",
    "use_sso": true
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "identifiers": {
      "type": "object",
      "properties": {
        "email_address": {
          "type": "string"
        }
      }
    },
    "validators": {
      "type": "object",
      "properties": {
        "password": {
          "type": "string"
        },
        "use_sso": {
          "type": "boolean",
          "description": "When this is present there should be no identifiers in the body. The user is identified through a blaize_session cookie."
        }
      }
    }
  },
  "required": [
    "identifiers",
    "validators"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "cookie": "blaize_session=0123456789ABCD; Expires=Fri, 16 Nov 2018 12:35:56 GMT; Path=/;",
  "message": "Registration successful",
  "tracking_id": "TT0123456789ABCD"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "cookie": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "tracking_id": {
      "type": "string"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/json
Response  400
HideShow
Headers
Content-Type: application/json

Logout

Logout
POST/blaize/logout

User Logout

Example URI

POST /blaize/logout
Request  with body
HideShow
Headers
Content-Type: application/json
cookie: `blaize_session=...` (string)
Body
{
  "where": "EVERYWHERE"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "where": {
      "type": "string",
      "description": "An enum of describing which sessions/devices to log out of.\n\nOptions are `JUST_HERE`, `THIS_DEVICE`, `OTHER_DEVICES`, `EVERYWHERE`.\nThese options are only valid when Single Sign-On is configured.\nWhen SSO is configured as `autoLogin`, then the default behaviour is `EVERYWHERE`.\nWhen SSO is configured as `optIn`, then the default behaviour is `JUST_HERE`.\n`JUST_HERE` is not a valid option when SSO is configured as `autoLogin`."
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Session deleted"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json

Zephr Public Sso V1 Status

RetrieveSsoStatus
GET/zephr/public/sso/v1/status

Retrieve the SSO status and metadata of the current user.

Example URI

GET /zephr/public/sso/v1/status
Response  200
HideShow

SSO status was retrieved successfully

Headers
Content-Type: application/json
Body
{
  "status": "authenticated",
  "meta": {}
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "The SSO status of the current user session. This can be:\n\n- `unknown`: The SSO token is not authenticated anywhere, or the current session is not associated with an SSO token.\n\n- `known`: The current session is anonymous, but the SSO token is authenticated on another site.\n\n- `authenticated`: The current session is authenticated through an SSO token."
    },
    "meta": {
      "type": [
        "object",
        "null"
      ],
      "properties": {}
    }
  },
  "required": [
    "status"
  ]
}

Zephr Public Sso V1 Status Meta

UpdateMeta
PUT/zephr/public/sso/v1/status/meta

Update the SSO metadata associated with the user.

Example URI

PUT /zephr/public/sso/v1/status/meta
Request
HideShow
Headers
Content-Type: application/json
Body
{}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {}
}
Response  200
HideShow
Body
Metadata updated successfully.
Response  400
HideShow
Headers
Content-Type: application/json
Body
There was a problem with the request data

Start Passwordless

Important Info

For passwordless authentication, first is required to send a POST to request an email to be sent to the User’s email with a link for the user to click on to verify his email.

Start Passwordless
POST/blaize/token-exchange

Start Passwordless Authentication

Example URI

POST /blaize/token-exchange
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "identifiers": {
    "email_address": "joe.blow@company.com"
  },
  "delivery": {
    "method": "email",
    "destination": "joe.blow@company.com",
    "action": "login",
    "redirect": "/"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "identifiers": {
      "type": "object",
      "properties": {
        "email_address": {
          "type": "string"
        }
      }
    },
    "delivery": {
      "type": "object",
      "properties": {
        "method": {
          "type": "string"
        },
        "destination": {
          "type": "string"
        },
        "action": {
          "type": "string"
        },
        "redirect": {
          "type": "string"
        }
      }
    }
  },
  "required": [
    "identifiers",
    "delivery"
  ]
}
Response  201
Response  400
HideShow
Headers
Content-Type: application/json

Complete Passwordless

Complete Passwordless
GET/blaize/token-exchange/

Complete Passwordless Authentication

Example URI

GET /blaize/token-exchange/
Response  302
HideShow
Headers
Location: (string)
Set-Cookie: (string)
Response  401
HideShow
Headers
Content-Type: application/json
Response  400
HideShow
Headers
Content-Type: application/json

Start Password Reset

Important Info

To reset a User password, first is required to send a POST to request an email to be sent to the User’s email with a link for the user to click on so as to verify that he requested this password change.

Start password reset
POST/blaize/users/reset

Start password reset

Example URI

POST /blaize/users/reset
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "identifiers": {
    "email_address": "joe.blow@company.com"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "identifiers": {
      "type": "object",
      "properties": {
        "email_address": {
          "type": "string"
        }
      }
    }
  },
  "required": [
    "identifiers"
  ]
}
Response  200
Response  404
Response  400
HideShow
Headers
Content-Type: application/json

Complete Password Reset

Complete password reset
POST/blaize/users/reset/{state}

Complete password reset

Example URI

POST /blaize/users/reset/state
URI Parameters
HideShow
state
string (required) 

Unique State identifier

Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "validators": {
    "password": "mysecurepassword123",
    "use_sso": true
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "validators": {
      "type": "object",
      "properties": {
        "password": {
          "type": "string"
        },
        "use_sso": {
          "type": "boolean",
          "description": "When this is present there should be no identifiers in the body. The user is identified through a blaize_session cookie."
        }
      }
    }
  },
  "required": [
    "validators"
  ]
}
Response  200
Response  404
Response  400
HideShow
Headers
Content-Type: application/json

Password Reset Form

Password Reset Form
GET/blaize/blaize/password-reset.html

Returns the Password Reset Form

Example URI

GET /blaize/blaize/password-reset.html
Response  200
HideShow
Headers
Content-Type: text/html

Anonymous Session

Anonymous Session
POST/blaize/anonymous-session

Create anonymous session.

Example URI

POST /blaize/anonymous-session
Request  with body
HideShow
Headers
Content-Type: application/json
Response  201
HideShow
Headers
Content-Type: application/json
Set-Cookie: blaize_session=5562c0cf-b07a-42d0-ac1a-c0e29735e73a; Expires=Tue, 1 Jan 2019 12:00:00 GMT; Path=/;
Set-Cookie: blaize_tracking_id=33d576c7-d036-40e7-8141-8a91998a5c79; Expires=Tue, 1 Jan 2019 12:00:00 GMT; Path=/;
Body
{
  "message": "Anonymous session created successfully",
  "tracking_id": "33d576c7-d036-40e7-8141-8a91998a5c79"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    },
    "tracking_id": {
      "type": "string"
    }
  }
}

Start update email request

Start update your current email address
POST/blaize/users/update-email

Example URI

POST /blaize/users/update-email
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "new_identifiers": {
    "email_address": "joe.blow@company.com"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "new_identifiers": {
      "type": "object",
      "properties": {
        "email_address": {
          "type": "string"
        }
      }
    }
  },
  "required": [
    "new_identifiers"
  ]
}
Response  200
Response  404
Response  400
HideShow
Headers
Content-Type: application/json

Complete update email request

Complete update your current email address
POST/blaize/users/update-email/

Example URI

POST /blaize/users/update-email/
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "validators": {
    "password": "mysecurepassword123",
    "use_sso": true
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "validators": {
      "type": "object",
      "properties": {
        "password": {
          "type": "string"
        },
        "use_sso": {
          "type": "boolean",
          "description": "When this is present there should be no identifiers in the body. The user is identified through a blaize_session cookie."
        }
      }
    }
  },
  "required": [
    "validators"
  ]
}
Response  200
Response  404
Response  400
HideShow
Headers
Content-Type: application/json

Update email request Form

Update email request Form
GET/blaize/update-email.html

Returns the update email request Form

Example URI

GET /blaize/update-email.html
Response  200
HideShow
Headers
Content-Type: text/html

Change password request

Change your password
POST/blaize/users/change-password

Example URI

POST /blaize/users/change-password
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "current_validators": {
    "password": "mysecurepassword123",
    "use_sso": true
  },
  "new_validators": {
    "password": "mysecurepassword123",
    "use_sso": true
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "current_validators": {
      "type": "object",
      "properties": {
        "password": {
          "type": "string"
        },
        "use_sso": {
          "type": "boolean",
          "description": "When this is present there should be no identifiers in the body. The user is identified through a blaize_session cookie."
        }
      }
    },
    "new_validators": {
      "type": "object",
      "properties": {
        "password": {
          "type": "string"
        },
        "use_sso": {
          "type": "boolean",
          "description": "When this is present there should be no identifiers in the body. The user is identified through a blaize_session cookie."
        }
      }
    }
  },
  "required": [
    "current_validators",
    "new_validators"
  ]
}
Response  200
Response  403
Response  404
Response  400
HideShow
Headers
Content-Type: application/json

User

Register

Register
POST/blaize/register

Register a new User

Example URI

POST /blaize/register
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "identifiers": {
    "email_address": "joe.blow@company.com"
  },
  "validators": {
    "password": "mysecurepassword123",
    "use_sso": true
  },
  "attributes": {
    "first_name": "Joe",
    "surname": "Blow"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "identifiers": {
      "type": "object",
      "properties": {
        "email_address": {
          "type": "string"
        }
      }
    },
    "validators": {
      "type": "object",
      "properties": {
        "password": {
          "type": "string"
        },
        "use_sso": {
          "type": "boolean",
          "description": "When this is present there should be no identifiers in the body. The user is identified through a blaize_session cookie."
        }
      }
    },
    "attributes": {
      "type": "object",
      "properties": {
        "first_name": {
          "type": "string"
        },
        "surname": {
          "type": "string"
        }
      }
    }
  },
  "required": [
    "identifiers",
    "validators"
  ]
}
Response  201
HideShow
Body
{
  "cookie": "blaize_session=0123456789ABCD; Expires=Fri, 16 Nov 2018 12:35:56 GMT; Path=/;",
  "message": "Registration successful",
  "tracking_id": "TT0123456789ABCD"
}
Schema
{
  "type": "object",
  "properties": {
    "cookie": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "tracking_id": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  400
HideShow
Headers
Content-Type: application/json

Account

Account
GET/blaize/account

Retrieves the user’s core account details

Example URI

GET /blaize/account
Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "identifiers": {
    "email_address": "joe.blow@company.com"
  },
  "tracking_id": "123"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "identifiers": {
      "type": "object",
      "properties": {
        "email_address": {
          "type": "string"
        }
      }
    },
    "tracking_id": {
      "type": "string",
      "description": "456 (string)"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/json

Profile

Profile
GET/blaize/profile

Retrieves the user’s profile

Example URI

GET /blaize/profile
Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "first_name": "Joe",
  "surname": "Blow"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "first_name": {
      "type": "string"
    },
    "surname": {
      "type": "string"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/json

Save Profile
PUT/blaize/profile

Creates/Updates the user’s profile

Example URI

PUT /blaize/profile
Request  with body
HideShow
Headers
Content-Type: application/json
cookie: `blaize_session=...` (string)
Body
{
  "first_name": "Joe",
  "surname": "Blow"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "first_name": {
      "type": "string"
    },
    "surname": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Response  401
HideShow
Headers
Content-Type: application/json
Response  400
HideShow
Headers
Content-Type: application/json

Update Profile
POST/blaize/profile

Updates the user’s profile, merging with any exist fields

Example URI

POST /blaize/profile
Request  with body
HideShow
Headers
Content-Type: application/json
cookie: `blaize_session=...` (string)
Body
{
  "first_name": "Joe",
  "surname": "Blow"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "first_name": {
      "type": "string"
    },
    "surname": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Response  401
HideShow
Headers
Content-Type: application/json
Response  400
HideShow
Headers
Content-Type: application/json

Update Profile
PATCH/blaize/profile

Updates the user’s profile, merging with any exist fields

Example URI

PATCH /blaize/profile
Request  with body
HideShow
Headers
Content-Type: application/json
cookie: `blaize_session=...` (string)
Body
{
  "first_name": "Joe",
  "surname": "Blow"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "first_name": {
      "type": "string"
    },
    "surname": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Response  401
HideShow
Headers
Content-Type: application/json
Response  400
HideShow
Headers
Content-Type: application/json

Extended Profile

Extended Profile
GET/blaize/profile/{appId}

Retrieves the user’s Extended Profile

Example URI

GET /blaize/profile/appId
URI Parameters
HideShow
appId
string (required) 

Unique Profile identifier

Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "first_name": "Joe",
  "surname": "Blow"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "first_name": {
      "type": "string"
    },
    "surname": {
      "type": "string"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/json

Save Extended Profile
PUT/blaize/profile/{appId}

Creates/Updates the user’s Extended Profile

Example URI

PUT /blaize/profile/appId
URI Parameters
HideShow
appId
string (required) 

Unique Profile identifier

Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Body
{
  "first_name": "Joe",
  "surname": "Blow"
}
Schema
{
  "type": "object",
  "properties": {
    "first_name": {
      "type": "string"
    },
    "surname": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Response  401
HideShow
Headers
Content-Type: application/json
Response  400
HideShow
Headers
Content-Type: application/json

Authorization Challenge

Authorization Challenge
POST/blaize/authorization/challenge

Authorization Challenge against array of entitlement IDs.

Example URI

POST /blaize/authorization/challenge
Request  with body
HideShow
Headers
Content-Type: application/json
cookie: blaize_session=5562c0cf-b07a-42d0-ac1a-c0e29735e73a;...
Body
{
  "entitlementIds": [
    "68cc48be-e47e-4707-8958-1249d87fca86"
  ],
  "contentIdentifier": "/"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "entitlementIds": {
      "type": "array"
    },
    "contentIdentifier": {
      "type": "string"
    }
  },
  "required": [
    "entitlementIds"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "68cc48be-e47e-4707-8958-1249d87fca86": false
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "68cc48be-e47e-4707-8958-1249d87fca86": {
      "type": "boolean"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/json

Decision Engine

Decision Engine

The Blaize Decision Engine can be invoked via the Public API to calculate an HTTP Response based upon Request-Level Rules created in the Admin Console. This functionality is built into the Blaize Dynamic CDN but the API variant is useful for CMS or edge side integrations.

Decision Engine
POST/blaize/decision-engine

Example URI

POST /blaize/decision-engine
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "path": "/x.html",
  "http_method": "POST",
  "session": "xxx-xxx-xxx",
  "foreign_keys": {},
  "request_headers": {
    "User-Agent": "<userAgent>"
  },
  "content_metadata": {
    "publishedDate": "<contentAge>"
  },
  "jwt": "xxx-xxx-xxx",
  "btr": "17e74b9e49e66282e55d4b7ec73de951"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "path": {
      "type": "string"
    },
    "http_method": {
      "type": "string"
    },
    "session": {
      "type": "string"
    },
    "foreign_keys": {
      "type": "object",
      "properties": {},
      "description": "Foreign system and ID used to identify the user"
    },
    "request_headers": {
      "type": "object",
      "properties": {
        "User-Agent": {
          "type": "string"
        }
      }
    },
    "content_metadata": {
      "type": "object",
      "properties": {
        "publishedDate": {
          "type": "string"
        }
      }
    },
    "jwt": {
      "type": "string"
    },
    "btr": {
      "type": "string",
      "description": "MD5-hex-encoding of: path + \"|\" + trusted referrer secret"
    }
  },
  "required": [
    "path"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "status": "301",
  "body": "Redirecting to login page...",
  "headers": {
    "Location": "/login.html"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string"
    },
    "body": {
      "type": "string"
    },
    "headers": {
      "type": "object",
      "properties": {
        "Location": {
          "type": "string"
        }
      }
    }
  }
}
Response  409

Decision Engine
GET/blaize/decision-engine{?path}{&session,foreign_id.xxx,content_id,jwt,btr}

For compatibilty with CDN, any web headers (Referrer, User-Agent) will be accepted and passed onto the rule engine

Example URI

GET /blaize/decision-engine?path=&session=&foreign_id.xxx=&content_id=&jwt=&btr=
URI Parameters
HideShow
path
string (required) 

Uniquely identifies the content Zephr is making a decision about. Request rules can be configured to only execute when the request path matches a provided regular expression.

session
string (optional) 

Zephr Session ID - same as the blaize_session cookie used by the CDN and authentication endpoints

foreign_id.xxx
string (optional) 

Foreign ID used to identify the user. The foreign system is parsed as the remainder of the parameter key name following ‘foreign_id.’

content_id
string (optional) 

Passed as metadata.content_id to the Content API template, used to perform requests to a 3rd party API for additional content information used in making a decision

jwt
string (optional) 

A Json Web Token, may include identity or product holding claims

btr
string (optional) 

A trusted referrer token. If Zephr generates a matching token using path, passed-in Referer header and a configured secret, all entitlements used in this decision will be temporarily granted for this request

Response  200
HideShow

Response status and body are determined by the executed rule. If there is an error executing the rule, a 200 will be returned.

SDK Feature Decision Engine

SDK Feature Decision Engine

The SDK Feature Decision Engine can be invoked via the Public API to calculate a decision output response based upon Feature SDK Rules created in the Zephr Console.

Process multiple decisions
POST/zephr/decide

Example URI

POST /zephr/decide
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "features": [
    {
      "slug": "featureX",
      "path": "/x.html",
      "contentId": "xxx-xxx-xxx",
      "inputs": {}
    }
  ],
  "session": "xxx-xxx-xxx",
  "foreign_keys": {},
  "ip": "x.x.x.x",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11)...",
  "jwt": "xxx-xxx-xxx"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "features": {
      "type": "array",
      "description": "The list of features to evaluate. This must be contain at least one element. Features are evaluated sequentially, in the order they are provided."
    },
    "session": {
      "type": "string",
      "description": "Zephr Session ID, required for trials"
    },
    "foreign_keys": {
      "type": "object",
      "properties": {},
      "description": "Foreign system and ID used to identify the user"
    },
    "ip": {
      "type": "string",
      "description": "Client IP address, defaults to request IP"
    },
    "userAgent": {
      "type": "string",
      "description": "Client user agent"
    },
    "jwt": {
      "type": "string",
      "description": "A Json Web Token, may include identity or product holding claims"
    }
  },
  "required": [
    "features"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "results": [
    {
      "sdkFeatureSlug": "featureX",
      "outputType": "ENUM",
      "outputValue": "YES",
      "error": "500: Internal error ..."
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "results": {
      "type": "array",
      "description": "List of feature decision outcomes. These will be ordered as provided in the request."
    }
  },
  "required": [
    "results"
  ]
}
Response  400
HideShow
Headers
Content-Type: application/json

SDK Feature Decision Engine

The SDK Feature Decision Engine can be invoked via the Public API to calculate a decision output response based upon Feature SDK Rules created in the Zephr Console. This endpoint is used by the Zephr SDK but can be called directly for custom integrations.

Process single decision
POST/zephr/decision-engine{&raw}

Example URI

POST /zephr/decision-engine&raw=
URI Parameters
HideShow
raw
boolean (optional) Default: false 

Should output raw value

Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "sdkFeatureSlug": "featureX",
  "session": "xxx-xxx-xxx",
  "foreign_keys": {},
  "ip": "x.x.x.x",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11)...",
  "path": "/x.html",
  "contentId": "xxx-xxx-xxx",
  "jwt": "xxx-xxx-xxx",
  "...": "..."
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "sdkFeatureSlug": {
      "type": "string",
      "description": "Feature SDK slug"
    },
    "session": {
      "type": "string",
      "description": "Zephr Session ID, required for trials"
    },
    "foreign_keys": {
      "type": "object",
      "properties": {},
      "description": "Foreign system and ID used to identify the user"
    },
    "ip": {
      "type": "string",
      "description": "Client IP address, defaults to request IP"
    },
    "userAgent": {
      "type": "string",
      "description": "Client user agent"
    },
    "path": {
      "type": "string",
      "description": "Request path, required for trials"
    },
    "contentId": {
      "type": "string",
      "description": "Content ID, used to perform requests to a 3rd party API for additional content information used in making a decision"
    },
    "jwt": {
      "type": "string",
      "description": "A Json Web Token, may include identity or product holding claims"
    },
    "...": {
      "type": "string",
      "description": "Custom inputs configured in Feature SDK rule"
    }
  },
  "required": [
    "sdkFeatureSlug"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "sdkFeatureSlug": "featureX",
  "outputType": "ENUM",
  "outputValue": "YES",
  "error": "500: Internal error ..."
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "sdkFeatureSlug": {
      "type": "string",
      "description": "Feature SDK slug"
    },
    "outputType": {
      "type": "string",
      "enum": [
        "ENUM",
        "STRING",
        "NUMBER"
      ],
      "description": "Feature output type. Present if there were no errors."
    },
    "outputValue": {
      "type": "string",
      "description": "Feature output value. Present if there were no errors."
    },
    "error": {
      "type": "string",
      "description": "The error message explaining why this decision failed to resolve. Present only if there was an error."
    }
  },
  "required": [
    "sdkFeatureSlug"
  ]
}
Response  200
HideShow

Raw parameter response

Body
Raw output value

Get single decision
GET/zephr/decision-engine{?sdkFeatureSlug}{&sdkFeatureSlug,session,foreign_id.xxx,ip,userAgent,path,content_id,jwt,raw}

For compatibility with CDN, any web headers (Referrer, User-Agent) will be accepted and passed onto the rule engine

Example URI

GET /zephr/decision-engine?sdkFeatureSlug=featureX&sdkFeatureSlug=featureX&session=xxx-xxx-xxx&foreign_id.xxx=xxx-xxx-xxx&ip=x.x.x.x&userAgent=Mozilla/5.0 (Macintosh; Intel Mac OS X 11)...&path=/x.html&content_id=xxx-xxx-xxx&jwt=xxx-xxx-xxx&raw=
URI Parameters
HideShow
sdkFeatureSlug
string (required) Example: featureX

Feature SDK slug

session
string (optional) Example: xxx-xxx-xxx

Zephr Session ID, required for trials

foreign_id.xxx
string (optional) Example: xxx-xxx-xxx

Foreign ID used to identify the user. The foreign system is parsed as the remainder of the parameter key name following ‘foreign_id.’

ip
string (optional) Example: x.x.x.x

Client IP address, defaults to request IP

userAgent
string (optional) Example: Mozilla/5.0 (Macintosh; Intel Mac OS X 11)...

Client user agent

path
string (optional) Example: /x.html

Request path, required for trials

content_id
string (optional) Example: xxx-xxx-xxx

Content ID, used to perform requests to a 3rd party API for additional content information used in making a decision

jwt
string (optional) Example: xxx-xxx-xxx

A Json Web Token, may include identity or product holding claims

raw
boolean (optional) Default: false 

Should output raw value

...
string (optional) 

Custom inputs configured in Feature SDK rule

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "sdkFeatureSlug": "featureX",
  "outputType": "ENUM",
  "outputValue": "YES",
  "error": "500: Internal error ..."
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "sdkFeatureSlug": {
      "type": "string",
      "description": "Feature SDK slug"
    },
    "outputType": {
      "type": "string",
      "enum": [
        "ENUM",
        "STRING",
        "NUMBER"
      ],
      "description": "Feature output type. Present if there were no errors."
    },
    "outputValue": {
      "type": "string",
      "description": "Feature output value. Present if there were no errors."
    },
    "error": {
      "type": "string",
      "description": "The error message explaining why this decision failed to resolve. Present only if there was an error."
    }
  },
  "required": [
    "sdkFeatureSlug"
  ]
}
Response  200
HideShow

Raw parameter response

Body
Raw output value

Browser Feature Decisions

Browser Feature Decisions

Zephr HTML Features can be run in the browser by calling this API directly or using the Zephr Browser SDK.

Browser Feature Decisions
POST/zephr/feature-decisions

For compatibility with CDN, any web headers (Referrer, User-Agent) will be accepted and passed onto the rule engine

Example URI

POST /zephr/feature-decisions
Request  with body
HideShow
Headers
Content-Type: application/json
Cookie: blaize_session=...
Body
{
  "featureIds": [
    "featureX"
  ],
  "session": "xxx-xxx-xxx",
  "referer": "https://www.zephr.com/",
  "path": "/x.html",
  "contentId": "xxx-xxx-xxx",
  "jwt": "xxx-xxx-xxx",
  "customData": {
    "key": "value"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "featureIds": {
      "type": "array",
      "description": "Array of HTML Feature IDs"
    },
    "session": {
      "type": "string",
      "description": "Zephr Session ID"
    },
    "referer": {
      "type": "string",
      "description": "Browser referer"
    },
    "path": {
      "type": "string",
      "description": "Request path, defaults to \"/\""
    },
    "contentId": {
      "type": "string",
      "description": "Content ID, used to perform requests to a 3rd party API for additional content information used in making a decision"
    },
    "jwt": {
      "type": "string",
      "description": "A Json Web Token, may include identity or product holding claims"
    },
    "customData": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "Any key value pair"
        }
      },
      "description": "Custom data to be used in Feature HTML browser rule"
    }
  },
  "required": [
    "featureIds"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "featureResults": {
    "featureX": "blaize.transform.resource('...')"
  },
  "resources": {
    "uiComponents": {
      "...": "<h1>Example</h1>"
    }
  },
  "accessDetails": {
    "authenticated": false,
    "accessDecisions": {
      "...": false
    },
    "entitlements": {
      "...": {
        "usedInDecision": false,
        "decrementedInDecision": false
      }
    },
    "credits": {
      "...": {
        "usedInDecision": false,
        "decrementedInDecision": false,
        "totalCredits": 0,
        "remainingCredits": 0
      }
    },
    "meters": {
      "...": {
        "usedInDecision": false,
        "decrementedInDecision": false,
        "totalCredits": 0,
        "remainingCredits": 0
      }
    },
    "trialTrackingDetails": [
      {
        "entitlementId": "...",
        "entitlementType": "entitlement",
        "trackCreditsUsed": false,
        "trackCreditsRemaining": false,
        "creditsUsedKey": "",
        "creditsRemainingKey": ""
      }
    ]
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "featureResults": {
      "type": "object",
      "properties": {
        "featureX": {
          "type": "string",
          "description": "Feature result transformations"
        }
      },
      "description": "Map of HTML Feature IDs and feature result transformations"
    },
    "resources": {
      "type": "object",
      "properties": {
        "forms": {
          "type": "object",
          "properties": {},
          "description": "Forms used in feature results"
        },
        "paymentForms": {
          "type": "object",
          "properties": {},
          "description": "Payment Forms used in feature results"
        },
        "uiComponents": {
          "type": "object",
          "properties": {
            "...": {
              "type": "string"
            }
          },
          "description": "UI Components used in feature results"
        },
        "hostedUiComponents": {
          "type": "object",
          "properties": {},
          "description": "Hosted UI Components used in feature results"
        },
        "componentTemplates": {
          "type": "object",
          "properties": {},
          "description": "Component Templates used in feature results"
        }
      },
      "description": "Map of transformation resources"
    },
    "accessDetails": {
      "type": "object",
      "properties": {
        "authenticated": {
          "type": "boolean",
          "description": "Is the session authenticated"
        },
        "accessDecisions": {
          "type": "object",
          "properties": {
            "...": {
              "type": "boolean",
              "description": "Whether the user has access or not"
            }
          },
          "description": "Map of access decisions for this feature"
        },
        "entitlements": {
          "type": "object",
          "properties": {
            "...": {
              "type": "object",
              "properties": {
                "usedInDecision": {
                  "type": "boolean"
                },
                "decrementedInDecision": {
                  "type": "boolean"
                }
              }
            }
          },
          "description": "Map of entitlement usage"
        },
        "credits": {
          "type": "object",
          "properties": {
            "...": {
              "type": "object",
              "properties": {
                "usedInDecision": {
                  "type": "boolean"
                },
                "decrementedInDecision": {
                  "type": "boolean"
                },
                "totalCredits": {
                  "type": "number"
                },
                "remainingCredits": {
                  "type": "number"
                }
              }
            }
          },
          "description": "Map of credit usage"
        },
        "meters": {
          "type": "object",
          "properties": {
            "...": {
              "type": "object",
              "properties": {
                "usedInDecision": {
                  "type": "boolean"
                },
                "decrementedInDecision": {
                  "type": "boolean"
                },
                "totalCredits": {
                  "type": "number"
                },
                "remainingCredits": {
                  "type": "number"
                }
              }
            }
          },
          "description": "Map of meter usage"
        },
        "trialTrackingDetails": {
          "type": "array",
          "description": "Array of trial tracking details"
        }
      },
      "description": "Feature access details"
    }
  }
}

OAuth Flow

Start

Start
POST/blaize/oauth/state

Start OAuth Flow

Example URI

POST /blaize/oauth/state
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "start_url": "http://blaize.io",
  "target_url": "http://blaize.io"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "start_url": {
      "type": "string"
    },
    "target_url": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "State initialized"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Google

Google
GET/blaize/oauth/google/callback{?code}

Callback for Google OAuth Flow.

Example URI

GET /blaize/oauth/google/callback?code=
URI Parameters
HideShow
code
string (required) 

OAuth code

Response  302
HideShow
Headers
Location: (string)
Set-Cookie: (string)

Facebook

Facebook
GET/blaize/oauth/facebook/callback{?code}

Callback for Google OAuth Flow.

Example URI

GET /blaize/oauth/facebook/callback?code=
URI Parameters
HideShow
code
string (required) 

OAuth code

Response  302
HideShow
Headers
Location: (string)
Set-Cookie: (string)

Linkedin

Linkedin
GET/blaize/oauth/linkedin/callback{?code}

Callback for Linkedin OAuth Flow.

Example URI

GET /blaize/oauth/linkedin/callback?code=
URI Parameters
HideShow
code
string (required) 

OAuth code

Response  302
HideShow
Headers
Location: (string)
Set-Cookie: (string)

Third-Party Authentication

Oauth2 Auth Code Flow

Start

Start
GET/zephr/oauth2{?client_id,response_type,redirect_uri,scope,state}

Start OAuth2 Authorization Code Flow. The resource owner will be authenticated and will be presented with the third party application access request.

Example URI

GET /zephr/oauth2?client_id=&response_type=&redirect_uri=&scope=&state=
URI Parameters
HideShow
client_id
string (required) 

Zephr Site Oauth2 Client ID

response_type
string (required) 

Must be set to “code”

redirect_uri
string (required) 

Client’s redirection endpoint. Must be an absolute URI.

scope
string (required) 

The scope of the access request.

state
string (required) 

An opaque value used by the client to maintain state between the request and callback.

Response  302
HideShow
Headers
Location: (Error response to the redirect URI with error and state params)

Grant

Grant
POST/zephr/oauth2/grant

The resource owner will consent or deny the third party application access request, and Zephr will return an authorization code upon user’s consent.

Example URI

POST /zephr/oauth2/grant
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "client_id": "1234567890",
  "response_type": "code",
  "redirect_uri": "https://someUrl.com/callback",
  "scope": "user.account:read user.profile:read",
  "state": "abcdefghijklmnopqrstuvwsyz",
  "allow": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "client_id": {
      "type": "string",
      "description": "Zephr Site Oauth2 Client ID"
    },
    "response_type": {
      "type": "string",
      "description": "Must be set to `code`"
    },
    "redirect_uri": {
      "type": "string",
      "description": "Client's redirection endpoint. Must be an absolute URI"
    },
    "scope": {
      "type": "string",
      "description": "The scope of the access request. Supported scopes: user.account:read, user.profile:read and user.profile:update"
    },
    "state": {
      "type": "string",
      "description": "An opaque value used by the client to maintain state between the request and callback"
    },
    "allow": {
      "type": "boolean",
      "description": "Resource owner consent"
    }
  },
  "required": [
    "client_id",
    "response_type",
    "redirect_uri",
    "scope",
    "state",
    "allow"
  ]
}
Response  200
HideShow
Headers
Location: (Successful response to the redirect URI with code and state params)
Body
{
  "state": "Hello, world!",
  "code": "Hello, world!"
}
Schema
{
  "type": "object",
  "properties": {
    "state": {
      "type": "string",
      "description": "State (string)"
    },
    "code": {
      "type": "string",
      "description": "Authorization code (string)"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  401
HideShow
Body
{
  "state": "Hello, world!",
  "error": "Hello, world!"
}
Schema
{
  "type": "object",
  "properties": {
    "state": {
      "type": "string",
      "description": "State (string)"
    },
    "error": {
      "type": "string",
      "description": "Error type (string)"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}

Braintree Payments

Get Braintree Token

Get Braintree Token
GET/blaize/payment/braintree/token

Issue a Braintree client token for the current blaize session. This holds the user’s userId, and can be used to request a payment nonce.

Example URI

GET /blaize/payment/braintree/token
Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "eyJ2ZXmsaW5nQW...(lots more random-looking characters)...dyZWmVubW8iOiJvZmYifQ=="
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string"
    }
  }
}
Response  401

Start Braintree Subscription

Start Braintree Subscription
POST/blaize/payment/braintree/subscribe

Use the payment info captured by the braintree drop-in UI and encoded in the payment nonce to create a braintree customer in with a recurring payment. When braintree responds successfully, the logged-in user will be temporarily granted all entitlements in the product’s associated bundle.

Example URI

POST /blaize/payment/braintree/subscribe
Request  with body
HideShow
Headers
Content-Type: application/json
cookie: `blaize_session=...` (string)
Body
{
  "product_id": "premium-access-monthly-recurring",
  "payment_nonce": "eyJ2ZXmsaW5nQW...(lots more random-looking characters)...dyZWmVubW8iOiJvZmYifQ==",
  "skip_trial_period": true,
  "start_date": "2021-01-01T00:00:00Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "product_id": {
      "type": "string",
      "description": "Product Id/slug"
    },
    "payment_nonce": {
      "type": "string",
      "description": "Payment method nonce from Braintree drop-in UI"
    },
    "skip_trial_period": {
      "type": "boolean",
      "description": "Whether or not to skip any trial period that may be associated with this subscription. This should be `null` or not set to use the configured trial period."
    },
    "start_date": {
      "type": "string",
      "description": "ISO 8601 date format which determines when the subscription will start. When the attribute is passed, the value must be in the future. Otherwise, the subscription is expected to start immediately."
    }
  },
  "required": [
    "product_id",
    "payment_nonce"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "grant_id": "33d576c7-d036-40e7-8141-8a91998a5c79"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "grant_id": {
      "type": "string",
      "description": "New grant of product bundle to user"
    }
  }
}
Response  400
Response  401

Subscription start callback

Callback
POST/blaize/payment/braintree/subscriptionChargedCallback/

To use subscriptions, braintree callback must be configured to point to this endpoint.

Example URI

POST /blaize/payment/braintree/subscriptionChargedCallback/
Request  with body
HideShow
Headers
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json

User Braintree subscriptions

List User Braintree subscriptions
GET/blaize/payment/braintree/subscriptions

List all Braintree subscriptions for the logged-in user.

Example URI

GET /blaize/payment/braintree/subscriptions
Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "8m2kc5g",
  "managed-by": "Braintree",
  "external-id": "abc123",
  "next-billing-time": "2021-05-17T04:31:33Z",
  "ends": "2021-05-17T04:31:33Z",
  "blaize-product": {
    "id": "one-month-one-off",
    "label": "One month access",
    "description": "One month access"
  },
  "transaction-history": [
    {
      "human-readable-amount": "$2.34",
      "time": "Hello, world!",
      "currency": "$",
      "cents": 234,
      "cycle": "month",
      "cycleCount": 1,
      "taxRate": {
        "taxPercent": 15,
        "isTaxInclusive": true,
        "displayName": "VAT",
        "active": true
      }
    }
  ],
  "subscription-state": "active",
  "paid_through_date": "2021-05-17T04:31:33Z",
  "plan_id": "plan-123",
  "plan_name": "monthly-plan"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "The token identifier for this payment method."
    },
    "managed-by": {
      "type": "string"
    },
    "external-id": {
      "type": "string",
      "description": "The ID for this subscription in Braintree."
    },
    "next-billing-time": {
      "type": "string",
      "description": "ISO-8601 formatted time at which the subsciption will next be billed."
    },
    "ends": {
      "type": "string",
      "description": "ISO-8601 formatted time at which the subscription is expected to end."
    },
    "blaize-product": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Zephr product ID"
        },
        "label": {
          "type": "string",
          "description": "Zephr product label"
        },
        "description": {
          "type": "string",
          "description": "Description of Zephr product"
        }
      },
      "description": "The Zephr product associated with this subscription."
    },
    "transaction-history": {
      "type": "array"
    },
    "subscription-state": {
      "type": "string",
      "description": "The subscription state, as acquired from Braintree."
    },
    "paid_through_date": {
      "type": "string",
      "description": "ISO-8601 formatted time up to which the subscription has been paid for. This will be `null` if the subscription has not yet been paid for."
    },
    "plan_id": {
      "type": "string",
      "description": "The Braintree plan ID"
    },
    "plan_name": {
      "type": "string",
      "description": "The Braintree plan name"
    }
  },
  "required": [
    "token",
    "managed-by",
    "external-id",
    "next-billing-time",
    "ends",
    "blaize-product",
    "transaction-history",
    "subscription-state",
    "plan_id",
    "plan_name"
  ]
}
Response  401
Response  404

Modify Braintree Subscription

Update Braintree Subscription
PATCH/blaize/payment/braintree/subscriptions/{subscriptionId}

Update a Braintree subscription by ID. This currently only supports updating the payment method for a subscription.

Example URI

PATCH /blaize/payment/braintree/subscriptions/subscriptionId
URI Parameters
HideShow
subscriptionId
string (required) 

Subscription ID

Request  with body
HideShow
Headers
Content-Type: application/json
cookie: `blaize_session=...` (string)
Body
{
  "payment_method_token": "alpha123token"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "payment_method_token": {
      "type": "string",
      "description": "Payment method token referencing a payment method in Braintree."
    }
  }
}
Response  204
Response  401
Response  404

Cancel Braintree Subscription
DELETE/blaize/payment/braintree/subscriptions/{subscriptionId}

Cancel a Braintree subscription by ID.

Example URI

DELETE /blaize/payment/braintree/subscriptions/subscriptionId
URI Parameters
HideShow
subscriptionId
string (required) 

Subscription ID

Response  200
Response  404
Response  409

Braintree Buy One-Off

Braintree Buy (one-off)
POST/blaize/payment/braintree/buy

Use the payment info captured by the braintree drop-in UI and encoded in the payment nonce to create a braintree customer and issue a one-off payment. When braintree responds successfully, the logged-in user will be granted all entitlements in the product’s associated bundle.

Example URI

POST /blaize/payment/braintree/buy
Request  with body
HideShow
Headers
Content-Type: application/json
cookie: `blaize_session=...` (string)
Body
{
  "product_id": "lifetime-membership",
  "price_point_id": "gold-package",
  "payment_nonce": "eyJ2ZXmsaW5nQW...(lots more random-looking characters)...dyZWmVubW8iOiJvZmYifQ=="
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "product_id": {
      "type": "string",
      "description": "Product Id/slug"
    },
    "price_point_id": {
      "type": "string",
      "description": "Price Point Id/slug"
    },
    "payment_nonce": {
      "type": "string",
      "description": "Payment method nonce from Braintree drop-in UI"
    }
  },
  "required": [
    "product_id",
    "price_point_id",
    "payment_nonce"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "grant_id": "aa583cb8-51d1-4bd9-9ec7-3a43796ef8e5"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "grant_id": {
      "type": "string",
      "description": "New grant of product bundle to user"
    }
  }
}
Response  400
Response  401
Response  404

Braintree User Payment Methods

Braintree List User Payment Methods
GET/zephr/payment/braintree/payment-methods

List the Braintree payment methods details associated with the logged-in user.

Example URI

GET /zephr/payment/braintree/payment-methods
Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "token": "8m2kc5g",
    "default": false,
    "card_type": "Visa",
    "card_holder_name": "John Rambo",
    "card_number_masked": "654321******0987",
    "expiration_date": "07/22",
    "expired": false,
    "expiring_soon": false,
    "in_use": false,
    "last_4": "1111",
    "nonce": "086128f3-04c2-069e-78d2-3f4de98508e5",
    "type": "CreditCard",
    "zipcode": "123456"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}
Response  401
HideShow
Headers
Content-Type: application/json
Response  404
HideShow
Headers
Content-Type: application/json

Braintree Create User Payment Method
POST/zephr/payment/braintree/payment-methods

Create the Braintree payment method with the associated vaulted nonce, for the authenticated user.

Example URI

POST /zephr/payment/braintree/payment-methods
Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Body
{
  "payment_method_nonce": "aa583cb8...and other characters...3a43796ef8e5"
}
Schema
{
  "type": "object",
  "properties": {
    "payment_method_nonce": {
      "type": "string",
      "description": "The vaulted nonce associated with the new payment method"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "8m2kc5g",
  "default": false,
  "card_type": "Visa",
  "card_holder_name": "John Rambo",
  "card_number_masked": "654321******0987",
  "expiration_date": "07/22",
  "expired": false,
  "expiring_soon": false,
  "in_use": false,
  "last_4": "1111",
  "nonce": "086128f3-04c2-069e-78d2-3f4de98508e5",
  "type": "CreditCard",
  "zipcode": "123456"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "The token identifier for this payment method."
    },
    "default": {
      "type": "boolean",
      "description": "If this the default payment method for this user."
    },
    "card_type": {
      "type": "string",
      "description": "In the case of a card payment method, the type of the card."
    },
    "card_holder_name": {
      "type": "string",
      "description": "In the case of a credit card payment method, the name of the card holder."
    },
    "card_number_masked": {
      "type": "string",
      "description": "In the case of a card payment method, the masked card number, compliant with PCI security standards."
    },
    "expiration_date": {
      "type": "string",
      "description": "In the case of a card payment method, the expiration date, in the format of MM/YY or MM/YYYY."
    },
    "expired": {
      "type": "boolean",
      "description": "In the case of a card payment method, if the card has expired."
    },
    "expiring_soon": {
      "type": "boolean",
      "description": "In the case of a card payment method, if the card will expire within the configured number of days."
    },
    "in_use": {
      "type": "boolean",
      "description": "Indicates if this payment method is used by any subscriptions that have not been finalised and would be cancelled if this payment method is deleted."
    },
    "last_4": {
      "type": "string",
      "description": "In the case of a card payment method, the last four digits of the card number."
    },
    "nonce": {
      "type": "string",
      "description": "A nonce that can be used for other payment method operations."
    },
    "type": {
      "type": "string",
      "description": "The payment method type."
    },
    "zipcode": {
      "type": "string",
      "description": "In the case of a card payment method, the zip code associated with the card."
    }
  },
  "required": [
    "token",
    "default",
    "nonce",
    "type"
  ]
}
Response  401
HideShow
Headers
Content-Type: application/json
Response  404
HideShow
Headers
Content-Type: application/json

Braintree User Payment Method

Braintree Update User Payment Method
PATCH/zephr/payment/braintree/payment-methods/{paymentMethodToken}

Update the Braintree payment method details associated with the logged-in user. The details to update must first be captured from Braintree in a nonce and vaulted.

Example URI

PATCH /zephr/payment/braintree/payment-methods/paymentMethodToken
URI Parameters
HideShow
paymentMethodToken
string (required) 

The unique ID of the payment method

Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Body
{
  "payment_method_nonce": "aa583cb8...and other characters...3a43796ef8e5"
}
Schema
{
  "type": "object",
  "properties": {
    "payment_method_nonce": {
      "type": "string",
      "description": "The vaulted nonce associated with the update payment method"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "8m2kc5g",
  "default": false,
  "card_type": "Visa",
  "card_holder_name": "John Rambo",
  "card_number_masked": "654321******0987",
  "expiration_date": "07/22",
  "expired": false,
  "expiring_soon": false,
  "in_use": false,
  "last_4": "1111",
  "nonce": "086128f3-04c2-069e-78d2-3f4de98508e5",
  "type": "CreditCard",
  "zipcode": "123456"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "The token identifier for this payment method."
    },
    "default": {
      "type": "boolean",
      "description": "If this the default payment method for this user."
    },
    "card_type": {
      "type": "string",
      "description": "In the case of a card payment method, the type of the card."
    },
    "card_holder_name": {
      "type": "string",
      "description": "In the case of a credit card payment method, the name of the card holder."
    },
    "card_number_masked": {
      "type": "string",
      "description": "In the case of a card payment method, the masked card number, compliant with PCI security standards."
    },
    "expiration_date": {
      "type": "string",
      "description": "In the case of a card payment method, the expiration date, in the format of MM/YY or MM/YYYY."
    },
    "expired": {
      "type": "boolean",
      "description": "In the case of a card payment method, if the card has expired."
    },
    "expiring_soon": {
      "type": "boolean",
      "description": "In the case of a card payment method, if the card will expire within the configured number of days."
    },
    "in_use": {
      "type": "boolean",
      "description": "Indicates if this payment method is used by any subscriptions that have not been finalised and would be cancelled if this payment method is deleted."
    },
    "last_4": {
      "type": "string",
      "description": "In the case of a card payment method, the last four digits of the card number."
    },
    "nonce": {
      "type": "string",
      "description": "A nonce that can be used for other payment method operations."
    },
    "type": {
      "type": "string",
      "description": "The payment method type."
    },
    "zipcode": {
      "type": "string",
      "description": "In the case of a card payment method, the zip code associated with the card."
    }
  },
  "required": [
    "token",
    "default",
    "nonce",
    "type"
  ]
}
Response  400
HideShow
Headers
Content-Type: application/json
Response  401
HideShow
Headers
Content-Type: application/json
Response  404
HideShow
Headers
Content-Type: application/json

Braintree Delete User Payment Method
DELETE/zephr/payment/braintree/payment-methods/{paymentMethodToken}

Delete the Braintree payment method associated with the provided token.

Example URI

DELETE /zephr/payment/braintree/payment-methods/paymentMethodToken
URI Parameters
HideShow
paymentMethodToken
string (required) 

The unique ID of the payment method

Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Response  204
Response  401
HideShow
Headers
Content-Type: application/json
Response  404
HideShow
Headers
Content-Type: application/json

Braintree User Default Payment Method

Braintree Set User Default Payment Method
PUT/zephr/payment/braintree/default-payment-method

Set the Braintree default payment method for the logged-in user. This must be a valid payment method already associated with the user.

Example URI

PUT /zephr/payment/braintree/default-payment-method
Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Body
{
  "payment_method_token": "payment-method-123"
}
Schema
{
  "type": "object",
  "properties": {
    "payment_method_token": {
      "type": "string",
      "description": "The unique ID of the payment method to be set as default for the user"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  204
Response  400
HideShow
Headers
Content-Type: application/json
Response  401
HideShow
Headers
Content-Type: application/json
Response  404
HideShow
Headers
Content-Type: application/json

Braintree Plans

Braintree List Plans
GET/zephr/payment/braintree/plans{?product_id}

List the plans associated with the identified product. The product ID is required.

Example URI

GET /zephr/payment/braintree/plans?product_id=
URI Parameters
HideShow
product_id
string (required) 

Product ID

Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "plan-id": {
    "id": "annual-plan",
    "name": "Sports+ Membership Annual",
    "currency_code": "USD",
    "base_price": 10.2,
    "billing_interval_unit": "MONTH",
    "billing_interval": 3,
    "billing_cycles": 12,
    "trial_duration_unit": "DAY",
    "trial_duration": 30,
    "discounts": [
      {
        "id": "annual-discount",
        "name": "Sports+ Membership Discount",
        "description": "This is a discount description",
        "amount": "9.99",
        "billing_cycles": "6",
        "current_billing_cycle": "4"
      }
    ],
    "zephr_product_id": "product-123"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "$ref": "#/definitions/plan-id",
  "definitions": {
    "plan-id": {
      "type": "object",
      "patternProperties": {
        "": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "The identifier for this payment plan."
            },
            "name": {
              "type": "string",
              "description": "The name of this payment plan."
            },
            "currency_code": {
              "type": "string",
              "description": "The ISO 4217 currency code for the transaction."
            },
            "base_price": {
              "type": "number",
              "description": "The price of this plan, without any discounts applied."
            },
            "billing_interval_unit": {
              "type": "string",
              "description": "The time measurement unit for billing interval."
            },
            "billing_interval": {
              "type": "number",
              "description": "How many time units lapse between billing events."
            },
            "billing_cycles": {
              "type": "number",
              "description": "How many times billing will occur."
            },
            "trial_duration_unit": {
              "type": "string",
              "description": "The time measurement unit for trial duration. This will always be present if `trial_duration` is set."
            },
            "trial_duration": {
              "type": "number",
              "description": "How long the trial period lasts."
            },
            "discounts": {
              "type": "array",
              "description": "Any discounts that may apply to this plan."
            },
            "zephr_product_id": {
              "type": "string",
              "description": "The Zephr product ID associated with this plan."
            }
          },
          "required": [
            "id",
            "name",
            "currency_code",
            "base_price",
            "billing_interval_unit",
            "billing_interval",
            "billing_cycles",
            "zephr_product_id"
          ]
        }
      }
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Response  401
HideShow
Headers
Content-Type: application/json
Response  404
HideShow
Headers
Content-Type: application/json

Braintree Get Promo Code

Braintree Get Promo Code
GET/blaize/payment/braintree/promo-code{?code,paymentForm}

Get a Braintree promo code.

Example URI

GET /blaize/payment/braintree/promo-code?code=&paymentForm=
URI Parameters
HideShow
code
string (required) 

promo code to lookup by ID

paymentForm
string (required) 

payment form to lookup by slug

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": "promo-123",
  "discount": 20,
  "paymentOptions": [
    {
      "slug": "plan-123",
      "currency": "$",
      "pricePointId": "cost-123",
      "originalPrice": 3.45,
      "discountPrice": 2
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "The promo code identifier."
    },
    "discount": {
      "type": "number",
      "description": "The discount amount."
    },
    "paymentOptions": {
      "type": "array",
      "description": "The list of payment options."
    }
  },
  "required": [
    "code",
    "discount",
    "paymentOptions"
  ]
}
Response  400
Response  401
Response  403
Response  404

Braintree List Add-ons

Braintree List Add-ons
GET/blaize/payment/braintree/addons{?paymentForm}{&promoCode}

Get a list of Braintree add-ons.

Example URI

GET /blaize/payment/braintree/addons?paymentForm=&promoCode=
URI Parameters
HideShow
paymentForm
string (required) 

payment form to lookup by slug

promoCode
string (optional) 

promo code to lookup by ID

Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": "add-123",
    "label": "Easy Add-on",
    "value": 12,
    "type": "PERCENT",
    "paymentOptions": [
      {
        "slug": "plan-123",
        "currency": "$",
        "addonPrice": 12.34
      }
    ]
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}
Response  400
Response  401
Response  403
Response  404

Stripe Payments

Get Stripe Public Key

Get Stripe Public Key
GET/blaize/payment/stripe/publicKey

Retrieve the public key for a tenant to process a payment

Example URI

GET /blaize/payment/stripe/publicKey
Request
HideShow
Headers
cookie: `blaize_session=...` (string)
Response  200
HideShow
Headers
Content-Type: application/json
Body
pk_live_PFghBsstUo5FwUGcXBiNvIkY00X1YHtpnJ - String key

Start Stripe Subscription

Start Stripe Subscription
POST/blaize/payment/stripe/subscribe

Use the payment method info captured by the Stripe Elements UI to create a Stripe customer with a recurring payment. When Stripe responds successfully, the logged-in user will be temporarily granted all entitlements in the product’s associated bundle.

Example URI

POST /blaize/payment/stripe/subscribe
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "product_id": "premium-access-monthly-recurring",
  "payment_method": "pm_123456789"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "product_id": {
      "type": "string",
      "description": "Product Id/slug"
    },
    "payment_method": {
      "type": "string",
      "description": "Payment method from Stripe Elements UI"
    }
  },
  "required": [
    "product_id",
    "payment_method"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "grant_id": "33d576c7-d036-40e7-8141-8a91998a5c79",
  "clientSecret": "src_client_secret_QfsM25CJ2uCMon72MiOmUNTj",
  "paymentIntentStatus": "requires_action | requires_payment_method"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "grant_id": {
      "type": "string",
      "description": "New grant of product bundle to user"
    },
    "clientSecret": {
      "type": "string",
      "description": "reference to Stripe payment required to process payment in front end"
    },
    "paymentIntentStatus": {
      "type": "string",
      "description": "status of the payment which may require further action"
    }
  }
}

Start Stripe Subscription Confirmation

Start Stripe Subscription Confirmation
POST/blaize/payment/stripe/subscription/confirmation

If a payment requires confirmation (3dSecure etc), the payment is confirmed in the front end,

Example URI

POST /blaize/payment/stripe/subscription/confirmation
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "subscriptionId": "sub_H8eIeMFwMawg6w"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "subscriptionId": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "grant_id": "aa583cb8-51d1-4bd9-9ec7-3a43796ef8e5"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "grant_id": {
      "type": "string",
      "description": "New grant of product bundle to user"
    }
  }
}

Stripe Buy

Stripe Buy
POST/blaize/payment/stripe/buy

Uses the payment method collected by Stripe Elements to create a one off payment

Example URI

POST /blaize/payment/stripe/buy
Request  with body
HideShow
Headers
Content-Type: application/json
Body
{
  "product_id": "lifetime-membership",
  "price_point_id": "gold-package",
  "payment_method": "pm_123456789",
  "payment_intent_id": "pi_1GYZYWLgUJT2XNPAYQMomeqf"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "product_id": {
      "type": "string",
      "description": "Product Id/slug"
    },
    "price_point_id": {
      "type": "string",
      "description": "Price Point Id/slug"
    },
    "payment_method": {
      "type": "string",
      "description": "Payment method from Stripe Elements UI"
    },
    "payment_intent_id": {
      "type": "string",
      "description": "PaymentIntent id returned after confirming a card payment"
    }
  },
  "required": [
    "product_id",
    "price_point_id",
    "payment_method"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "grant_id": "aa583cb8-51d1-4bd9-9ec7-3a43796ef8e5",
  "client_secret": "src_client_secret_QfsM25CJ2uCMon72MiOmUNTj`",
  "payment_intent_id": "pi_1GYZYWLgUJT2XNPAYQMomeqf"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "grant_id": {
      "type": "string",
      "description": "New grant of product bundle to user"
    },
    "client_secret": {
      "type": "string",
      "description": "reference to Stripe payment required to process payment in front end"
    },
    "payment_intent_id": {
      "type": "string",
      "description": "reference to the payment intent if payment requires confirmation"
    }
  }
}

WebHook

WebHook
POST/blaize/payment/stripe/subscriptionChargedCallback

To use subscriptions, Stripe Webhooks for invoice.payment_succeeded must be configured to point to this endpoint.

Example URI

POST /blaize/payment/stripe/subscriptionChargedCallback
Request  with body
HideShow
Headers
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json

Web Analytics

Get Datalayer

Get Datalayer
GET/blaize/datalayer

Get the datalayer object for the current session. All fields configured in the admin console will be resolved against the current session and returned

Example URI

GET /blaize/datalayer
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "dataLayer": [
    "[ {key1: value1}, {key2: value2} ]"
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "dataLayer": {
      "type": "array",
      "description": "Resolved datalayer fields. Any fields that cannot be resolved will be present as fieldKey: null"
    }
  }
}

Generated by aglio on 18 Oct 2021