Introduction
Welcome to the Salaryo API 😺! You can use our API to access members API endpoints, which can get information on invoices in our database.
The base API path is https://app.salaryo.com/api.
- When testing the API you may use our sandbox environemt.
The v1 API enables your company to integrate your system with our service and send invoices that you would like to be financed by Salaryo. There are two main options for notifying our service about new invoices:
- Invoices API - background integration for your managment system.
- Web Redirect API - redirecting members directly to our service.
Additionally you can use our webhooks API and be notified when the status of your application changes.
Authentication
To authorize, use this code:
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
-H "Authorization: PRIVATE_KEY"
// npm install request
import * as request from "request";
request.post(
"https://app.salaryo.com/api/invoices",
{
headers: {
Authorization: "PRIVATE_KEY"
}
},
(error, response, body) => {
console.log(response);
}
);
Make sure to replace
PRIVATE_KEYwith your API key.
REST Authentication
Salaryo uses API keys to allow access to the API. You can register a new Salaryo API key by contacting us.
After being approved you will be granted two developer keys - private and public.
Salaryo expects for the private API key to be included in all REST API requests to the server in a header that looks like the following:
Authorization: PRIVATE_KEY
Web Redirect Authentication
In addition to the main REST API, salaryo also supports a web redirect API. When using this api you must send your public key as a query parameter.
https://app.salaryo.com/redirect?public_key=PUBLIC_KEY
Responses
Successfull response
{
"ok": true,
"data": {
"id": "identifier"
}
}
Failure response
{
"ok": false,
"error": {
"code": 400,
"message": "Invalid deposit amount"
}
}
All the endpoints return a JSON structured like this:
| Field | Description |
|---|---|
| ok | A boolean indicating wether the request succeeded |
| data | Endpoint specific data |
| error | If the request failed, an error object will be added |
| error.code | Error code with the failure reason |
| error.message | A message describing the error |
Invoices
Create a new invoice inquiry
Create a new invoice. Calling this method will do the following:
- Create a new invoice in our database.
- Add a new invoice to your coworking space's Salaryo dashboard.
- Notify the member about his new invoice via the specified email.
curl "https://app.salaryo.com/api/invoices"
-X POST
-H "Authorization: PRIVATE_KEY"
-H "Content-Type: application/json"
-D '{"email":"test@email.com", "name":"John Doe", "deposit_amount":1000, "rent_amount":700, "company_name":"Company Inc.", "location":"location_id", "metadata":{"internal_id":"INTERNAL_ID"}}'
// npm install request
import * as request from "request";
request.post(
"https://app.salaryo.com/api/invoices",
{
json: {
email: "test@email.com",
name: "John Doe",
deposit_amount: 1000,
rent_amount: 700,
company_name: "Company Inc.",
location: "location_id",
metadata: { internal_id: "INTERNAL_ID" }
},
headers: {
Authorization: "PRIVATE_KEY"
}
},
(error, response, body) => {
console.log(response);
}
);
The above command returns JSON structured like this:
{
"ok": true,
"data": {
"id": "invoice_identifier",
"redirectLink":
"https://app.salaryo.com/members?id=INVOICE_ID&cowork=YOUR_COWORK"
}
}
You may use the redirectLink to notify a member about his invoice via Salaryo.
HTTP Request
POST https://app.salaryo.com/api/invoices
Body Parameters
| Parameter | type | Required | Description |
|---|---|---|---|
| string | true | The members email. We'll use it to contact the member | |
| name | string | true | The name of contact person of the company |
| deposit_amount | number | true | The deposit amount for the invoice in USD. This is the invoice amount |
| rent_amount | number | true | The company's rent amount for each month in USD |
| company_name | string | false | The name of the company |
| location | string | true | The coworking location that the company is associated with. (See Locations) |
| metadata | object | false | Metadata that is associated with the invoice. The metadata will be attached in future webhooks when the invoice's status will updated |
Web Redirect
The web redirect API enables developers to redirect coworking space members which are interested in financing their security deposit or office rent.
To use the web redirect API send your users to the following url - https://app.salaryo.com/redirect.
After referring a user to the redirect API, a new invoice will be created for your Salaryo account, and you can optionaly receive webhooks regarding the status updates of the invoice (Using the webhooks API).
Redirect a memebr
Send your members to the following url with the required query parameters https://app.salaryo.com/redirect:
# Only javascript is supported on the client side. Redirect your users to:
echo 'https://app.salaryo.com/redirect?public_key=${public_key}&email=${email}&name=${name}&deposit_amount=${deposit_amount}&rent_amount=${rent_amount}&company_name=${company_name}&location=${location}&metadata={"internal_id":"INTERNAL_ID"}'
function referMember({
public_key,
email,
name,
deposit_amount,
rent_amount,
company_name,
location,
metadata
}) {
var url = `https://app.salaryo.com/redirect?public_key=${public_key}&email=${email}&name=${name}&deposit_amount=${deposit_amount}&rent_amount=${rent_amount}&company_name=${company_name}&location=${location}&metadata=${JSON.stringify(
metadata
)}`;
window.open(url);
}
referMember({
public_key: "PUBLIC_KEY",
name: "JOHN DOW",
email: "test@email.com",
deposit_amount: 1000,
rent_amount: 500,
company_name: "Company INC",
location: "location_id",
metadata: {
internal_id: "INTERNAL_ID"
}
});
Query Parameters
| Parameter | Required | Description |
|---|---|---|
| public_key | true | Your Salaryo API PUBLIC_KEY |
| true | The members email. We'll use it to contact the member | |
| name | true | The name of contact person of the company |
| deposit_amount | true | The deposit amount for the inquiry in USD. This is the inquiry amount |
| rent_amount | true | The company's rent amount for each month in USD |
| company_name | false | The name of the company |
| location | true | The coworking location that the company is associated with |
| metadata | false | Metadata that is associated with the inquiry. The metadata will be attached in future webhooks when the invoice's status will update |
Webhooks
Set your account's webhook URL
Salaryo can notify your service when changes occur to your invoices. After the status of your invoice changed, salaryo will send a POST request to your webhook url, containing the updated data.
The POST request will contain a body with following info:
| Parameter | Type | Description |
|---|---|---|
| type | string | One of 'status_update', 'integration_test' |
| status | string | The updated invoice status. (See Invoice Statuses) |
| metadata | object | The metadata sent via the createInvoice API. (See Create Invoice) |
When changing your webhook url, we verify that the given webhook url accepts a test POST request with type integration_test and returns a 200 status code.
curl "https://app.salaryo.com/api/webhooks"
-X PUT
-H "Authorization: PRIVATE_KEY"
-H "Content-Type: application/json"
-D '{"webhook":"https://your.webhook.com"}'
// npm install request
import * as request from "request";
request.put(
"https://app.salaryo.com/api/webhooks",
{
json: {
webhook: "https://your.webhook.com"
},
headers: {
Authorization: "PRIVATE_KEY"
}
},
(error, response, body) => {
console.log(response);
}
);
The above command returns JSON structured like this:
{
"ok": true
}
HTTP Request
PUT https://app.salaryo.com/api/webhooks
Body Parameters
| Parameter | Required | Description |
|---|---|---|
| webhook | true | The URL of your webhook |
Invoice status types
The following invoice statuses can appear in the webhook status_update notification:
| Status | Meaning |
|---|---|
| approved | The invoice had been approved by Salaryo. |
| funded | The funds had been wired to your coworking space's bank account. |
| declined | The invoice funding had been declined by salaryo. The member will not be funded. |
| canceled | The member had canceled the invoice application. The member will not be funded. |
Locations
A Salaryo API Location represents a coworking space location. When adding new invoices they should be assigned to the location that the member is entering.
Get Locations
To get a list of all your account's locations use the GET https://app.salaryo.com/locations endpoint.
curl "https://app.salaryo.com/api/locations"
-X GET
-H "Authorization: PRIVATE_KEY"
// npm install request
import * as request from "request";
request.get(
"https://app.salaryo.com/api/locations",
{
headers: {
Authorization: "PRIVATE_KEY"
}
},
(error, response, body) => {
console.log(response);
}
);
The above command returns JSON structured like this:
{
"ok": true,
"data": {
"locations": [
{
"name": "broadway_120",
"displayName": "Broadway 120"
},
{
"name": "central_park",
"displayName": "Central Park"
}
]
}
}
Sanbox
Using the sandbox environment
When integrating the API you may test your integration with our sandbox environment. In order to use the sandbox environment use the following base API path: https://dev.app.salaryo.com/api instead of the production base API path (which is https://app.salaryo.com/api).
The same PRIVATE_KEY and PUBLIC_KEY are valid for both the production and sandbox environments.
When trying to access our Coworking Dashboard inorder to view your invoices, use the following url: https://dev.app.salaryo.com and login with the same email you used for our production dashboard.
Errors
The Salaryo API uses the following error codes:
| Error Code | Meaning |
|---|---|
| 400 | Bad Request -- Your request is invalid. |
| 401 | Unauthorized -- Your API key is wrong. |
| 403 | Forbidden |
| 404 | Not Found |
| 405 | Method Not Allowed |
| 500 | Internal Server Error -- We had a problem with our server. Try again later. |
| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |