ReWorth rewards API [public] (0.9.16.2)

Download OpenAPI specification:Download

John P Falcón, CTO & Co-founder at Reworth: john.f@reworth.co

ReWorth rewards REST API specification according to the standard OpenApi 3.0.0

The following document details the current-state of the [public] endpoints for the API, as well as the methods and parameters that can be sent to each of them. The document also provides additional sections with available dynamic flags and filtering parameters on some of the endpoints.

The authentication endpoint returns a jwt (access token) valid for 1 week. With this token you can perform further calls to the service as long as your user role is authorized to access that resource and/or own that same resource.

  • Merchants have limited access to the api resources and are subject to the ownership rules across all namespaces. For a vendor to perform requests directly to the API they has to be approved first by one of ReWorth's account managers. Once approved, the email/password credentials become active for use with the sandbox api server.

  • Banks have more broad access to the api public resources and are as well subject to ownership rules across the system. For a financial institution to perform requests directly to the API the credentials have to be approved first by one of ReWorth's implementation engineers. Once approved, the key/secret credentials become active for use with the sandbox server.

  • Guests, who have limited to no access to the API only can perform operations that definitely don’t require authentication, such as the authentication itself or the public offer directory.

Authentication

httpBearer

Security Scheme Type HTTP
HTTP Authorization Scheme bearer
Bearer format "JWT"

Health

General API status and service health as well as the version you are currently running

Ping check

Ping the API to check for connectivity issues. This endpoint doesn't perform any operations to the database, although it serves the purpose of checking API health status.

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "These are not the droids you're looking for...",
  • "data": {
    }
}

Auth

Authentication with the API and token validation type of operations

Sign In

Attempt to authenticate with the API using the credential pair previously validated by the Reworth team.

If the request is successful, the response will contain an access_token to be used in further requests.

Request Body schema: application/json
key
required
string
secret
required
string

Responses

Request samples

Content type
application/json
{
  • "key": "4b3588a8648202a1f503e9...20ea2dd830c41a235efc10a",
  • "secret": "$2a$08$v685soRwvux2F...rbnGPWcUS0ZKT.isyOe"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "data": {
    },
  • "message": "string"
}

Check token validity [server-side]

Check a provided token for Validity on the server side. Remember if you're trying to figure out if the token has expired you could use JWT implementation to validate it. If your implementation authenticates with the API once every execution it's recommended to run this request before to avoid getting TokenNotValid Error if it has already expired.

Authorizations:

Responses

Refresh access token

Ask for a new token, regardless of the expiration of the current one. A new token will only be provided if the expiration date is less or equal than two hours for usage reasons. If you’re trying to figure out if your token is still valid, pleas refer to the previous endpoint .../auth/validate

Authorizations:

Responses

Offers

Operations concerning your offer entities

Create offer

Creates a new Offer from the provided data. An address document can be used to attach to a business or a venue

Request Body schema: application/json
name
required
string
venues
required
Array of strings
discount
required
string
required
object (Rules)
status
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "5% off",
  • "venues": [
    ],
  • "discount": 0.05,
  • "rules": {
    },
  • "status": "active"
}

List offers

List all or requested COUNT of offers

Responses

Find offer by Id

path Parameters
offer_object_id
required
string

Responses

Update offer

path Parameters
offer_object_id
required
string
Request Body schema: application/json
name
required
string
required
object (RulesEdit)

Responses

Request samples

Content type
application/json
{
  • "name": "",
  • "rules": {
    }
}

Dispatch offer for a pending transaction [sync]

Dispatch a tailored offer por pending transactions based on the same payload as posting a transaction:

Request Body schema: application/json
concept
required
string
amount
required
integer <int32>
uuid
required
string
required
object (Payload)

Responses

Request samples

Content type
application/json
{
  • "concept": "Coffee table 11",
  • "amount": 13500,
  • "uuid": "5e8addccb42f752cfb36f2b4",
  • "merchant_id": "8af57ncb42f7549dfb36f2",
  • "payload": {
    }
}

Directory

Contains available actions on the public offer directory namespace

Offer directory

List the Reworth cashback directory. Optionally you can filter the request using categories, location or by providing a uuid to match our cluster information.

query Parameters
category
Array of strings
Example: category=restaurant&category=bar
latlng
string
Example: latlng=19.4153209,-99.1804722
uuid
string
Example: uuid=A988H0298989

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "data": [
    ],
  • "pages": 1,
  • "page": 1,
  • "hasPrevPage": false,
  • "hasNextPage": false
}

Transactions

Contains operations available for the transactioning micro-service

Post a new transaction

Creates a new Transaction entity to be processed and redeemed if valid

Request Body schema: application/json
concept
required
string
amount
required
integer <int32>
uuid
required
string
required
object (Payload)

Responses

Request samples

Content type
application/json