NAV Navbar
Logo
shell javascript

Introduction

SDK Initialization


window.rehive = new Rehive({apiVersion: 3});

API Endpoint

https://rehive.com/api/3/

The Rehive API is the core interface for communicating with Rehive. The API is organized around REST with predictable resource oriented URLs. Standard HTTP verbs, codes and authentication methods are used alongside JSON to ensure ease of implementation.

JSON is returned by all API responses. API errors will result in a JSON response as well as a corresponding HTTP response code. For more on errors take a look at errors.

Browsable API

To ensure the API is easily explorable Rehive has implemented a browsable API. In addition to ease of navigation, you can experiment with different request formats and methods straight from within your browser:

Browsable API

Errors

Basic error response:

{
    "status": "error",
    "message": "Error message."
}
{
    "message": "Error message."
}

Multiple errors response:

 {
    "status": "error",
    "message": "First error message, Second error message",
    "data": {
        "field_name1": [
            "First error message."
        ],
        "field_name2": [
            "Second error message."
        ]
    }
}
 {
    "field_name1": [
        "First error message."
    ],
    "field_name2": [
        "Second error message."
    ]
}

Rehive errors return an API response message (formatted in JSON) as well as a standard HTTP response code.

The JSON error respone generally includes a message string. If an error occurred on a specific attribute or key they will be outputted in the data object.

Authentication

The authentication endpoints provide the core for all Rehive access control. This includes such tasks as registration, login, verification, password changes and lost password retrievals.

Authorization

Rehive uses a token-based HTTP Authentication scheme.

Once a user has logged in and received a token, each subsequent request should include the token in the HTTP Authorization header.

Tokens expire 10 hours after creation. Once a token has expired, login is required in order to re-authenticate.

Rehive’s tokens allow for a single user to have multiple active tokens on separate devices as well as the ability for admin users to create tokens that do not expire.

Authorization Header

Token authorization request

curl https://www.rehive.com/api/3/
  -H "Authorization: Token {token}"
"Not applicable for sdk"

When making requests, the API key should be included as a token in the Authorization header:

Authorization: Token {token}

Register

User registration request

curl https://www.rehive.com/api/3/auth/register/
  -X POST
  -H "Content-Type: application/json"
  -d '{"first_name": "Joe",
       "last_name": "Soap",
       "email": "joe@rehive.com",
       "company": "rehive",
       "password1": "joe1234",
       "password2":"joe1234"}'
rehive.auth.register(
        {first_name: "Joe",
         last_name: "Soap",
         email: "joe@rehive.com",
         company: "rehive",
         password1: "joe1234",
         password2:"joe1234"
        }).then(function(user){
            // ...
        },function(err){
            // ...
        });

User registration response

  {
    "status": "success"
    "data": {
      "token": "{token}",
      "user": {
        "identifier": "00000000-0000-0000-0000-000000000000",
        "email": "joe@rehive.com",
        "mobile_number": "+00000000000",
        "first_name": "Joe",
        "last_name": "Soap",
        "company": "rehive",
        "profile": null,
        "language": "en"
      }
    }
  }
{
  "identifier": "00000000-0000-0000-0000-000000000000",
  "email": "joe@rehive.com",
  "mobile_number": "+00000000000",
  "first_name": "Joe",
  "last_name": "Soap",
  "company": "rehive",
  "profile": null,
  "language": "en"
}

Register a user with the credentials provided. A successful registration will return the user’s details and a token that can be used for subsequent requests.

Endpoint

https://rehive.com/api/3/auth/register/

Fields

Field Description Default Required
first_name first name null true
last_name last name null true
email email address null true
mobile_number mobile number null false
company company identifier null true
password1 password null true
password2 repeat password null true

Login

User login request

curl https://www.rehive.com/api/3/auth/login/
  -X POST
  -H "Content-Type: application/json"
  -d '{"user": "joe@rehive.com",
       "company": "rehive"
       "password": "joe1234"}'
rehive.auth.login({
            user: "joe@rehive.com",
            company: "rehive",
            password: "joe1234"
        }).then(function(user){
            console.log(user);
            },function(err){
            // ...
        })

User login response

  {
    "status": "success"
    "data": {
      "token": "{token}",
      "user": {
        "identifier": "00000000-0000-0000-0000-000000000000",
        "email": "joe@rehive.com",
        "mobile_number": "+00000000000",
        "first_name": "Joe",
        "last_name": "Soap",
        "company": "rehive",
        "profile": null,
        "language": "en"
      }
    }
  }
{
  "identifier": "00000000-0000-0000-0000-000000000000",
  "email": "joe@rehive.com",
  "mobile_number": "+00000000000",
  "first_name": "Joe",
  "last_name": "Soap",
  "company": "rehive",
  "profile": null,
  "language": "en"
}

Login a user with the credentials provided. A successful login will return the user’s details and a token that can be used for subsequent requests.

Endpoint

https://rehive.com/api/3/auth/login/

Fields

Field Description Default Required
user email, mobile number, unique identifier null true
company company identifier null true
password password null true

Logout

User logout request

curl https://www.rehive.com/api/3/auth/logout/
  -X POST
  -H "Content-Type: application/json"
  -H "Authorization: Token {token}"
rehive.auth.logout().then(function(res){
        // ...
    },function(err){
        // ...
    })

User logout response

{
  "message": "Successfully logged out.",
  "status": "success"
}
{
  "message": "Successfully logged out."
}

Logs the current user out and invalidates the token that was used to authenticate.

Endpoint

https://rehive.com/api/3/auth/logout/

Logout All

User logout all request

curl https://www.rehive.com/api/3/auth/logout/all/
  -X POST
  -H "Content-Type: application/json"
  -H "Authorization: Token {token}"
rehive.auth.logoutAll().then(function(res){
            // ...
        }, function (err){
            // ...
        })

User logout all response

{
  "message": "Successfully logged out all sessions.",
  "status": "success"
}
{
  "message": "Successfully logged out all sessions."
}

Logs the current user out and invalidates all the tokens related to the user that have expiry dates.

Endpoint

https://rehive.com/api/3/auth/logout/all/

Change Password

User change password request

curl https://www.rehive.com/api/3/auth/password/change/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"old_password": "joe1234",
       "new_password1": "joe1234",
       "new_password2": "joe1234"}'
rehive.auth.changePassword(
        {
            old_password: "joe1234",
            new_password1: "joe1234",
            new_password2: "joe1234"
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User change password response

{
  "message": "New password has been saved.",
  "status": "success"
}
{
  "message": "New password has been saved."
}

Change a user’s password.

Endpoint

https://rehive.com/api/3/auth/password/change/

Fields

Field Description Default Required
old_password old password null true
new_password1 new password null true
new_password2 confirm new password null true

Reset Password

User reset password request

curl https://www.rehive.com/api/3/auth/password/reset/
  -X POST
  -H "Content-Type: application/json"
  -d '{"user": "joe@rehive.com",
       "company": "rehive"}'
rehive.auth.resetPassword(
        {
            user: "joe@rehive.com",
            company: "rehive"
        }).then(function(res){
            // ...
        }, function (err) {
            // ...
        })

User reset password response

{
  "message": "Password reset message has been sent.",
  "status": "success"
}
{
  "message": "Password reset message has been sent."
}

Send a password reset email.

Endpoint

https://rehive.com/api/3/auth/password/reset/

Fields

Field Description Default Required
user email, mobile number, unique identifier null true
company company identifier null true

Reset Confirm Password

User reset confirm password request

curl https://www.rehive.com/api/3/auth/password/reset/confirm/
  -X POST
  -H "Content-Type: application/json"
  -d '{"new_password1": "joe1234",
       "new_password2": "joe1234",
       "uid": "{uid}",
       "token": "{token}"}'
rehive.auth.resetConfirmPassword(
        {
            new_password1: "joe1234",
            new_password2: "joe1234",
            uid: "{uid}",
            token: "{token}"
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User reset confirm password response

{
  "message": "Password has been reset with the new password.",
  "status": "success"
}
{
  "message": "Password has been reset with the new password."
}

Reset a password using a reset token and uid. These details are sent in an email by Rehive.

Endpoint

https://rehive.com/api/3/auth/password/reset/confirm/

Fields

Field Description Default Required
new_password1 password null true
new_password2 password confirm null true
uid uniqie identifer for reset null true
token uniqie token for reset null true

Resend Email Verification

User resend email verification request

curl https://www.rehive.com/api/3/auth/email/verify/resend/
  -X POST
  -H "Content-Type: application/json"
  -d '{"email": "joe@rehive.com",
       "company": "rehive"}'
rehive.auth.resendEmailVerification(
        {
            email: "joe@rehive.com",
            company: "rehive"
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User resend email verification response

{
  "status": "success"
}
{ }

Resend email verifications for an email.

Endpoint

https://rehive.com/api/3/auth/email/verify/resend/

Fields

Field Description Default Required
email email address null true
company company identifier null true

Resend Mobile Verification

User resend mobile verification request

curl https://www.rehive.com/api/3auth/mobile/verify/resend/
  -X POST
  -H "Content-Type: application/json"
  -d '{"mobile": "+27840000000",
       "company": "rehive"}'
rehive.auth.resendMobileVerification(
        {
            mobile: "+27840000000",
            company: "rehive"
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User resend mobile verification response

{
  "status": "success"
}
{ }

Resends mobile verifications for a mobile number.

Endpoint

https://www.rehive.com/api/3/auth/mobile/verify/resend/

Fields

Field Description Default Required
mobile mobile number null true
company company identifier null true

Verify Mobile

User verify mobile request

curl https://rehive.com/api/3/auth/mobile/verify/
  -X POST
  -H "Content-Type: application/json"
  -d '{"otp": "{otp}"}'
rehive.auth.verifyMobile(
        {
            otp: "{otp}"
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User verify mobile response

{
  "status": "success"
}
{ }

Verify a mobile number with an OTP.

Endpoint

https://rehive.com/api/3/auth/mobile/verify/

Fields

Field Description Default Required
otp one time password null true

Tokens

The tokens endpoints provide some basic access to managing user and admin tokens. The ability to create infinite lifespan tokens as well as viewing active tokens and deleting unused tokens.

List Tokens

List tokens request

curl https://www.rehive.com/api/3/auth/tokens/
  -X GET
  -H "Content-Type: application/json"
  -H "Authorization: Token {token}"
rehive.token.getTokensList().then(function(res){
        // ...
    },function(err){
        // ...
    });

List user tokens response

{
  "status": "success",
  "data": [
    {
      "token_key": "00000000",
      "expires": null
    },
    {
      "token_key": "00000000",
      "expires": "2001-01-01T01:01:01.000001Z"
    },
    {
      "token_key": "00000000",
      "expires": "2001-01-01T01:01:01.000002Z"
    }
  ]
}
[
  {
    "token_key": "00000000",
    "expires": null
  },
  {
    "token_key": "00000000",
    "expires": "2001-01-01T01:01:01.000001Z"
  },
  {
    "token_key": "00000000",
    "expires": "2001-01-01T01:01:01.000002Z"
  }
]

Retrieve a list of the current active tokens for the authenticated user. Notice that only the token_key is exposed here and not the whole token, in case user tokens need to be managed on the client side.

Create Token

Create token request

curl https://www.rehive.com/api/3/auth/tokens/
  -X POST
  -H "Content-Type: application/json"
  -H "Authorization: Token {token}"
  -D "{"password": "joe1234"}"
rehive.token.createToken(
        {
            password: "joe1234"
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

Create token response

{
  "status": "success",
  "data": {
    "token": "{token}",
    "user": {
      "identifier": "00000000-0000-0000-0000-000000000000",
      "email": "joe@rehive.com",
      "mobile_number": "+00000000000",
      "first_name": "Joe",
      "last_name": "Soap",
      "company": "rehive",
      "profile": null,
      "language": "en"
    }
  }
}
{
    "token": "{token}",
    "user": {
      "identifier": "00000000-0000-0000-0000-000000000000",
      "email": "joe@rehive.com",
      "mobile_number": "+00000000000",
      "first_name": "Joe",
      "last_name": "Soap",
      "company": "rehive",
      "profile": null,
      "language": "en"
    }
}

Creating a token here will remove the expiration time on the token, thus giving it an infinite lifespan.

Endpoint

https://rehive.com/api/3/auth/tokens/

Fields

Field Description Default Required
password password null true

Delete Token

Delete token request

curl https://www.rehive.com/api/3/auth/tokens/{token_key}
  -X DELETE
  -H "Content-Type: application/json"
  -H "Authorization: Token {token}"
rehive.token.deleteToken("000a0a00").then(function(res){
        // ...
    },function(err){
        // ...
    })

Delete token response

{
  "status": "success"
}
{ }

Endpoint

https://rehive.com/api/3/auth/tokens/{token_key}

Users

Retrieve Profile

User profile request

curl https://www.rehive.com/api/3/user/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.user.getUserProfile().then(function(user){
        // ...
    },function(err){
        // ...
    })

User profile response

{
    "status": "success",
    "data": {
        "identifier": "00000000-0000-0000-0000-000000000000",
        "first_name": "Joe",
        "last_name": "Soap",
        "email": "joe@rehive.com",
        "username": "",
        "id_number": null,
        "profile": null,
        "currency": {
            "description": "Rand",
            "code": "ZAR",
            "symbol": "R",
            "unit": "rand",
            "divisibility": 2
        },
        "company": "rehive",
        "language": "en",
        "nationality": "ZA",
        "metadata": {},
        "mobile_number": "+27840000000",
        "verified": true,
        "timezone": "Asia/Dhaka",
        "date_joined": 1464912953000
    }
}
{
    "identifier": "00000000-0000-0000-0000-000000000000",
    "first_name": "Joe",
    "last_name": "Soap",
    "email": "joe@rehive.com",
    "username": "",
    "id_number": null,
    "profile": null,
    "currency": {
        "description": "Rand",
        "code": "ZAR",
        "symbol": "R",
        "unit": "rand",
        "divisibility": 2
    },
    "company": "rehive",
    "language": "en",
    "nationality": "ZA",
    "metadata": {},
    "mobile_number": "+27840000000",
    "verified": true,
    "timezone": "Asia/Dhaka",
    "date_joined": 1464912953000
}

Retrieve a user’s profile information.

Endpoint

https://rehive.com/api/3/user/

Update Profile

User update profile request

curl https://www.rehive.com/api/3/user/
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"first_name": "Joe"}'
rehive.user.updateUserProfile(
    {
        first_name: "Joe"
    }).then(function(user){
        // ...
    },function(err){
        // ...
    })

User update profile response

{
    "status": "success",
    "data": {
        "identifier": "00000000-0000-0000-0000-000000000000",
        "first_name": "Joe",
        "last_name": "Soap",
        "email": "joe@rehive.com",
        "username": "",
        "id_number": null,
        "profile": null,
        "currency": {
            "description": "Rand",
            "code": "ZAR",
            "symbol": "R",
            "unit": "rand",
            "divisibility": 2
        },
        "company": "rehive",
        "language": "en",
        "nationality": "ZA",
        "metadata": {},
        "mobile_number": "+27840000000",
        "verified": true,
        "timezone": "Asia/Dhaka",
        "date_joined": 1464912953000
    }
}
{
    "identifier": "00000000-0000-0000-0000-000000000000",
    "first_name": "Joe",
    "last_name": "Soap",
    "email": "joe@rehive.com",
    "username": "",
    "id_number": null,
    "profile": null,
    "currency": {
        "description": "Rand",
        "code": "ZAR",
        "symbol": "R",
        "unit": "rand",
        "divisibility": 2
    },
    "company": "rehive",
    "language": "en",
    "nationality": "ZA",
    "metadata": {},
    "mobile_number": "+27840000000",
    "verified": true,
    "timezone": "Asia/Dhaka",
    "date_joined": 1464912953000
}

Update a user’s profile information.

Endpoint

https://rehive.com/api/3/user/

Fields

Field Description Default Required
first_name first name blank false
last_name last name blank false
id_number ID number blank false
profile profile image blank false
language language code (af, en etc.) blank false
nationality nationality code (ZA, UK etc.) blank false
metadata custom metadata {} false
mobile_number mobile number blank false
skype_name skype name blank false
timezone timezone blank false

Retrieve Address

User retrieve address request

curl https://www.rehive.com/api/3/user/address/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.user.getUserAddress().then(function(res){
        // ...
    },function(err){
        // ...
    })

User retrieve address response

{
    "status": "success",
    "data": {
        "line_1": "1 Main Street",
        "line_2": "East City",
        "city": "Cape Town",
        "state_province": "Western Cape",
        "country": "ZA",
        "postal_code": "8001"
    }
}
{
    "line_1": "1 Main Street",
    "line_2": "East City",
    "city": "Cape Town",
    "state_province": "Western Cape",
    "country": "ZA",
    "postal_code": "8001"
}

Retrieve a user’s address.

Endpoint

https://rehive.com/api/3/user/address/

Update Address

User update address request

curl https://www.rehive.com/api/3/user/address/
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"city": "Cape Town"}'
rehive.user.updateUserAddress(
    {
        city: "Cape Town"
    }).then(function(res){
        // ...
    },function(err){
        // ...
    })

User update address response

{
    "status": "success",
    "data": {
        "line_1": "1 Main Street",
        "line_2": "East City",
        "city": "Cape Town",
        "state_province": "Western Cape",
        "country": "ZA",
        "postal_code": "8001"
    }
}
{
    "line_1": "1 Main Street",
    "line_2": "East City",
    "city": "Cape Town",
    "state_province": "Western Cape",
    "country": "ZA",
    "postal_code": "8001"
}

Update a user’s address.

Endpoint

https://rehive.com/api/3/user/address/

Fields

Field Description Default Required
line_1 address line one blank false
line_2 address line 2 blank false
city city blank false
state_province state or province blank false
country country code blank false
postal_code postal or zip code) blank false

List Bank Accounts

User list bank accounts request

curl https://www.rehive.com/api/3/user/bank-accounts/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.user.getUserBankAccounts().then(function(res){
        // ...
    },function(err){
        // ...
    })

User list bank accounts response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "name": "Default",
            "number": "9999999999",
            "type": "Cheque",
            "bank_name": "Central Bank",
            "bank_code": "0000",
            "branch_code": "0000",
            "swift": "",
            "iban": "",
            "bic": "",
            "code": "bank_account_VEM7k1y5hnuF"
        }
    ]
}
[
    {
        "id": 1,
        "name": "Default",
        "number": "9999999999",
        "type": "Cheque",
        "bank_name": "Central Bank",
        "bank_code": "0000",
        "branch_code": "0000",
        "swift": "",
        "iban": "",
        "bic": "",
        "code": "bank_account_VEM7k1y5hnuF"
    }
]

List a user’s bank accounts.

Endpoint

https://rehive.com/api/3/user/bank-accounts/

Create Bank Account

User create bank account request

curl https://www.rehive.com/api/3/user/bank-accounts/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"name": "Bank",
       "number": "000000000000000",
       "type": "Cheque",
       "bank_name": "Bank Ltd.",
       "branch_code": "0000"}'
rehive.user.createUserBankAccount(
        {
            name: "Bank",
            number: "000000000000000",
            type: "Cheque",
            bank_name: "Bank Ltd.",
            branch_code: "0000"
        }).then(function(res){
            // ...
        },function(err){
            // ...
        });

User create bank account response

{
    "status": "success",
    "data": {
        "id": 1,
        "name": "Bank",
        "number": "000000000000000",
        "type": "Cheque",
        "bank_name": "Bank Ltd.",
        "bank_code": null,
        "branch_code": "0000",
        "swift": null,
        "iban": null,
        "bic": null,
        "code": "bank_account_000000000000"
    }
}
{
    "id": 1,
    "name": "Bank",
    "number": "000000000000000",
    "type": "Cheque",
    "bank_name": "Bank Ltd.",
    "bank_code": null,
    "branch_code": "0000",
    "swift": null,
    "iban": null,
    "bic": null,
    "code": "bank_account_000000000000"
}

Create a bank account for a user.

Endpoint

https://rehive.com/api/3/user/bank-accounts/

Fields

Field Description Default Required
name account name null false
number account number null false
type account type null false
bank_name bank name null false
bank_code bank code null false
branch_code branch code null false
swift swift number null false
iban IBAN number null false
bic BIC number null false

Update Bank Account

User update bank account request

curl https://www.rehive.com/api/3/user/bank-accounts/{account_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"name": "Bank"}'
rehive.user.updateUserBankAccount(accountId,{name: "Bank"}).then(function(res){
            // ...
        },function(err){
            // ...
        })

User update bank account response

{
    "status": "success",
    "data": {
        "id": {account_id},
        "name": "Bank",
        "number": "000000000000000",
        "type": "Cheque",
        "bank_name": "Bank Ltd.",
        "bank_code": null,
        "branch_code": "0000",
        "swift": null,
        "iban": null,
        "bic": null,
        "code": "bank_account_000000000000"
    }
}
{
    "id": {account_id},
    "name": "Bank",
    "number": "000000000000000",
    "type": "Cheque",
    "bank_name": "Bank Ltd.",
    "bank_code": null,
    "branch_code": "0000",
    "swift": null,
    "iban": null,
    "bic": null,
    "code": "bank_account_000000000000"
}

Update a user’s bank account.

Endpoint

https://rehive.com/api/3/user/bank-accounts/{account_id}

Fields

Field Description Default Required
name account name null false
number account number null false
type account type null false
bank_name bank name null false
bank_code bank code null false
branch_code branch code null false
swift swift number null false
iban IBAN number null false
bic BIC number null false

List Bitcoin Accounts

User list bitcoin accounts request

curl https://www.rehive.com/api/3/user/bitcoin-accounts/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.user.getUserBitcoinAccounts().then(function(res){
        // ...
    },function(err){
        // ...
    })

User list bitcoin accounts response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "address": "0000000000000000000000000000000000",
            "code": "bitcoin_0000000000000000000000000000000000"
        }
    ]
}
[
    {
        "id": 1,
        "address": "0000000000000000000000000000000000",
        "code": "bitcoin_0000000000000000000000000000000000"
    }
]

List a user’s bitcoin addresses.

Endpoint

https://rehive.com/api/3/user/bitcoin-accounts/

Create Bitcoin Account

User create bitcoin account request

curl https://www.rehive.com/api/3/user/bitcoin-accounts/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"address": "0000000000000000000000000000000000"}'
rehive.user.createUserBitcoinAccount(
        {
            address: address
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User create bitcoin account response

{
    "status": "success",
    "data": {
        "id": 1,
        "address": "0000000000000000000000000000000000",
        "code": "bitcoin_0000000000000000000000000000000000"
    }
}
{
    "id": 1,
    "address": "0000000000000000000000000000000000",
    "code": "bitcoin_0000000000000000000000000000000000"
}

Create a bitcoin account for a user.

Endpoint

https://rehive.com/api/3/user/bitcoin-accounts/

Fields

Field Description Default Required
address full bitcoin address null true

Update Bitcoin Account

User update bitcoin account request

curl https://www.rehive.com/api/3/user/bitcoin-accounts/{account_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"address": "0000000000000000000000000000000000"}'
rehive.user.updateUserBitcoinAccount(accountId,{address: "0000000000000000000000000000000000"}).then(function(res){
        // ...
    },function(err){
        // ...
    })

User update bitcoin account response

{
    "status": "success",
    "data": {
        "id": {account_id},
        "address": "0000000000000000000000000000000000",
        "code": "bitcoin_0000000000000000000000000000000000"
    }
}
{
    "id": {account_id},
    "address": "0000000000000000000000000000000000",
    "code": "bitcoin_0000000000000000000000000000000000"
}

Update a user’s bitcoin account.

Endpoint

https://rehive.com/api/3/user/bitcoin-accounts/{account_id}

Fields

Field Description Default Required
address full bitcoin address null true

Create Document

User documents request

curl https://www.rehive.com/api/3/user/document/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -F file=@localfilename
 var fileSelected = document.getElementById("fileInput").files[0],
        formData =  new FormData;

    formData.append('file', fileSelected);
    formData.append('document_category', 'other');
    formData.append('document_type', 'other');

    rehive.user.createDocument(formData).then(function(res){
        // ...
    },function(err){
        // ...
    })

User documents response

{
    "status": "success",
    "data": {
        "file": "https://url.to/file.pdf",
        "document_category": "other",
        "document_type": "other"
    }
}
{
    "file": "https://url.to/file.pdf",
    "document_category": "other",
    "document_type": "other"
}

Upload user document.

Endpoint

https://rehive.com/api/3/user/document/

Fields

Field Description Default Required
file a document file null true
document_category The document category other false
document_type The type of docuemnt other false

List Email Addresses

User list email addresses request

curl https://www.rehive.com/api/3/user/emails/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.user.getUserEmailAddresses().then(function(res){
        // ...
    },function(err){
        // ...
    })

User list email addresses response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "email": "joe@rehive.com",
            "primary": true,
            "verified": true
        }
    ]
}
[
    {
        "id": 1,
        "email": "joe@rehive.com",
        "primary": true,
        "verified": true
    }
]

Get a list of user’s email addresses.

Endpoint

https://www.rehive.com/api/3/user/emails/

Create Email Address

User create email address request

curl https://www.rehive.com/api/3/user/emails/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"email": "joe@rehive.com",
       "primary": true}'
rehive.user.createUserEmailAddress(
        {
            email: "joe@rehive.com",
            primary: true
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User create email address response

{
    "status": "success",
    "data": {
        "id": 1,
        "email": "joe@rehive.com",
        "primary": true,
        "verified": true
    }
}
{
    "id": 1,
    "email": "joe@rehive.com",
    "primary": true,
    "verified": true
}

Create an email address for a user.

Endpoint

https://rehive.com/api/3/user/emails/

Fields

Field Description Default Required
email email address null true
primary is a primary user email false false

Update Email Address

User update email address request

curl https://www.rehive.com/api/3/user/emails/{email_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"primary": true}'
rehive.user.updateUserEmailAddress(emailId,{primary: true}).then(function(res){
        // ...
    },function(err){
        // ...
    })

User update email address response

{
    "status": "success",
    "data": {
        "id": 1,
        "email": "joe@rehive.com",
        "primary": true,
        "verified": true
    }
}
{
    "id": 1,
    "email": "joe@rehive.com",
    "primary": true,
    "verified": true
}

Update a user’s email adress. The email adress can be changed to be the user’s primary email address. The actual address cannot be updated and a new one should instead be created.

Endpoint

https://rehive.com/api/3/user/emails/{email_id}

Fields

Field Description Default Required
primary is a primary user email false false

List Mobile Numbers

User mobile numbers request

curl https://www.rehive.com/api/3/user/mobiles/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.user.getUserMobileNumbers().then(function(res){
        // ...
    },function(err){
        // ...
    })

User mobile numbers response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "number": "+00000000000",
            "primary": true,
            "verified": true
        }
    ]
}
[
    {
        "id": 1,
        "number": "+00000000000",
        "primary": true,
        "verified": true
    }
]

Get a list of user’s mobile numbers.

Endpoint

https://www.rehive.com/api/3/user/mobiles/

Create Mobile Number

User create mobile number request

curl https://www.rehive.com/api/3/user/mobiles/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"number": "+00000000000",
       "primary": true}'
