Introduction
Welcome to the OutVoice API Documentation. The endpoints outlined here allow you to integrate any CMS into the OutVoice Platform.
Requirements:
- You will need an account on the OutVoice Platform to use this API.
Additional items to consider for any integration are:
Storing user tokens in your database to prevent users from having to login constantly
Javascript for managing transaction input inside your UI
We highly recommend taking a look at one of the plugins/modules we've created for various open source CMS projects to get ideas. You can find them here.
Authentication
The API uses OAuth for authorization. Your application makes a request using an email address and password, and in return receives an access token and a refresh token. Future API requests are made using the access token, and when that expires a new one can be obtained using the refresh token. When the refresh token expires, a new set of tokens must be requested.
Request Access Token
Authentication example code:
curl --location --request POST "https://api.outvoice.com/oauth/token" \
--form "client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
--form "grant_type=password" \
--form "[email protected]" \
--form "password=xxxxxxxxxxx"
var form = new FormData();
form.append("client_id", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
form.append("grant_type", "password");
form.append("username", "[email protected]");
form.append("password", "xxxxxxxxxxx");
var settings = {
"url": "https://api.outvoice.com/oauth/token",
"method": "POST",
"timeout": 0,
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.outvoice.com/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array('client_id' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx','grant_type' => 'password','username' => '[email protected]','password' => 'xxxxxxxxxxx'),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
} ?>
HTTP Request
POST https://api.outvoice.com/oauth/token
Form Data
key | value |
---|---|
client_id | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
grant_type | password |
username | [your email] |
password | [your password] |
This endpoint will return JSON:
{
"token_type": "Bearer",
"expires_in": 3600,
"access_token": "xxxxxx",
"refresh_token": "xxxxxx"
}
Refresh Access Token
Refresh access token example code:
curl --location --request POST "https://api.outvoice.com/oauth/token" \
--form "client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
--form "grant_type=refresh_token" \
--form "refresh_token=xxxxxx"
var form = new FormData();
form.append("client_id", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
form.append("grant_type", "refresh_token");
form.append("refresh_token", "xxxxxx");
var settings = {
"url": "https://api.outvoice.com/oauth/token",
"method": "POST",
"timeout": 0,
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.outvoice.com/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array('client_id' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx','grant_type' => 'refresh_token','refresh_token' => 'xxxxxx'),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
} ?>
HTTP Request
POST https://api.outvoice.com/oauth/token
Form Data
key | value |
---|---|
client_id | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
grant_type | refresh_token |
refresh_token | [your refresh token] |
This endpoint will return JSON:
{
"token_type": "Bearer",
"expires_in": 3600,
"access_token": "xxxxxx",
"refresh_token": "xxxxxx"
}
Authorization Check
Check Status
Status check example code:
curl --location --request GET "https://api.outvoice.com/api/v1.0/auth-check"
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.outvoice.com/api/v1.0/auth-check",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
} ?>
var form = new FormData();
var settings = {
"url": "https://api.outvoice.com/api/v1.0/auth-check",
"method": "GET",
"timeout": 0,
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
HTTP Request
GET https://api.outvoice.com/v1.0/auth-check
Include Authorization Header
Authorization: Bearer [YOUR_ACCESS_TOKEN]
The Authorization Check endpoint returns a user name as a string if logged in.
List Contributors
Retrieve All Contributors
List contributors example code:
curl --location --request GET "https://api.outvoice.com/api/v1.0/list-freelancers"
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.outvoice.com/api/v1.0/list-freelancers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
} ?>
var form = new FormData();
var settings = {
"url": "https://api.outvoice.com/api/v1.0/list-freelancers",
"method": "GET",
"timeout": 0,
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
HTTP Request
GET https://api.outvoice.com/v1.0/list-freelancers
Include Authorization Header
Authorization: Bearer [YOUR_ACCESS_TOKEN]
The list contributors endpoint returns JSON structured like this:
[
{
"1": "Steve Rogers",
"2": "Tony Stark",
"3": "Natasha Romanov"
}
]
Transactions
Create a transaction
Transaction example code:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.outvoice.com/api/v1.0/transaction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"[{\n\"freelancer\":\"[ID]\",\n\"amount\":\"2000\",\n\"currency\":\"USD\",\n\"url\":\"https://outvoice.com/blog/i-made-my-first-transaction\",\n\"title\":\"This is my first Transaction\"\n},\n{\n\t\"freelancer\":\"[ID]\",\n\"amount\":\"3000\",\n\"currency\":\"USD\",\n\"url\":\"https://outvoice.com/blog/i-made-my-second-transaction\",\n\"title\":\"My Second Transaction\"\n}\n]",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
} ?>
curl --location --request POST "https://api.outvoice.com/api/v1.0/transaction" \
--header "Content-Type: application/json" \
--data "[{
\"freelancer\":\"[ID]\",
\"amount\":\"2000\",
\"currency\":\"USD\",
\"url\":\"https://outvoice.com/blog/i-made-my-first-transaction\",
\"title\":\"My First Transaction\"
},
{
\"freelancer\":\"[ID]\",
\"amount\":\"3000\",
\"currency\":\"USD\",
\"url\":\"https://outvoice.com/blog/i-made-my-second-transaction\",
\"title\":\"My Second Transaction\"
}
]"
var settings = {
"url": "https://api.outvoice.com/api/v1.0/transaction",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json"
},
"data": "[{\n\"freelancer\":\"[ID]\",\n\"amount\":\"2000\",\n\"currency\":\"USD\",\n\"url\":\"https://outvoice.com/blog/i-made-my-first-transaction\",\n\"title\":\"This is my first Transaction\"\n},\n{\n\t\"freelancer\":\"[ID]\",\n\"amount\":\"3000\",\n\"currency\":\"USD\",\n\"url\":\"https://outvoice.com/blog/i-made-my-second-transaction\",\n\"title\":\"My Second Transaction\"\n}\n]",
};
$.ajax(settings).done(function (response) {
console.log(response);
});
HTTP Request
POST https://api.outvoice.com/v1.0/transactions
Headers
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Content-Type: application/json
The transaction endpoint returns a string that is suitable for displaying as a user message. Example: "$100 sent to John Smith". If there is an error, the server will return a 400 and a string with an error message.