rehive.user.createUserMobileNumber(
        {
            number: "+00000000000",
            primary: true
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User create mobile number response

{
    "status": "success",
    "data": {
        "id": 1,
        "number": "+00000000000",
        "primary": true,
        "verified": true
    }
}
{
    "id": 1,
    "number": "+00000000000",
    "primary": true,
    "verified": true
}

Create a mobile number for a user.

Endpoint

https://rehive.com/api/3/user/mobiles/

Fields

Field Description Default Required
number mobile number address (including area code) null true
primary is a primary user number false false

Update Mobile Number

User update mobile number request

curl https://www.rehive.com/api/3/user/mobiles/{number_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"primary": true}'
rehive.user.updateUserMobileNumber(numberId,{primary: true}).then(function(res){
        // ...
    },function(err){
        // ...
    })

User update mobile number response

{
    "status": "success",
    "data": {
        "id": 1,
        "number": "+00000000000",
        "primary": true,
        "verified": true
    }
}
{
    "id": 1,
    "number": "+00000000000",
    "primary": true,
    "verified": true
}

Update a user’s mobile number. The number can be changed to be the user’s primary mobile number. The actual number cannot be updated and a new one should be created instead.

Endpoint

https://rehive.com/api/3/user/mobiles/{number_id}

Fields

Field Description Default Required
primary is a primary user email false false

List Notifications

User list notifcations request

curl https://www.rehive.com/api/3/user/notifications/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.user.getUserNotifications().then(function(res){
        // ...
    },function(err){
        // ...
    })

User list notifcations response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "name": "tx_transfer_debit",
            "description": "Transfer debit notifications",
            "email_enabled": true,
            "sms_enabled": true
        },
        {
            "id": 2,
            "name": "tx_debit",
            "description": "Debit notifications",
            "email_enabled": true,
            "sms_enabled": true
        },
        {
            "id": 3,
            "name": "tx_transfer_credit",
            "description": "Transfer credit notifications",
            "email_enabled": true,
            "sms_enabled": true
        },
        {
            "id": 4,
            "name": "tx_credit",
            "description": "Credit notifications",
            "email_enabled": true,
            "sms_enabled": true
        },
        {
            "id": 5,
            "name": "tx_transfer_invite",
            "description": "Transfer invite notifications",
            "email_enabled": true,
            "sms_enabled": true
        },
        {
            "id": 9,
            "name": "document_upload",
            "description": "Document upload notifications",
            "email_enabled": true,
            "sms_enabled": true
        },
        {
            "id": 10,
            "name": "document_change",
            "description": "Document status change notifications",
            "email_enabled": true,
            "sms_enabled": true
        }
    ]
}
[
    {
        "id": 1,
        "name": "tx_transfer_debit",
        "description": "Transfer debit notifications",
        "email_enabled": true,
        "sms_enabled": true
    },
    {
        "id": 2,
        "name": "tx_debit",
        "description": "Debit notifications",
        "email_enabled": true,
        "sms_enabled": true
    },
    {
        "id": 3,
        "name": "tx_transfer_credit",
        "description": "Transfer credit notifications",
        "email_enabled": true,
        "sms_enabled": true
    },
    {
        "id": 4,
        "name": "tx_credit",
        "description": "Credit notifications",
        "email_enabled": true,
        "sms_enabled": true
    },
    {
        "id": 5,
        "name": "tx_transfer_invite",
        "description": "Transfer invite notifications",
        "email_enabled": true,
        "sms_enabled": true
    },
    {
        "id": 9,
        "name": "document_upload",
        "description": "Document upload notifications",
        "email_enabled": true,
        "sms_enabled": true
    },
    {
        "id": 10,
        "name": "document_change",
        "description": "Document status change notifications",
        "email_enabled": true,
        "sms_enabled": true
    }
]

Get a list of available notification settings.

Endpoint

https://rehive.com/api/3/user/notifications/

Update Notification

User update notification request

curl https://www.rehive.com/api/3/user/notifcations/{notification_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"email_enabled": true}'
rehive.user.updateUserNotifications(notificationId,{email_enabled: true}).then(function(res){
        // ...
    },function(err){
        // ...
    })

User update notification response

{
    "status": "success",
    "data": {
        "id": 1,
        "email_enabled": true,
        "sms_enabled": true,
        "name": "tx_credit",
        "description": "Credit transaction notifications"
    }
}
{
    "id": 1,
    "email_enabled": true,
    "sms_enabled": true,
    "name": "tx_credit",
    "description": "Credit transaction notifications"
}

Update a user’s settings for a notification.

Endpoint

https://rehive.com/api/3/user/notifcations/{notification_id}

Fields

Field Description Default Required
email_enabled is email notifcation enabled false false
sms_enabled is sms notifcation enabled false false

Transactions

Rehive offers 2 standard type transactions: Debit and Credit. Debit transactiosn deduct from a user’s account and Credit transaction add to a user’s account. There is an additional “transfer” endpoint that can be used in order to automtically trigger a debit followed by a credit on the specified accounts.

Transaction currency values are always inputted/outputted in their lowest currency unit. For most currencies this will be the cents values, so a $ 1.00 transaction will output an amount of 100.

List Transactions

User transactions request

curl https://www.rehive.com/api/3/transactions/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
var filters = {tx_type: 'credit',currency: 'ZAR'};

rehive.transactions.getTransactionsList(filters).then(function(res){
        // ...
    },function(err){
        // ...
    })

User transactions response

 {
    "status": "success",
    "data": {
        "count": 2,
        "next": null,
        "previous": null,
        "results": [
            {
                "id": "000000000000000000000",
                "tx_type": "credit",
                "subtype": null,
                "external": false,
                "note": "",
                "metadata": {},
                "status": "Complete",
                "reference": "",
                "amount": 500,
                "fee": 0,
                "balance": 1000,
                "account": "akC49YT8x4",
                "label": "Credit",
                "company": "rehive",
                "currency": {
                    "description": "Rand",
                    "code": "ZAR",
                    "symbol": "R",
                    "unit": "rand",
                    "divisibility": 2
                },
                "user": {
                    "identifier": "00000000-0000-0000-0000-000000000000",
                    "first_name": "Joe",
                    "last_name": "Soap",
                    "email": "joe@rehive.com",
                    "username": "",
                    "mobile_number": "+27840000000",
                    "profile": null
                },
                "source_transaction": null,
                "destination_transaction": null,
                "created": 1496135465218,
                "updated": 1496135465287
            },
            {
                "id": "000000000000000000000",
                "tx_type": "credit",
                "subtype": null,
                "external": false,
                "note": "",
                "metadata": {},
                "status": "Complete",
                "reference": "",
                "amount": 500,
                "fee": 0,
                "balance": 500,
                "account": "akC49YT8x4",
                "label": "Credit",
                "company": "rehive",
                "currency": {
                    "description": "Rand",
                    "code": "ZAR",
                    "symbol": "R",
                    "unit": "rand",
                    "divisibility": 2
                },
                "user": {
                    "identifier": "00000000-0000-0000-0000-000000000000",
                    "first_name": "Joe",
                    "last_name": "Soap",
                    "email": "joe@rehive.com",
                    "username": "",
                    "mobile_number": "+27840000000",
                    "profile": null
                },
                "source_transaction": null,
                "destination_transaction": null,
                "created": 1496135465218,
                "updated": 1496135465287
            }
        ]
    }
}
 {
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": "000000000000000000000",
            "tx_type": "credit",
            "subtype": null,
            "external": false,
            "note": "",
            "metadata": {},
            "status": "Complete",
            "reference": "",
            "amount": 500,
            "fee": 0,
            "balance": 1000,
            "account": "akC49YT8x4",
            "label": "Credit",
            "company": "rehive",
            "currency": {
                "description": "Rand",
                "code": "ZAR",
                "symbol": "R",
                "unit": "rand",
                "divisibility": 2
            },
            "user": {
                "identifier": "00000000-0000-0000-0000-000000000000",
                "first_name": "Joe",
                "last_name": "Soap",
                "email": "joe@rehive.com",
                "username": "",
                "mobile_number": "+27840000000",
                "profile": null
            },
            "source_transaction": null,
            "destination_transaction": null,
            "created": 1496135465218,
            "updated": 1496135465287
        },
        {
            "id": "000000000000000000000",
            "tx_type": "credit",
            "subtype": null,
            "external": false,
            "note": "",
            "metadata": {},
            "status": "Complete",
            "reference": "",
            "amount": 500,
            "fee": 0,
            "balance": 500,
            "account": "akC49YT8x4",
            "label": "Credit",
            "company": "rehive",
            "currency": {
                "description": "Rand",
                "code": "ZAR",
                "symbol": "R",
                "unit": "rand",
                "divisibility": 2
            },
            "user": {
                "identifier": "00000000-0000-0000-0000-000000000000",
                "first_name": "Joe",
                "last_name": "Soap",
                "email": "joe@rehive.com",
                "username": "",
                "mobile_number": "+27840000000",
                "profile": null
            },
            "source_transaction": null,
            "destination_transaction": null,
            "created": 1496135465218,
            "updated": 1496135465287
        }
    ]
 }

Get a a user’s transaction list.

Pagination

The list is paginated by default and can be navigated via the next and previous fields or by setting a page parameter in the request URL.

Filtering

The transactions listing offers filtering on the id, tx_type, subtype, status, created and metadata fields. This is done through URL parameters in the request URL:

/api/3/transactions/?tx_type=debit

You can also do boolean filtering on source_transaction and destination_transaction like this:

/api/3/transactions/?destination_transaction=true

There is a special format for fitering on metadata (ie. metadata__{field_name}):

/api/3/transactions/?metadata__type=test

Sorting

Sorting of the transactions listing can be done on all the “filtering” fields mentioned above via an orderby parameter in the request URL:

/api/3/transactions/?orderby=tx_type

Endpoint

https://rehive.com/api/3/transactions/

Total Transactions

User total transactions request

curl https://www.rehive.com/api/3/transactions/totals/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
var filters = {currency:'ZAR'};

rehive.transactions.getTotalTransactionsList(filters).then(function(res){
        // ...
    },function(err){
        // ...
    })

User total transactions response

{
    "status": "success",
    "data": {
        "amount": 1000,
        "fees": 0,
        "count": 2,
        "currency": "ZAR"
    }
}
{
    "amount": 1000,
    "fees": 0,
    "count": 2,
    "currency": "ZAR"
}

Get a user’s total transaction details. This is a summary of transaction details like: amount totals, fee totals, and the total number of transactions.

Filtering

The transaction totals endpoint has identical filtering to the transaction list endpoint.

Endpoint

https://rehive.com/api/3/transactions/totals/

Retrieve Transaction

Retrieve transaction request

curl https://www.rehive.com/api/3/transactions/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.transactions.getTransaction(txCode).then(function(res){
        // ...
    },function(err){
        // ...
    })

Retrieve transaction response

{
    "status": "success",
    "data":  {
        "id": "000000000000000000000",
        "tx_type": "credit",
        "subtype": null,
        "external": false,
        "note": "",
        "metadata": {},
        "status": "Complete",
        "reference": "",
        "amount": 500,
        "fee": 0,
        "balance": 500,
        "account": "akC49YT8x4",
        "label": "Credit",
        "company": "rehive",
        "currency": {
            "description": "Rand",
            "code": "ZAR",
            "symbol": "R",
            "unit": "rand",
            "divisibility": 2
        },
        "user": {
            "identifier": "00000000-0000-0000-0000-000000000000",
            "first_name": "Joe",
            "last_name": "Soap",
            "email": "joe@rehive.com",
            "username": "",
            "mobile_number": "+27840000000",
            "profile": null
        },
        "source_transaction": null,
        "destination_transaction": null,
        "messages": [
            {
                "level": "info",
                "message": "Transaction completed.",
                "created": 1496144568989
            }
        ],
        "created": 1496135465218,
        "updated": 1496135465287
    }
}
{
    "id": "000000000000000000000",
    "tx_type": "credit",
    "subtype": null,
    "external": false,
    "note": "",
    "metadata": {},
    "status": "Complete",
    "reference": "",
    "amount": 500,
    "fee": 0,
    "balance": 500,
    "account": "akC49YT8x4",
    "label": "Credit",
    "company": "rehive",
    "currency": {
        "description": "Rand",
        "code": "ZAR",
        "symbol": "R",
        "unit": "rand",
        "divisibility": 2
    },
    "user": {
        "identifier": "00000000-0000-0000-0000-000000000000",
        "first_name": "Joe",
        "last_name": "Soap",
        "email": "joe@rehive.com",
        "username": "",
        "mobile_number": "+27840000000",
        "profile": null
    },
    "source_transaction": null,
    "destination_transaction": null,
    "messages": [
        {
            "level": "info",
            "message": "Transaction completed.",
            "created": 1496144568989
        }
    ],
    "created": 1496135465218,
    "updated": 1496135465287
}

Get transaction details for a spcific transactions.

Endpoint

https://rehive.com/api/3/transactions/{id}/

Create Credit

User credit request

curl https://www.rehive.com/api/3/transactions/credit/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"amount": 500}'
rehive.transactions.createCredit(
        {
            amount: 500
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User credit response

{
    "status": "success",
    "data": {
        "id": "00000000000000000000",
        "metadata": {}
    }
}
{
    "id": "00000000000000000000",
    "metadata": {}
}

Create a credit transaction.

Endpoint

https://rehive.com/api/3/transactions/credit/

Fields

Field Description Default Required
amount amount 0 true
currency currency code blank false
reference optional credit reference blank false
subtype a custom defined subtype null false
account account reference code null false
note user’s note or message blank false
metadata custom metadata {} false

Create Debit

User debit request

curl https://www.rehive.com/api/3/transactions/debit/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"amount": 500}'
rehive.transactions.createDebit(
        {
            amount: 500
        }).then(function(res){
            // ...
        },function(err){
            // ...
        })

User debit response

{
    "status": "success",
    "data": {
        "id": "00000000000000000000",
        "metadata": {}
    }
}
{
    "id": "00000000000000000000",
    "metadata": {}
}

Create a debit transaction.

Endpoint

https://rehive.com/api/3/transactions/debit/

Fields

Field Description Default Required
amount amount 0 true
currency currency code blank false
reference optional debit reference blank false
subtype a custom defined subtype null false
account account reference code null false
note user’s note or message blank false
metadata custom metadata {} false

Create Transfer

User transfer request

curl https://www.rehive.com/api/3/transactions/transfer/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"amount": 500,
       "recipient": "joe@rehive.com"}'
rehive.transactions.createTransfer(
    {
        amount: 500,
        recipient: "joe@rehive.com"
    }).then(function(res){
        // ...
    },function(err){
        // ...
    })

User transfer response

{
    "status": "success",
    "data": {
        "id": "00000000000000000000",
        "metadata": {}
    }
}
{
    "id": "00000000000000000000",
    "metadata": {}
}

Create a transfer transaction. This will transfer currency from one user to another. If the recipient reference does not exist as a user in Rehive and the reference is an email address or mobile number then an invitation message will be sent to the recipient informing them thay have an unclaimed transaction.

Endpoint

https://rehive.com/api/3/transactions/transfer/

Fields

Field Description Default Required
amount amount 0 true
recipient email, mobile number, unique identifier null true
currency currency code blank false
debit_subtype a custom defined subtype null false
debit_account account reference code null false
debit_note user’s note or message blank false
debit_metadata custom metadata {} false
debit_reference optional debit reference string false
credit_subtype a custom defined subtype null false
credit_note user’s note or message blank false
credit_metadata custom metadata {} false
credit_reference optional credit reference string false

Accounts

Create Account

User create account request

curl https://www.rehive.com/api/3/accounts/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"name": "savings"}'

User create account response

{
    "status": "success",
    "data": {
        "name": "savings",
        "reference": "0000000000",
        "primary": true,
        "currencies": [],
        "created": 1501145581365,
        "updated": 1501145581370
    },
}

Create a account for a user.

Endpoint

https://rehive.com/api/3/accounts/

Fields

Field Description Default Required
name account name null true
primary account primary status false false

List Accounts

User list accounts request

curl https://www.rehive.com/api/3/accounts/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
var filter = {active:true};

rehive.accounts.getAccountsList(filter).then(function(res){
        // ...
    },function(err){
        // ...
    })

User list accounts response

{
    "status": "success",
    "data": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "name": "default",
                "reference": "0000000000",
                "balances": [
                    {
                        "balance": 10000,
                        "currency": {
                            "code": "XBT",
                            "description": "bitcoin",
                            "symbol": "฿",
                            "unit": "bitcoin",
                            "divisibility": 8
                        },
                        "active": true
                    }
                ],
                "created": 1464858068745,
                "updated": 1464858068745
            }
        ]
    }
}
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "name": "default",
            "reference": "0000000000",
            "balances": [
                {
                    "balance": 10000,
                    "currency": {
                        "code": "XBT",
                        "description": "bitcoin",
                        "symbol": "฿",
                        "unit": "bitcoin",
                        "divisibility": 8
                    },
                    "active": true
                }
            ],
            "created": 1464858068745,
            "updated": 1464858068745
        }
    ]

}

Get a list of accounts belonging to a user.

Pagination

The list is paginated and can be navigated via the next and previous fields or by setting a page parameter in the request URL.

Filtering

The account listing offers filtering on the active attribute. This is done through a URL parameter in the request URL:

/api/3/accounts/?active=true

Endpoint

https://rehive.com/api/3/accounts/

Retrieve Account

User retrieve account request

curl https://www.rehive.com/api/3/accounts/{reference}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
var filter = {active:true}

rehive.accounts.getAccount(reference,filter).then(function(res){
        // ...
    },function(err){
        // ...
    })

User retrieve account response

{
    "status": "success",
    "data": {
        "name": "default",
        "reference": "0000000000",
        "balances": [
            {
                "balance": 10000,
                "currency": {
                    "code": "XBT",
                    "description": "bitcoin",
                    "symbol": "฿",
                    "unit": "bitcoin",
                    "divisibility": 8
                },
                "active": true
            }
        ],
        "created": 1464858068745,
        "updated": 1464858068745
    }
}
{
    "name": "default",
    "reference": "0000000000",
    "balances": [
        {
            "balance": 10000,
            "currency": {
                "code": "XBT",
                "description": "bitcoin",
                "symbol": "฿",
                "unit": "bitcoin",
                "divisibility": 8
            },
            "active": true
        }
    ],
    "created": 1464858068745,
    "updated": 1464858068745
}

Retrieve an account belonging to a user.

Filtering

The account view offers filtering of currencies based on the active attribute. This is done through a URL parameter in the request URL:

/api/3/accounts/{reference}/?active=true

Endpoint

https://rehive.com/api/3/accounts/{reference}/

Update Account

User update account request

curl https://www.rehive.com/api/3/accounts/{reference}/
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"name": "savings"}'

User update account response

{
    "status": "success",
    "data": {
        "name": "savings",
        "reference": "0000000000",
        "primary": true,
        "currencies": [],
        "created": 1501145581365,
        "updated": 1501145581370
    },
}

Update an account for a user.

Endpoint

https://rehive.com/api/3/accounts/{reference}/

Fields

Field Description Default Required
name account name null true
primary account primary status false false

List Account Currencies

User list account currencies request

curl https://www.rehive.com/api/3/accounts/{reference}/currencies/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
var filter = {active:true}

rehive.accounts.getAccountCurrenciesList(reference,filter).then(function(res){
        // ...
    },function(err){
        // ...
    })

User list account currencies response

{
    "status": "success",
    "data": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "balance": 10000,
                "currency": {
                    "code": "XBT",
                    "description": "bitcoin",
                    "symbol": "฿",
                    "unit": "bitcoin",
                    "divisibility": 8
                },
                "active": true
            }
        ]
    }
}
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "balance": 10000,
            "currency": {
                "code": "XBT",
                "description": "bitcoin",
                "symbol": "฿",
                "unit": "bitcoin",
                "divisibility": 8
            },
            "active": true
        }
    ]

}

Get a list of currencies for an account belonging to a user.

Pagination

The list is paginated and can be navigated via the next and previous fields or by setting a page parameter in the request URL.

Filtering

The account currency listing offers filtering on the active attribute. This is done through a URL parameter in the request URL:

/api/3/accounts/{reference}/currencies/?active=true

Endpoint

https://rehive.com/api/3/accounts/{reference}/currencies/

Retrieve Account Currency

User retrieve account currency request

curl https://www.rehive.com/api/3/accounts/{reference}/currencies/{code}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.accounts.getAccountCurrency(reference,currencyCode).then(function(res){
        // ...
    },function(err){
        // ...
    })

User retrieve account currency response

{
    "status": "success",
    "data": {
        "balance": 10000,
        "currency": {
            "code": "XBT",
            "description": "bitcoin",
            "symbol": "฿",
            "unit": "bitcoin",
            "divisibility": 8
        },
        "active": true
    }
}
{
    "balance": 10000,
    "currency": {
        "code": "XBT",
        "description": "bitcoin",
        "symbol": "฿",
        "unit": "bitcoin",
        "divisibility": 8
    },
    "active": true
}

Retrieve an account’s currency belonging to a user.

Endpoint

https://rehive.com/api/3/accounts/{reference}/currencies/{code}

Update Account Currency

User retrieve account currency request

curl https://www.rehive.com/api/3/accounts/{reference}/currencies/{code}
  -X PUT
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"active": true}'
rehive.accounts.updateAccountCurrency(reference,currencyCode,{active: true}).then(function(res){
        // ...
    },function(err){
        // ...
    })

User retrieve account currency response

{
    "status": "success",
    "data": {
        "balance": 10000,
        "currency": {
            "code": "XBT",
            "description": "bitcoin",
            "symbol": "฿",
            "unit": "bitcoin",
            "divisibility": 8
        },
        "active": true
    }
}
{
    "balance": 10000,
    "currency": {
        "code": "XBT",
        "description": "bitcoin",
        "symbol": "฿",
        "unit": "bitcoin",
        "divisibility": 8
    },
    "active": true
}

Update the active status of an account currency. Activating an account’s currency will result in that currency getting used by default for all transactions if no other account/currency is specified.

Endpoint

https://rehive.com/api/3/accounts/{reference}/currencies/{code}

Fields

Field Description Default Required
active is active currency false false

Company

Retrieve Company Details

User retrieve company details request

curl https://www.rehive.com/api/3/company/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.company.getCompanyDetails().then(function(res){
        // ...
    },function(err){
        // ...
    })

User retrieve company details response

{
    "data": {
        "identifier": "rehive",
        "name": "Rehive",
        "description": "Wallets for everyone.",
        "website": "http://www.rehive.com",
        "logo": null
    },
    "status": "success"
}
{
    "identifier": "rehive",
    "name": "Rehive",
    "description": "Wallets for everyone.",
    "website": "http://www.rehive.com",
    "logo": null
}

Retrieve current user’s company details.

Endpoint

https://rehive.com/api/3/company/

List Company Currencies

User list company currencies request

curl https://www.rehive.com/api/3/company/currencies/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.company.getCompanyCurrencies().then(function(res){
        // ...
    },function(err){
        // ...
    })

User list company currencies response

{
    "status": "success",
    "data": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "code": "XBT",
                "description": "bitcoin",
                "symbol": "฿",
                "unit": "bitcoin",
                "divisibility": 8
            }
        ]
    }
}
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "code": "XBT",
            "description": "bitcoin",
            "symbol": "฿",
            "unit": "bitcoin",
            "divisibility": 8
        }
    ]
}

Get a list of available currencies for the current user’s company.

Endpoint

https://rehive.com/api/3/company/currencies/

List Company Banks

User list company banks request

curl https://www.rehive.com/api/3/accounts/deposits/bank/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
rehive.company.getCompanyBanks().then(function(res){
        // ...
    },function(err){
        // ...
    })

User list company banks response

{
    "status": "success",
    "data": [
        {
            "id": 53,
            "token": 1,
            "bank_account": {
                "id": 1,
                "name": "Rehive",
                "number": "xxxxxxxx",
                "type": "Cheque",
                "bank_name": "Barclays",
                "bank_code": "xxxx",
                "branch_code": "xxxxx",
                "swift": "",
                "iban": "",
                "bic": ""
            },
            "reference": "xxxxxxxxxx"
        }
    ]
}
[
    {
        "id": 53,
        "token": 1,
        "bank_account": {
            "id": 1,
            "name": "Rehive",
            "number": "xxxxxxxx",
            "type": "Cheque",
            "bank_name": "Barclays",
            "bank_code": "xxxx",
            "branch_code": "xxxxx",
            "swift": "",
            "iban": "",
            "bic": ""
        },
        "reference": "xxxxxxxxxx"
    }
]

List company banks for the current user’s company.

Endpoint

https://rehive.com/api/3/company/banks/

Administration

Rehive includes a set of admin-only endpoints that can make working with users and their transactions extremely easy.

User

List Users

Admin list users request

curl https://www.rehive.com/admin/api/3/admin/users/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin list users response

{
    "status": "success",
    "data": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "identifier": "00000000-0000-0000-0000-000000000000",
                "first_name": "Joe",
                "last_name": "Soap",
                "email": "joe@rehive.com",
                "username": "",
                "id_number": "",
                "profile": null,
                "currency": {
                    "description": "Rand",
                    "code": "ZAR",
                    "symbol": "R",
                    "unit": "rand",
                    "divisibility": 2
                },
                "company": "rehive",
                "language": "en",
                "nationality": "ZA",
                "metadata": null,
                "mobile_number": "+27840000000",
                "skype_name": "@skype",
                "timezone": "Asia/Dhaka"
                "date_joined": 1464912953000
            }
        ]
    }
}

Get a list of users belonging to a company.

Pagination

The list is paginated and can be navigated via the next and previous fields or by setting a page parameter in the request URL.

Filtering

The account currency listing offers filtering on the identifier, email, mobile_number, first_name, last_name, username, id_number, date_joined, and last_login attribute. This is done through a URL parameter in the request URL:

/api/3/admin/users/?first_name=Joe

Endpoint

https://rehive.com/api/3/admin/users/

Create User

Admin create user reuest

curl https://www.rehive.com/api/3/admin/users/`
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"first_name": "Joe",
       "last_name": "Soap",
       "mobile_number": "+27840000000",
       "email": "joe@rehive.com"}'

Admin update user response

{
    "status": "success",
    "data": {
        "identifier": "00000000-0000-0000-0000-000000000000",
        "first_name": "Joe",
        "last_name": "Soap",
        "email": "joe@rehive.com",
        "username": "",
        "id_number": "",
        "profile": null,
        "currency": {
            "description": "Rand",
            "code": "ZAR",
            "symbol": "R",
            "unit": "rand",
            "divisibility": 2
        },
        "company": "rehive",
        "language": "en",
        "nationality": "ZA",
        "metadata": null,
        "mobile_number": "+27840000000",
        "skype_name": "@skype",
        "timezone": "Asia/Dhaka"
        "date_joined": 1464912953000
    }
}

Update a user’s details.

Endpoint

https://rehive.com/api/3/admin/users/

Fields

Field Description Default Required
first_name first name “” false
last_name last name “” false
email email address null false
mobile_number mobile number null false

Retrieve User

Admin retrieve user request

curl https://www.rehive.com/api/3/admin/users/{identifier}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin retrieve user response

{
    "status": "success",
    "data": {
        "identifier": "00000000-0000-0000-0000-000000000000",
        "first_name": "Joe",
        "last_name": "Soap",
        "email": "joe@rehive.com",
        "username": "",
        "id_number": "",
        "profile": null,
        "currency": {
            "description": "Rand",
            "code": "ZAR",
            "symbol": "R",
            "unit": "rand",
            "divisibility": 2
        },
        "company": "rehive",
        "language": "en",
        "nationality": "ZA",
        "metadata": null,
        "mobile_number": "+27840000000",
        "skype_name": "@skype",
        "timezone": "Asia/Dhaka"
        "date_joined": 1464912953000
    }
}

Retrieve a company’s user.

Endpoint

https://rehive.com/api/3/admin/users/{identifier}/

Update User

Admin update user request

curl https://www.rehive.com/api/3/admin/users/{identifier}/`
  -X PUT
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"first_name": "Joe"}'

Admin update user response

{
    "status": "success",
    "data": {
        "identifier": "00000000-0000-0000-0000-000000000000",
        "first_name": "Joe",
        "last_name": "Soap",
        "email": "joe@rehive.com",
        "username": "",
        "id_number": "",
        "profile": null,
        "currency": {
            "description": "Rand",
            "code": "ZAR",
            "symbol": "R",
            "unit": "rand",
            "divisibility": 2
        },
        "company": "rehive",
        "language": "en",
        "nationality": "ZA",
        "metadata": null,
        "mobile_number": "+27840000000",
        "skype_name": "@skype",
        "timezone": "Asia/Dhaka"
        "date_joined": 1464912953000
    }
}

Update a user’s details.

Endpoint

https://rehive.com/api/3/admin/users/{identifier}/

Fields

Field Description Default Required
first_name first name “” false
last_name last name “” false
id_number ID number “” false
language language code (en, af etc.) “” false
nationality bationality code (ZA, USA etc.) “” false
metadata custom user data {} false
timezone timezone (Asia/Dhaka, Africa/Harare etc.) string false

List User Switches

List all switches related to a user.

List User Switches request

curl https://rehive.com/api/3/admin/users/{identifier}/switches/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List User Switches response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "tx_type": "credit",
            "subtype": null,
            "enabled": true,
            "created": 1497362397968,
            "updated": 1497362397968
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/users/{identifier}/switches/

Create User Switches

Create a new switch related to a user.

Create User Switches request

curl https://rehive.com/api/3/admin/users/{identifier}/switches/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"tx_type": "credit",
       "enabled": true}'

Create User Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": true,
        "created": 1497362397968,
        "updated": 1497362397968
    }
}

Endpoint

https://rehive.com/api/3/admin/users/{identifier}/switches/

Fields

Field Description Default Required
tx_type Transaction Type true
subtype Subtype name null false
enabled Enabled false true

Retrieve User Switches

Retrieve a specific switch related to a user

Retrieve User Switches request

curl https://rehive.com/api/3/admin/users/{identifier}/switches/{id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve User Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": true,
        "created": 1497362397968,
        "updated": 1497362397968
    }
}

Endpoint

https://rehive.com/api/3/admin/users/{identifier}/switches/{id}

Update User Switches

Update a specific switch related to a user

Update User Switches request

curl https://rehive.com/api/3/admin/users/{identifier}/switches/{id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"enabled": false}'

Update User Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": false,
        "created": 1497362397968,
        "updated": 1497362931403
    }
}

Endpoint

https://rehive.com/api/3/admin/users/{identifier}/switches/{id}

Emails

List Emails

Admin list emails request

curl https://www.rehive.com/admin/api/3/admin/users/emails/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin list emails response

{
    "status": "success",
    "data": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "user": {
                    "identifier": "00000000-0000-0000-0000-000000000000",
                    "first_name": "Joe",
                    "last_name": "Soap",
                    "email": "joe@rehive.com",
                    "username": "",
                    "mobile_number": "+27840000000",
                    "profile": null
                },
                "id": 1,
                "email": "joe@rehive.com",
                "primary": true,
                "verified": true
            },
        ]
    }
}

Get a list of emails belonging to a company.

Pagination

The list is paginated and can be navigated via the next and previous fields or by setting a page parameter in the request URL.

Filtering

The account currency listing offers filtering on the user attribute. This is done through a URL parameter in the request URL:

/api/3/admin/users/emails/?user=00000000-0000-0000-0000-000000000000

Endpoint

https://rehive.com/api/3/admin/users/emails/

Create Email

Admin create email reuest

curl https://www.rehive.com/api/3/admin/users/emails/`
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"user": 00000000-0000-0000-0000-000000000000,
       "verified": true,
       "primary": true,
       "email": "joe@rehive.com"}'

Admin create email response

{
    "status": "success",
    "data": {
        "user": {
            "identifier": "00000000-0000-0000-0000-000000000000",
            "first_name": "Joe",
            "last_name": "Soap",
            "email": "joe@rehive.com",
            "username": "",
            "mobile_number": "+27840000000",
            "profile": null
        },
        "id": 1,
        "email": "joe@rehive.com",
        "primary": true,
        "verified": true
    }
}

Create an email address for a user.

Endpoint

https://rehive.com/api/3/admin/users/emails/

Fields

Field Description Default Required
user user identifier null true
verified verified status false false
primary primary status false false
email email address null true

Retrieve Email

Admin retrieve email request

curl https://www.rehive.com/api/3/admin/users/emails/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin retrieve email response

{
    "status": "success",
    "data": {
        "user": {
            "identifier": "00000000-0000-0000-0000-000000000000",
            "first_name": "Joe",
            "last_name": "Soap",
            "email": "joe@rehive.com",
            "username": "",
            "mobile_number": "+27840000000",
            "profile": null
        },
        "id": 1,
        "email": "joe@rehive.com",
        "primary": true,
        "verified": true
    }
}

Retrieve a company’s email.

Endpoint

https://rehive.com/api/3/admin/users/emails/{id}/

Update Email

Admin update email request

curl https://www.rehive.com/api/3/admin/emails/{id}/`
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"verified": true}'

Admin update email response

{
    "status": "success",
    "data": {
        "user": {
            "identifier": "00000000-0000-0000-0000-000000000000",
            "first_name": "Joe",
            "last_name": "Soap",
            "email": "joe@rehive.com",
            "username": "",
            "mobile_number": "+27840000000",
            "profile": null
        },
        "id": 1,
        "email": "joe@rehive.com",
        "primary": true,
        "verified": true
    }
}

Update a user’s email.

Endpoint

https://rehive.com/api/3/admin/users/emails/{id}/

Fields

Field Description Default Required
verified verified status false false
primary primary status false false

Mobiles

List Mobiles

Admin list mobiles request

curl https://www.rehive.com/admin/api/3/admin/users/mobiles/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin list mobiles response

{
    "status": "success",
    "data": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "user": {
                    "identifier": "00000000-0000-0000-0000-000000000000",
                    "first_name": "Joe",
                    "last_name": "Soap",
                    "email": "joe@rehive.com",
                    "username": "",
                    "mobile_number": "+27840000000",
                    "profile": null
                },
                "id": 1,
                "number": "+27840000000",
                "primary": true,
                "verified": true
            },
        ]
    }
}

Get a list of mobile numbers belonging to a company.

Pagination

The list is paginated and can be navigated via the next and previous fields or by setting a page parameter in the request URL.

Filtering

The account currency listing offers filtering on the user attribute. This is done through a URL parameter in the request URL:

/api/3/admin/users/mobiles/?user=00000000-0000-0000-0000-000000000000

Endpoint

https://rehive.com/api/3/admin/users/mobiles/

Create Mobile

Admin create mobile request

curl https://www.rehive.com/api/3/admin/users/mobiles/`
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"user": 00000000-0000-0000-0000-000000000000,
       "verified": true,
       "primary": true,
       "number": "+27840000000"}'

Admin create mobile response

{
    "status": "success",
    "data": {
        "user": {
            "identifier": "00000000-0000-0000-0000-000000000000",
            "first_name": "Joe",
            "last_name": "Soap",
            "email": "joe@rehive.com",
            "username": "",
            "mobile_number": "+27840000000",
            "profile": null
        },
        "id": 1,
        "email": "+27840000000",
        "primary": true,
        "verified": true
    }
}

Create a mobile number for a user.

Endpoint

https://rehive.com/api/3/admin/users/mobiles/

Fields

Field Description Default Required
user user identifier null true
verified verified status false false
primary primary status false false
mobile mobile number null true

Retrieve Mobile

Admin retrieve mobile request

curl https://www.rehive.com/api/3/admin/users/mobiles/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin retrieve mobile response

{
    "status": "success",
    "data": {
        "user": {
            "identifier": "00000000-0000-0000-0000-000000000000",
            "first_name": "Joe",
            "last_name": "Soap",
            "email": "joe@rehive.com",
            "username": "",
            "mobile_number": "+27840000000",
            "profile": null
        },
        "id": 1,
        "number": "+27840000000",
        "primary": true,
        "verified": true
    }
}

Retrieve a company’s mobile.

Endpoint

https://rehive.com/api/3/admin/users/mobiles/{id}/

Update Mobile

Admin update mobile request

curl https://www.rehive.com/api/3/admin/mobiles/{id}/`
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"verified": true}'

Admin update mobile response

{
    "status": "success",
    "data": {
        "user": {
            "identifier": "00000000-0000-0000-0000-000000000000",
            "first_name": "Joe",
            "last_name": "Soap",
            "email": "joe@rehive.com",
            "username": "",
            "mobile_number": "+27840000000",
            "profile": null
        },
        "id": 1,
        "number": "+27840000000",
        "primary": true,
        "verified": true
    }
}

Update a user’s mobile.

Endpoint

https://rehive.com/api/3/admin/users/mobiles/{id}/

Fields

Field Description Default Required
verified verified status false false
primary primary status false false

Transactions

List Transactions

Admin transactions request

curl https://www.rehive.com/api/3/admin/transactions/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin transactions response

 {
    "status": "success",
    "data": {
        "count": 2,
        "next": null,
        "previous": null,
        "results": [
            {
                "id": "000000000000000000000",
                "tx_type": "credit",
                "subtype": null,
                "external": false,
                "note": "",
                "metadata": {},
                "status": "Complete",
                "reference": "",
                "amount": 500,
                "fee": 0,
                "balance": 1000,
                "account": "akC49YT8x4",
                "label": "Credit",
                "company": "rehive",
                "currency": {
                    "description": "Rand",
                    "code": "ZAR",
                    "symbol": "R",
                    "unit": "rand",
                    "divisibility": 2
                },
                "user": {
                    "identifier": "00000000-0000-0000-0000-000000000000",
                    "first_name": "Joe",
                    "last_name": "Soap",
                    "email": "joe@rehive.com",
                    "username": "",
                    "mobile_number": "+27840000000",
                    "profile": null
                },
                "source_transaction": null,
                "destination_transaction": null,
                "created": 1496135465218,
                "updated": 1496135465287
            },
            {
                "id": "000000000000000000000",
                "tx_type": "credit",
                "subtype": null,
                "external": false,
                "note": "",
                "metadata": {},
                "status": "Complete",
                "reference": "",
                "amount": 500,
                "fee": 0,
                "balance": 500,
                "account": "akC49YT8x4",
                "label": "Credit",
                "company": "rehive",
                "currency": {
                    "description": "Rand",
                    "code": "ZAR",
                    "symbol": "R",
                    "unit": "rand",
                    "divisibility": 2
                },
                "user": {
                    "identifier": "00000000-0000-0000-0000-000000000000",
                    "first_name": "Joe",
                    "last_name": "Soap",
                    "email": "joe@rehive.com",
                    "username": "",
                    "mobile_number": "+27840000000",
                    "profile": null
                },
                "source_transaction": null,
                "destination_transaction": null,
                "created": 1496135465218,
                "updated": 1496135465287
            }
        ]
    }
}

Get a company’s transaction list.

Pagination

The list is paginated by default and can be navigated via the next and previous fields or by setting a page parameter in the request URL.

Filtering

The transactions listing offers filtering on the id, tx_type, subtype, status, created and metadata fields. This is done through URL parameters in the request URL:

/api/3/transactions/?tx_type=debit

You can also do boolean filtering on source_transaction and destination_transaction like this:

/api/3/transactions/?destination_transaction=true

There is a special format for fitering on metadata (ie. metadata__{field_name}):

/api/3/transactions/?metadata__type=test

Sorting

Sorting of the transactions listing can be done on all the “filtering” fields mentioned above via an orderby parameter in the request URL:

/api/3/transactions/?orderby=tx_type

Endpoint

https://rehive.com/api/3/admin/transactions/

Total Transactions

Admin total transactions request

curl https://www.rehive.com/api/3/admin/transactions/totals/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin total transactions response

{
    "status": "success",
    "data": {
        "amount": 1000,
        "fees": 0,
        "count": 2,
        "currency": "ZAR"
    }
}

Get a company’s total transaction details. This is a summary of transaction details like: amount totals, fee totals, and the total number of transactions.

Filtering

The admin transaction totals endpoint has identical filtering to the admin transaction list endpoint.

Endpoint

https://rehive.com/api/3/admin/transactions/totals/

Retrieve Transaction

Retrieve transaction request

curl https://www.rehive.com/api/3/admin/transactions/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve transaction response

{
    "status": "success",
    "data":  {
        "id": "000000000000000000000",
        "tx_type": "credit",
        "subtype": null,
        "external": false,
        "note": "",
        "metadata": {},
        "status": "Complete",
        "reference": "",
        "amount": 500,
        "fee": 0,
        "balance": 500,
        "account": "akC49YT8x4",
        "label": "Credit",
        "company": "rehive",
        "currency": {
            "description": "Rand",
            "code": "ZAR",
            "symbol": "R",
            "unit": "rand",
            "divisibility": 2
        },
        "user": {
            "identifier": "00000000-0000-0000-0000-000000000000",
            "first_name": "Joe",
            "last_name": "Soap",
            "email": "joe@rehive.com",
            "username": "",
            "mobile_number": "+27840000000",
            "profile": null
        },
        "source_transaction": null,
        "destination_transaction": null,
        "messages": [
            {
                "level": "info",
                "message": "Transaction completed.",
                "created": 1496144568989
            }
        ],
        "created": 1496135465218,
        "updated": 1496135465287
    }
}

Get transaction details for a spcific transactions.

Endpoint

https://rehive.com/api/3/admin/transactions/{id}/

Update Transaction

Admin update transaction request

curl https://rehive.com/api/3/admin/transactions/{id}/
  -X PUT
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"status": "Complete"}'

Admin update transaction response

{
    "status": "success",
    "data":  {
        "id": "000000000000000000000",
        "tx_type": "credit",
        "subtype": null,
        "external": false,
        "note": "",
        "metadata": {},
        "status": "Complete",
        "reference": "",
        "amount": 500,
        "fee": 0,
        "balance": 500,
        "account": "akC49YT8x4",
        "label": "Credit",
        "company": "rehive",
        "currency": {
            "description": "Rand",
            "code": "ZAR",
            "symbol": "R",
            "unit": "rand",
            "divisibility": 2
        },
        "user": {
            "identifier": "00000000-0000-0000-0000-000000000000",
            "first_name": "Joe",
            "last_name": "Soap",
            "email": "joe@rehive.com",
            "username": "",
            "mobile_number": "+27840000000",
            "profile": null
        },
        "source_transaction": null,
        "destination_transaction": null,
        "messages": [
            {
                "level": "info",
                "message": "Transaction completed.",
                "created": 1496144568989
            }
        ],
        "created": 1496135465218,
        "updated": 1496135465287
    }
}

Update a transaction’s status and metadata. This endpoint can be used to move transactions from pending to complete/failed/deleted and updated the corresponding user’s balance accordingly. In addition, you can add metadata and messages to the transaction.

Messsages

Custom messages can be attached to transactions by including a message attribute in an update request. The message attribute should be a JSON object with 2 attributes level and message.

  1. level : message log level, can be info, warning, error.
  2. message: A text message.

Each message added to a transaction will be stored in a list. Rehive itself will also add messages to this attribute when erorrs occur during processing.

Endpoint

https://rehive.com/api/3/admin/transactions/{id}/

Fields

Field Description Default Required
status update action/status (Complete, Failed, Deleted) null true
metadata custom metadata {} false
message message object {} false

Create Credit

Admin credit request

curl https://www.rehive.com/api/3/admin/transactions/credit/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"user": "joe@rehive.com",
       "amount": 500}'

Admin credit response

{
    "status": "success",
    "data": {
        "id": "00000000000000000000",
        "metadata": {}
    }
}

Create a credit transaction on behalf of a user.

Endpoint

https://rehive.com/api/3/admin/transactions/credit/

Fields

Field Description Default Required
user email, mobile number, unique identifier null true
amount amount 0 true
reference optional credit reference blank false
subtype a custom defined subtype null false
account account reference code null false
note user’s note or message blank false
currency currency code blank false
metadata custom metadata {} false
confirm_on_create complete immediately after creation false false

Create Debit

Admin debit request

curl https://www.rehive.com/api/3/admin/transactions/debit/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"user": "joe@rehive.com",
       "amount": 500}'

Admin debit response

{
    "status": "success",
    "data": {
        "id": "00000000000000000000",
        "metadata": {}
    }
}

Create a debit transaction on behalf of a user.

Endpoint

https://rehive.com/api/3/admin/transactions/debit/

Fields

Field Description Default Required
user email, mobile number, unique identifier null true
amount amount 0 true
reference optional debit reference blank false
subtype a custom defined subtype null false
account account reference code null false
note user’s note or message blank false
currency currency code blank false
metadata custom metadata {} false
confirm_on_create complete immediately after creation false false

Create Transfer

Admin transfer request

curl https://www.rehive.com/api/3/admin/transactions/transfer/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"user": "joe@rehive.com",
       "amount": 500,
       "reference": "sally@rehive.com"}'

Admin transfer response

{
    "status": "success",
    "data": {
        "id": "00000000000000000000",
        "metadata": {}
    }
}

Create a transfer transaction on behalf of a user. This will transfer currency from one user to another. If the recipient reference does not exist as a user in Rehive and the reference is an email address or mobile number then an invitation message will be sent to the recipient informing them they have an unclaimed transaction.

Endpoint

https://rehive.com/api/3/admin/transactions/transfer/

Fields

Field Description Default Required
user email, mobile number, unique identifier null true
amount amount 0 true
recipient email, mobile number, unique identifier null true
currency currency code blank false
debit_subtype a custom defined subtype null false
debit_account account reference code null false
debit_note user’s note or message blank false
debit_metadata custom metadata {} false
debit_reference optional debit reference string false
credit_subtype a custom defined subtype null false
credit_note user’s note or message blank false
credit_metadata custom metadata {} false
credit_reference optional credit reference string false

Accounts

Create Account

Admin create account request

curl https://www.rehive.com/api/3/admin/accounts/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"name": "savings",
       "user": "joe@rehive.com",}'

Admin create account response

{
    "status": "success",
    "data": {
        "name": "savings",
        "reference": "0000000000",
        "primary": true,
        "currencies": [],
        "created": 1501145581365,
        "updated": 1501145581370
    },
}

Create a account for a user.

Endpoint

https://rehive.com/api/3/admin/accounts/

Fields

Field Description Default Required
name account name null true
user account user null true
reference account reference 10 random chars false
primary account primary status false false

List Accounts

Admin list accounts request

curl https://www.rehive.com/api/3/admin/accounts/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin list accounts response

{
    "status": "success",
    "data": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "name": "default",
                "reference": "0000000000",
                "user": "joe@rehive.com",
                "currencies": [
                    {
                        "balance": 10000,
                        "currency": {
                            "code": "XBT",
                            "description": "bitcoin",
                            "symbol": "฿",
                            "unit": "bitcoin",
                            "divisibility": 8
                        },
                        "active": true
                    }
                ],
                "created": 1464858068745,
                "updated": 1464858068745
            }
        ]
    }
}

Get a list of accounts belonging to users in a company.

Pagination

The list is paginated and can be navigated via the next and previous fields or by setting a page parameter in the request URL.

Filtering

The account listing offers filtering on the active and user attributes. This is done through URL parameters in the request URL:

/api/3/admin/accounts/?active=true

Endpoint

https://rehive.com/api/3/admin/accounts/

Retrieve Account

Admin retrieve account request

curl https://www.rehive.com/api/3/admin/accounts/{reference}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin retrieve account response

{
    "status": "success",
    "data": {
        "name": "default",
        "reference": "0000000000",
        "user": "joe@rehive.com",
        "currencies": [
            {
                "balance": 10000,
                "currency": {
                    "code": "XBT",
                    "description": "bitcoin",
                    "symbol": "฿",
                    "unit": "bitcoin",
                    "divisibility": 8
                },
                "active": true
            }
        ],
        "created": 1464858068745,
        "updated": 1464858068745
    }
}

Retrieve an account belonging to a company.

Filtering

The account view offers filtering of currencies based on the active attribute. This is done through a URL parameter in the request URL:

/api/3/admin/accounts/{reference}/?active=true

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/

Update Account

Admin update account request

curl https://www.rehive.com/api/3/admin/accounts/{reference}/
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"name": "savings"}'

Admin update account response

{
    "status": "success",
    "data": {
        "name": "savings",
        "reference": "0000000000",
        "primary": true,
        "currencies": [],
        "created": 1501145581365,
        "updated": 1501145581370
    },
}

Update an account for a user.

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/

Fields

Field Description Default Required
name account name null true
user account user null true
reference account reference 10 random chars false
primary account primary status false false

List Account Currencies

Admin list account currencies request

curl https://www.rehive.com/admin/api/3/accounts/{reference}/currencies/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin list account currencies response

{
    "status": "success",
    "data": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "balance": 10000,
                "currency": {
                    "code": "XBT",
                    "description": "bitcoin",
                    "symbol": "฿",
                    "unit": "bitcoin",
                    "divisibility": 8
                },
                "active": true
            }
        ]
    }
}

Get a list of currencies for an account belonging to a company.

Pagination

The list is paginated and can be navigated via the next and previous fields or by setting a page parameter in the request URL.

Filtering

The account currency listing offers filtering on the active attribute. This is done through a URL parameter in the request URL:

/api/3/admin/accounts/{reference}/currencies/?active=true

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/

Retrieve Account Currency

Admin retrieve account currency request

curl https://www.rehive.com/api/3/admin/accounts/{reference}/currencies/{code}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin retrieve account currency response

{
    "status": "success",
    "data": {
        "balance": 10000,
        "currency": {
            "code": "XBT",
            "description": "bitcoin",
            "symbol": "฿",
            "unit": "bitcoin",
            "divisibility": 8
        },
        "active": true
    }
}

Retrieve an account’s currency belonging to a company.

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}

Update Account Currency

Admin retrieve account currency request

curl https://www.rehive.com/api/3/admin/accounts/{reference}/currencies/{code}
  -X PUT
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"active": true}'

Admin retrieve account currency response

{
    "status": "success",
    "data": {
        "balance": 10000,
        "currency": {
            "code": "XBT",
            "description": "bitcoin",
            "symbol": "฿",
            "unit": "bitcoin",
            "divisibility": 8
        },
        "active": true
    }
}

Update the active status of an account currency. Activating an account’s currency will result in that currency getting used by default for all transactions if no other account/currency is specified.

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}

Fields

Field Description Default Required
active is active currency false false

List Account Currency Limits

List all Limits related to am account currency.

List Account Currency request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/limits/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Account Currency Limits response

{
    "data": [
        {
            "id": 1,
            "value": 1000,
            "type": "Maximum",
            "tx_type": "credit",
            "subtype": null,
            "created": 1497428787920,
            "updated": 1497428787921
        }
    ],
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/limits/

Create Account Currency Limit

Create a new limit related to an account currency.

Create Account Currency Limit request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/limits/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"value": 1000,
       "type": "max",
       "tx_type": "credit"}'

Create Account Currency response

{
    "data": {
        "id": 1,
        "value": 1000,
        "type": "Maximum",
        "tx_type": "credit",
        "subtype": null,
        "created": 1497428787920,
        "updated": 1497428787921
    },
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/limits/

Fields

Field Description Default Required
value Limit value 0 true
type Limit Type true
tx_type Transaction type limits are applied true
subtype Transaction subtype name null false

Limit Types

Value Description
max Maximum
day_max Maximum per day
month_max Maximum per month
min Minimum
overdraft Overdraft

Transaction Types

Value Description
credit Credit
debit Debit

Retrieve Account Currency Limit

Retrieve a specific requirement related to an account currency.

Retrieve Account Currency request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/limits/{limit_id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Account Currency Limit response

{
    "data": {
        "id": 1,
        "value": 1000,
        "type": "Maximum",
        "tx_type": "credit",
        "subtype": null,
        "created": 1497428787920,
        "updated": 1497428787921
    },
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/limits/{limit_id}

Update Account Currency Limit

Update a specific limits related to an account currency.

Update Account Currency request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/limits/{limit_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"value": 5000,
       "type": "min"}'

Update Account Currency response

{
    "status": "success",
    "data": {
        "id": 1,
        "value": 5000,
        "type": "Minimum",
        "tx_type": "credit",
        "subtype": null,
        "created": 1497428787920,
        "updated": 1497429648948
    }
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/limits/{limit_id}

List Account Currency Fees

List all fees related to am account currency.

List Account Currency Fees request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/fees/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Account Currency Fees response

{
    "data": [
        {
            "id": 1,
            "value": 1000,
            "percentage": null,
            "tx_type": "credit",
            "subtype": null,
            "created": 1497431721587,
            "updated": 1497431721587
        }
    ],
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/fees/

Create Account Currency Fee

Create a new fee related to an account currency.

Create Account Currency Fee request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/fees/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"value": 1000,
       "tx_type": "credit"}'

Create Account Currency Fee response

{
    "data": {
        "id": 1,
        "value": 1000,
        "percentage": null,
        "tx_type": "credit",
        "subtype": null,
        "created": 1497431721587,
        "updated": 1497431721587
    },
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/fees/

Fields

Field Description Default Required
value Fee amount 0 false
percentage Percentage amount false
tx_type Transaction type fees are applied true
subtype Transaction subtype name null false

Transaction Types

Value Description
credit Credit
debit Debit

Retrieve Account Currency fee

Retrieve a specific requirement related to an account currency.

Retrieve Account Currency Fee request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/fees/{fee_id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Account Currency fee response

{
    "data": {
        "id": 1,
        "value": 1000,
        "percentage": null,
        "tx_type": "credit",
        "subtype": null,
        "created": 1497431721587,
        "updated": 1497431721587
    },
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/fees/{fee_id}

Update Account Currency Fee

Update a specific fees related to an account currency.

Update Account Currency request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/fees/{fee_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"value": 5000}'

Update Account Currency response

{
    "data": {
        "id": 1,
        "value": 5000,
        "percentage": null,
        "tx_type": "credit",
        "subtype": null,
        "created": 1497431721587,
        "updated": 1497431938971
    },
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/fees/{fee_id}

List Account Currency Switches

List all switches related to the currency

List Account Currency Switches request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/switches/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Account Currency Switches response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "tx_type": "credit",
            "subtype": null,
            "enabled": true,
            "created": 1497362397968,
            "updated": 1497362397968
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/switches/

Create Account Currency Switches

Create a new switch for the currency

Create Account Currency Switches request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/switches/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"tx_type": "credit",
       "enabled": true}'

Create Account Currency Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": true,
        "created": 1497362397968,
        "updated": 1497362397968
    }
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/switches/

Fields

Field Description Default Required
tx_type Transaction Type true
subtype Subtype name null false
enabled Enabled false true

Retrieve Account Currency Switches

Retrieve a specific switch related to the currency

Retrieve Account Currency Switches request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/switches/{id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Account Currency Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": true,
        "created": 1497362397968,
        "updated": 1497362397968
    }
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/switches/{id}

Update Account Currency Switches

Update a specific switch related to the currency

Update Account Currency Switches request

curl https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/switches/{id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"enabled": false}'

Update Account Currency Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": false,
        "created": 1497362397968,
        "updated": 1497362931403
    }
}

Endpoint

https://rehive.com/api/3/admin/accounts/{reference}/currencies/{code}/switches/{id}

Currencies

List Currencies

Admin list currencies request

curl https://www.rehive.com/api/3/admin/currencies/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin list currencies response

{
    "status": "success",
    "data": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "code": "XBT",
                "description": "bitcoin",
                "symbol": "฿",
                "unit": "bitcoin",
                "divisibility": 8
            }
        ]
    }
}

Get a list of all existing currencies. This includes default Rehive currencies as well as any currencies added by the company.

Endpoint

https://rehive.com/api/3/admin/currencies/

Create Currency

Admin create currency request

curl https://www.rehive.com/api/3/admin/currencies/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"code": "XBT",
        "description": "bitcoin",
        "symbol": "฿",
        "unit": "bitcoin",
        "divisibility": 8}'

Admin create currency response

 {
    "status": "success",
    "data": {
        "code": "XBT",
        "description": "bitcoin",
        "symbol": "฿",
        "unit": "bitcoin",
        "divisibility": 8,
        "enabled": false
    }
}

Create a custom currency. This currency will be unique to the company that created it.

Endpoint

https://rehive.com/api/3/admin/currencies/

Fields

Field Description Default Required
code currency code null true
description name of currency null true
symbol currency symbol null true
unit unit, like dollar null true
divisibility number of decimal places 0 true

Retrieve Currency

Admin retrieve currency request

curl https://www.rehive.com/api/3/admin/currencies/{code}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Admin retrieve currency response

{
    "status": "success",
    "data": {
        "code": "XBT",
        "description": "bitcoin",
        "symbol": "฿",
        "unit": "bitcoin",
        "divisibility": 8,
        "enabled": true
    }
}

Retrieve a currencies details.

Endpoint

https://rehive.com/api/3/admin/currencies/{code}/

Update Currency

Admin update currency request

curl https://www.rehive.com/api/3/admin/currencies/{code}/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -d '{"enabled": true}'

Admin update currency response

 {
    "status": "success",
    "data": {
        "code": "XBT",
        "description": "bitcoin",
        "symbol": "฿",
        "unit": "bitcoin",
        "divisibility": 8,
        "enabled": true
    }
}

Update a currency. this endpoint can be used to enable an existing currency or if it is a custom currency, edit its details.

Endpoint

https://rehive.com/api/3/admin/currencies/{code}/

Fields

Field Description Default Required
code currency code null true
description name of currency null true
symbol currency symbol null true
unit unit, like dollar null true
divisibility number of decimal places 0 true
enabled whether active for a company false true

Company

Retrieve Company

View the company info

curl https://rehive.com/api/3/admin/company/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Company info response

{
    "status": "success",
    "data": {
        "identifier": "test_company",
        "name": "Test Company 1",
        "description": "A Test Company.",
        "website": "http://www.test_company.com",
        "logo": "https://www.test_company.com/logo.jpg",
        "password_reset_url": null,
        "email_confirmation_url": null,
        "default_currency": "XBT"
    }
}

Retrieve the company info.

Endpoint

https://rehive.com/api/3/admin/company/

Update Company

Update company info

curl https://rehive.com/api/3/admin/company/
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"description": "A new description"}'

Update company info response

{
    "status": "success",
    "data": {
        "identifier": "test_company",
        "name": "Test Company 1",
        "description": "A new description",
        "website": "http://www.test_company.com",
        "logo": "https://www.test_company.com/logo.jpg",
        "password_reset_url": null,
        "email_confirmation_url": null,
        "default_currency": "XBT"
    }
}

Retrieve the company info.

Endpoint

https://rehive.com/api/3/admin/company/

Fields

Field Description Default Required
name Company Name blank false
description Company Description blank false
website Company website URL blank false
logo Company logo URL blank false
password_reset_url Custom company password reset URL blank false
email_confirmation_url Custom company email confirmation URL blank false
default_currency Default company currency null false

List Company Switches

List all switches related to a company.

List Company Switches request

curl https://rehive.com/api/3/admin/company/switches/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Company Switches response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "tx_type": "credit",
            "subtype": null,
            "enabled": true,
            "created": 1497362397968,
            "updated": 1497362397968
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/company/switches/

Create Company Switches

Create switches related to a company.

Create Company Switches request

curl https://rehive.com/api/3/admin/company/switches/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"tx_type": "credit",
       "enabled": true}'

Create Company Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": true,
        "created": 1497362397968,
        "updated": 1497362397968
    }
}

Endpoint

https://rehive.com/api/3/admin/company/switches/

Fields

Field Description Default Required
tx_type Transaction Type true
subtype Subtype name null false
enabled Enabled false true

Retrieve Company Switches

Retrieve a specific switch related to a company.

Retrieve Company Switches request

curl https://rehive.com/api/3/admin/company/switches/{id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Company Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": true,
        "created": 1497362397968,
        "updated": 1497362397968
    }
}

Endpoint

https://rehive.com/api/3/admin/company/switches/{id}

Update Company Switches

Update a specific switch related to a company.

Update Company Switches request

curl https://rehive.com/api/3/admin/company/switches/{id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"enabled": false}'

Update Company Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": false,
        "created": 1497362397968,
        "updated": 1497362931403
    }
}

Endpoint

https://rehive.com/api/3/admin/company/switches/{id}

Transaction Webhooks

List Transaction Webhooks

List transaction webhooks request

curl https://rehive.com/api/3/admin/webhooks/transactions/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List transaction webhooks response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "url": "http://mysite.com/webhook_endpoint",
            "event": "transaction.create",
            "tx_type": "debit",
            "secret": "supersecret"
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/webhooks/transactions/

Create Transaction Webhooks

Create transaction webhooks request

curl https://rehive.com/api/3/admin/webhooks/transactions/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"url": "http://mysite.com/webhook_endpoint",
       "event": "transaction.create",
       "tx_type": "debit",
       "secret": "secret"}'

List transaction webhooks response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "url": "http://mysite.com/webhook_endpoint",
            "event": "transaction.create",
            "tx_type": "debit",
            "secret": "secret"
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/webhooks/transactions/

Fields

Field Description Default Required
url Webhook URL blank true
event Webhook event null true
tx_type Transaction type null false
secret Webhook secret “secret” false

Retrieve Transaction Webhook

Retrieve transaction webhook request

curl https://rehive.com/api/3/admin/webhooks/transactions/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve transaction webhook response

{
    "status": "success",
    "data": {
        "id": 1,
        "url": "http://mysite.com/webhook_endpoint",
        "event": "transaction.create",
        "tx_type": "debit",
        "secret": "secret"
    }
}

Endpoint

https://rehive.com/api/3/admin/webhooks/transactions/{id}/

Update Transaction Webhook

Update transaction webhook request

curl https://rehive.com/api/3/admin/webhooks/transactions/{id}/
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"url": "http://mysite.com/webhook_endpoint"}'

Update transaction webhook response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "url": "http://mysite.com/webhook_endpoint",
            "event": "transaction.create",
            "tx_type": "debit",
            "secret": "secret"
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/webhooks/transactions/{id}/

Fields

Field Description Default Required
url Webhook URL blank true
event Webhook event null true
tx_type Transaction type null false
secret Webhook secret “secret” false

User Webhooks

List User Webhooks

List user webhooks request

curl https://rehive.com/api/3/admin/webhooks/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List user webhooks response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "url": "http://mysite.com/webhook_endpoint",
            "event": "user.create",
            "secret": "secret"
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/webhooks/users/

Create User Webhooks

Create user webhooks request

curl https://rehive.com/api/3/admin/webhooks/users/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"url": "http://mysite.com/webhook_endpoint",
       "event": "user.create",
       "secret": "secret"}'

List user webhooks response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "url": "http://mysite.com/webhook_endpoint",
            "event": "user.create",
            "secret": "secret"
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/webhooks/users/

Fields

Field Description Default Required
url Webhook URL blank true
event Webhook event null true
secret Webhook secret “secret” false

Retrieve User Webhook

Retrieve user webhook request

curl https://rehive.com/api/3/admin/webhooks/users/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve user webhook response

{
    "status": "success",
    "data": {
        "id": 1,
        "url": "http://mysite.com/webhook_endpoint",
        "event": "user.create",
        "secret": "secret"
    }
}

Endpoint

https://rehive.com/api/3/admin/webhooks/users/{id}/

Update User Webhook

Update user webhook request

curl https://rehive.com/api/3/admin/webhooks/users/{id}/
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"url": "http://mysite.com/webhook_endpoint"}'

Update user webhook response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "url": "http://mysite.com/webhook_endpoint",
            "event": "user.create",
            "secret": "secret"
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/webhooks/users/{id}/

Fields

Field Description Default Required
url Webhook URL blank true
event Webhook event null true
secret Webhook secret “secret” false

Subtypes

List Subtypes

List subtypes request

curl https://rehive.com/api/3/admin/subtypes/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List subtypes response

{
    "status": "success",
    "data": [
        {
            "id": 20,
            "name": "credit_subtype",
            "label": "Our credit",
            "description": "Description for our credit",
            "tx_type": "credit",
            "created": "2017-04-28T11:36:57.396723Z",
            "updated": "2017-04-28T11:36:57.396743Z"
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/subtypes/

Create subtypes

Create subtypes request

curl https://rehive.com/api/3/admin/subtypes/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Create subtypes response

{
    "status": "success",
    "data": {
        "id": 20,
        "name": "credit_subtype",
        "label": "Our credit",
        "description": "Description for our credit",
        "tx_type": "credit",
        "created": "2017-04-28T11:36:57.396723Z",
        "updated": "2017-04-28T11:36:57.396743Z"
    }
}

Endpoint

https://rehive.com/api/3/admin/subtypes/

Fields

Field Description Default Required
name name blank true
label label blank false
description description blank false
tx_type Transaction type blank true

Retrieve Subtypes

Retrieve subtypes request

curl https://rehive.com/api/3/admin/subtypes/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve subtypes response

{
    "status": "success",
    "data": {
        "id": 20,
        "name": "credit_subtype",
        "label": "Our credit",
        "description": "Description for our credit",
        "tx_type": "credit",
        "created": "2017-04-28T11:36:57.396723Z",
        "updated": "2017-04-28T11:36:57.396743Z"
    }
}

Endpoint

https://rehive.com/api/3/admin/subtypes/{id}

Update subtypes

Update subtypes request

curl https://rehive.com/api/3/admin/subtypes/
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"description": "New description"}'

Update subtypes response

{
    "status": "success",
    "data": {
        "id": 20,
        "name": "credit_subtype",
        "label": "Our credit",
        "description": "New description",
        "tx_type": "credit",
        "created": "2017-04-28T11:36:57.396723Z",
        "updated": "2017-04-28T11:36:57.396743Z"
    }
}

Endpoint

https://rehive.com/api/3/admin/subtypes/{id}

Fields

Field Description Default Required
name name blank true
label label blank false
description description blank false
tx_type Transaction type blank true

Bank Accounts

List Bank Accounts

List Bank Accounts request

curl https://rehive.com/api/3/admin/bank-accounts/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Bank Accounts response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "name": "Bank Account",
            "number": "12341234",
            "type": "Cheque",
            "bank_name": "Barclays",
            "bank_code": "1234",
            "branch_code": "1234",
            "swift": null,
            "iban": null,
            "bic": null
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/bank-accounts/

Create Bank Account

Create Bank Account request

curl https://rehive.com/api/3/admin/bank-accounts/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"name": "Bank Account",
        "number": "12341234",
        "type": "Cheque",
        "bank_name": "Barclays",
        "bank_code": "1234",
        "branch_code": "1234"}'

Create Bank Account response

{
    "status": "success",
    "data": {
        "id": 2,
        "name": "Bank Account",
        "number": "12341234",
        "type": "Cheque",
        "bank_name": "Barclays",
        "bank_code": "1234",
        "branch_code": "1234",
        "swift": null,
        "iban": null,
        "bic": null
    }
}

Endpoint

https://rehive.com/api/3/admin/bank-accounts/

Fields

Field Description Default Required
name Account Name blank false
number Account Number blank false
type Account Type blank false
bank_name Bank Name blank false
bank_code Bank Code blank false
branch_code Branch Code blank false

Retrieve Bank Account

Retrieve Bank Account request

curl https://rehive.com/api/3/admin/bank-accounts/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Bank Account response

{
    "status": "success",
    "data": {
        "id": 1,
        "name": "Bank Account",
        "number": "12341234",
        "type": "Cheque",
        "bank_name": "Barclays",
        "bank_code": "1234",
        "branch_code": "1234",
        "swift": null,
        "iban": null,
        "bic": null
    }
}

Endpoint

https://rehive.com/api/3/admin/bank-accounts/{id}

Update Bank Account

Update Bank Account request

curl https://rehive.com/api/3/admin/bank-accounts/{id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"name": "New account name"}'

Update Bank Account response

{
    "status": "success",
    "data": {
        "id": 1,
        "name": "New account name",
        "number": "12341234",
        "type": "Cheque",
        "bank_name": "Barclays",
        "bank_code": "1234",
        "branch_code": "1234",
        "swift": null,
        "iban": null,
        "bic": null
    }
}

Endpoint

https://rehive.com/api/3/admin/bank-accounts/{id}

Fields

Field Description Default Required
name Account Name blank false
number Account Number blank false
type Account Type blank false
bank_name Bank Name blank false
bank_code Bank Code blank false
branch_code Branch Code blank false

Notifications

List Notifications

List Notifications request

curl https://rehive.com/api/3/admin/notifications/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Notifications response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "name": "tx_debit",
            "description": "Debit transaction notifications",
            "enabled": true
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/notifications/

Retrieve Notifications

Retrieve Notifications request

curl https://rehive.com/api/3/admin/notifications/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Notifications response

{
    "status": "success",
    "data": {
        "id": 1,
        "name": "tx_debit",
        "description": "Debit transaction notifications",
        "enabled": true
    }
}

Endpoint

https://rehive.com/api/3/admin/notifications/{id}

Update Notifications

Update Notifications request

curl https://rehive.com/api/3/admin/notifications/{id}
  -X PUT
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"enabled": false}'

Update Notifications response

{
    "status": "success",
    "data": {
        "id": 1,
        "name": "tx_debit",
        "description": "Debit transaction notifications",
        "enabled": false
    }
}

Endpoint

https://rehive.com/api/3/admin/notifications/{id}

Fields

Field Description Default Required
enabled Account Name false true

Tiers

Tiers are a way in which to categorise users based on requirements for the tier. Tiers are set on a currency to limit users’ transactions on that currency.

Tiers are checked in ascending order based on their level, with the user getting validation corresponding to the highest tier they matched.

Create Tier

Create a new tier.

Create Tier request

curl https://rehive.com/api/3/admin/tiers/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"switch_type": "transactions",
       "enabled": false}'

Create Tier response

{
    "status": "success",
    "data": {
        "id": 1,
        "currency": "ZAR",
        "level": 1,
        "name": "First Tier",
        "description": "My First Tier",
        "requirements": [],
        "limits": [],
        "fees": [],
        "switches": [],
        "created": 1497367640298,
        "updated": 1497367640298
    }
}

Endpoint

https://rehive.com/api/3/admin/tiers/

Fields

Field Description Default Required
currency Currency code related to this tier true
name Name of the tier blank false
description Description of the tier blank false

List Tier

List all tiers.

List Tier request

curl https://rehive.com/api/3/admin/tiers/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Tier response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "currency": "ZAR",
            "level": 1,
            "name": "First Tier",
            "description": "My First Tier",
            "requirements": [],
            "limits": [],
            "fees": [],
            "switches": [],
            "created": 1497367640298,
            "updated": 1497367640298
        }
    ]
}

Filtering

Tiers can be filtered by currency as well as requirement. This is done through URL parameters in the request URL:

/api/3/admin/tiers/?currency=ZAR

/api/3/admin/tiers/?requirement=nationality

Endpoint

https://rehive.com/api/3/admin/tiers/

Retrieve Tier

Retrieve a specific tier.

Retrieve Tier request

curl https://rehive.com/api/3/admin/tiers/{id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Tier response

{
    "status": "success",
    "data": {
        "id": 1,
        "currency": "ZAR",
        "level": 1,
        "name": "First Tier",
        "description": "My First Tier",
        "requirements": [],
        "limits": [],
        "fees": [],
        "switches": [],
        "created": 1497367640298,
        "updated": 1497367640298
    }
}

Endpoint

https://rehive.com/api/3/admin/tiers/{id

Update Tier

Update the name of description of a tier.

Update Tier request

curl https://rehive.com/api/3/admin/tiers/{id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"name": "Updated Name"}'

Update Tier response

{
    "status": "success",
    "data": {
        "id": 1,
        "currency": "ZAR",
        "level": 1,
        "name": "Updated Name",
        "description": "My First Tier",
        "requirements": [],
        "limits": [],
        "fees": [],
        "switches": [],
        "created": 1497367640298,
        "updated": 1497369829536
    }
}

Fields

Field Description Default Required
name Name of the tier blank false
description Description of the tier blank false

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}

List Tier Requirements

List all requirements related to a tier.

List Tier Requirements request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/requirements/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Tier Requirements response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "token_tier": "Tier-1 Updated Name (ZAR_test_company_1)",
            "requirement": "First Name"
        },
        {
            "id": 2,
            "token_tier": "Tier-1 Updated Name (ZAR_test_company_1)",
            "requirement": "Last Name"
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/requirements/

Create Tier Requirements

Create a new switch related to a Tier.

Create Tier Requirements request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/requirements/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"requirement": "birth_date"}'

Create Tier Requirements response

{
    "status": "success",
    "data": {
        "id": 3,
        "token_tier": "Tier-1 Updated Name (ZAR_test_company_1)",
        "requirement": "Birth Date"
    }
}

Requirement Types

Value Description
first_name First Name
last_name Last Name
nationality Nationality
birth_date Birth Date
id_number ID Number
language Language
address Address
bank_account Bank Account
email_address Email Address
mobile_number Mobile Number
proof_of_identity Proof of identity
proof_of_address Proof of address
advanced_proof_of_identity Advanced proof of identity

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/requirements/

Fields

Field Description Default Required
requirement Requirement Type true

Retrieve Tier Requirements

Retrieve a specific requirement related to a Tier

Retrieve Tier Requirements request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/requirements/{requirement_id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Tier Requirements response

{
    "status": "success",
    "data": {
        "id": 3,
        "token_tier": "Tier-1 Updated Name (ZAR_test_company_1)",
        "requirement": "Birth Date"
    }
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/requirements/{requirement_id}

Update Tier Requirements

Update a specific requirement related to a Tier

Update Tier Requirements request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/requirements/{switch_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"enabled": "proof_of_identity"}'

Update Tier Requirements response

{
    "status": "success",
    "data": {
        "id": 3,
        "token_tier": "Tier-1 Updated Name (ZAR_test_company_1)",
        "requirement": "Proof Of Identity"
    }
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/requirements/{requirement_id}

List Tier Limits

List all Limits related to a tier.

List Tier Limits request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/limits/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Tier Limits response

  {
    "status": "success",
    "data": [
        {
            "id": 1,
            "value": 1000,
            "type": "Maximum",
            "tx_type": "credit",
            "subtype": null,
            "created": 1497374071027,
            "updated": 1497374071027
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/limits/

Create Tier Limits

Create a new limit related to a Tier.

Create Tier Limits request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/limits/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"requirement": "birth_date"}'

Create Tier Limits response

{
    "status": "success",
    "data": {
        "id": 1,
        "value": 1000,
        "type": "Maximum",
        "tx_type": "credit",
        "subtype": null,
        "created": 1497374071027,
        "updated": 1497374071027
    }
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/limits/

Fields

Field Description Default Required
value Limit value 0 true
type Limit Type true
tx_type Transaction type limits are applied true
subtype Transaction subtype name null false

Limit Types

Value Description
max Maximum
day_max Maximum per day
month_max Maximum per month
min Minimum
overdraft Overdraft

Transaction Types

Value Description
credit Credit
debit Debit

Retrieve Tier Limits

Retrieve a specific requirement related to a Tier

Retrieve Tier Limits request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/limits/{limit_id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Tier Limits response

{
    "data": {
        "id": 1,
        "value": 1000,
        "type": "Maximum",
        "tx_type": "credit",
        "subtype": null,
        "created": 1497374071027,
        "updated": 1497374071027
    },
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/limits/{limits_id}

Update Tier Limits

Update a specific limits related to a Tier

Update Tier Limits request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/limits/{limits_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"value": 5000,
       "type": "min"}'

Update Tier Limits response

{
    "status": "success",
    "data": {
        "id": 1,
        "value": 5000,
        "type": "Minimum",
        "tx_type": "credit",
        "subtype": null,
        "created": 1497374071027,
        "updated": 1497374886088
    }
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/limits/{limits_id}

List Tier Fees

List all fees related to a Tier.

List Tier Fees request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/fees/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Tier Fees response

{
    "data": [
        {
            "id": 1,
            "value": 1000,
            "percentage": null,
            "tx_type": "credit",
            "subtype": null,
            "created": 1497431721587,
            "updated": 1497431721587
        }
    ],
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/fees/

Create Tier Fee

Create a new fee related to a Tier.

Create Tier Fee request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/fees/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"value": 1000,
       "tx_type": "credit"}'

Create Tier Fee response

{
    "data": {
        "id": 1,
        "value": 1000,
        "percentage": null,
        "tx_type": "credit",
        "subtype": null,
        "created": 1497431721587,
        "updated": 1497431721587
    },
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/fees/

Fields

Field Description Default Required
value Fee amount 0 false
percentage Percentage amount false
tx_type Transaction type fees are applied true
subtype Transaction subtype name null false

Transaction Types

Value Description
credit Credit
debit Debit

Retrieve Tier fee

Retrieve a specific requirement related to a Tier.

Retrieve Tier Fee request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/fees/{fee_id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Tier Fee response

{
    "data": {
        "id": 1,
        "value": 1000,
        "percentage": null,
        "tx_type": "credit",
        "subtype": null,
        "created": 1497431721587,
        "updated": 1497431721587
    },
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/fees/{fee_id}

Update Tier Fee

Update a specific fees related to a Tier.

Update Tier request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/fees/{fee_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"value": 5000}'

Update Tier response

{
    "data": {
        "id": 1,
        "value": 5000,
        "percentage": null,
        "tx_type": "credit",
        "subtype": null,
        "created": 1497431721587,
        "updated": 1497431938971
    },
    "status": "success"
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/fees/{fee_id}

List Tier Switches

List all switches related to a tier.

List Tier Switches request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/switches/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Tier Switches response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "tx_type": "credit",
            "subtype": null,
            "enabled": true,
            "created": 1497370313086,
            "updated": 1497370313086
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/switches/

Create Tier Switches

Create a new switch related to a Tier.

Create Tier Switches request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/switches/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"tx_type": "credit",
       "enabled": true}'

Create Tier Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": true,
        "created": 1497370313086,
        "updated": 1497370313086
    }
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/switches/

Fields

Field Description Default Required
tx_type Transaction Type true
subtype Subtype name null false
enabled Enabled false true

Retrieve Tier Switches

Retrieve a specific switch related to a Tier

Retrieve Tier Switches request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/switches/{switch_id}
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Tier Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": true,
        "created": 1497370313086,
        "updated": 1497370313086
    }
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/switches/{switch_id}

Update Tier Switches

Update a specific switch related to a Tier

Update Tier Switches request

curl https://rehive.com/api/3/admin/tiers/{tier_id}/switches/{switch_id}
  -X PATCH
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"enabled": false}'

Update Tier Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "tx_type": "credit",
        "subtype": null,
        "enabled": true,
        "created": 1497370313086,
        "updated": 1497370313086
    }
}

Endpoint

https://rehive.com/api/3/admin/tiers/{tier_id}/switches/{switch_id}

Switches

Switches are a way to determine which actions are allowed to the users in terms of transactions.

Global switches are the highest level switches by overriding any switches that are set on a user, company, currency or tier level.

Create Global Switches

Create a new global switch.

Create Global Switches request

curl https://rehive.com/api/3/admin/switches/
  -X POST
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"switch_type": "transactions",
       "enabled": false}'

Create Global Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "company": {
            "identifier": "test_company_1",
            "name": "Test Company 1",
            "description": "Wallets for everyone.",
            "website": "http://wwww.rehive.io",
            "logo": null
        },
        "switch_type": "Allow transactions",
        "enabled": false,
        "created": 1497348308625,
        "updated": 1497348318654
    }
}

Types

Global switches can be one of the following 2 types.

Value Description
transactions Allow transactions
verification Allow transactions for unverified users
overdraft Allow unlimited overdrafts
`auto_confirm Automatically complete transactions on creation
manage_accounts Allow users to manage their accounts
session_duration Allow users to set their own session duration

Endpoint

https://rehive.com/api/3/admin/switches/

Fields

Field Description Default Required
switch_type Global Switch Type Label true
enabled Account Name false true

List Global Switches

List all the global switches.

List Global Switches request

curl https://rehive.com/api/3/admin/switches/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

List Global Switches response

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "company": {
                "identifier": "test_company_1",
                "name": "Test Company 1",
                "description": "Wallets for everyone.",
                "website": "http://wwww.rehive.io",
                "logo": null
            },
            "switch_type": "Allow transactions",
            "enabled": true,
            "created": 1497347723605,
            "updated": 1497347723605
        }
    ]
}

Endpoint

https://rehive.com/api/3/admin/switches/

Retrieve Global Switches

Retrieve a specific global switch.

Retrieve Global Switches request

curl https://rehive.com/api/3/admin/switches/{id}/
  -X GET
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"

Retrieve Global Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "company": {
            "identifier": "test_company_1",
            "name": "Test Company 1",
            "description": "Wallets for everyone.",
            "website": "http://wwww.rehive.io",
            "logo": null
        },
        "switch_type": "Allow transactions",
        "enabled": true,
        "created": 1497347723605,
        "updated": 1497347723605
    }
}

Endpoint

https://rehive.com/api/3/admin/switches/{id}

Update Global Switches

Update a specific global switch.

Update Global Switches request

curl https://rehive.com/api/3/admin/switches/{id}
  -X PUT
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
  -D '{"enabled": false}'

Update Global Switches response

{
    "status": "success",
    "data": {
        "id": 1,
        "company": {
            "identifier": "test_company_1",
            "name": "Test Company 1",
            "description": "Wallets for everyone.",
            "website": "http://wwww.rehive.io",
            "logo": null
        },
        "switch_type": "Allow transactions",
        "enabled": false,
        "created": 1497348308625,
        "updated": 1497348318654
    }
}

Endpoint

https://rehive.com/api/3/admin/switches/{id}

Fields

Field Description Default Required
switch_type Global Switch Type false
enabled Account Name false false

Beta Features

This section contains experimental features that are not fully developed yet. Experimental features are not always stable and may undergo spot changes on a regular basis.

Webhook Events

Webhook format

{
    "event": "event.name",
    "company": "company_identifier",
    "data": {
        ...
    }
}

Rehive has a collection of internal events that can be configured to fire off custom webhooks.

Webhooks should always be created with a unique secret key (See the webhook API endpoint docs for more about creating webhooks). The secret key can be used to identify valid Rehive requests to your server. The secret should be checked in the Authorization header when receiving a webhook.

Rehive expects a 200 OK HTTP response when webhooks are called. If a 200 response is not returned, Rehive will retry the webhook up to a max of 24 times over up to 24 hours. Webhooks will retry every 5 min if the server does not repsond with a valid HTTP response. Non 200 responses will retry every hour.

Transaction Events

Rehive currently support the following transaction events:

Event Description
transaction.create transaction created event
transaction.update transaction updated event
transaction.delete transaction deleted event
transaction.initiate transaction initiated (pending) event
transaction.execute transaction executed (complete/failed) event

User Events

Rehive currently support the following user events:

Event Description
user.create user created event
user.update user updated event
user.delete user deleted event
user.password.reset user password reset request event
user.email.verify user email verification event (Email key)
user.mobile.verify user mobile verification event (OTP key)

Idempotent Requests

Idempotent Request

curl {url}
  -X GET
  -H "Idempotency-Key: {key}"
  -H "Authorization: Token {token}"
  -H "Content-Type: application/json"
"Not applicable for sdk"

The Rehive API supports idempotent requests for ensuring the same operations never occur twice.

To perform an idempotent request, attach a unique key to any POST, PUT or PATCH request made to the API: via the Idempotency-Key: {key} header.

API requests made with a new key will get saved along with their HTTP response. Follow up requests made with the same key will always return the same response (As long as the request has the same HTTP method and URL path). The keys (and their associated saved responses) expire after 24 hours.