API Keys

This object represents an API key, it allows you to gain programmatic access to all of Felloh's functions.

The API Key Object

{
"id": "6baa5798-46c7-4701-98a6-c1462f57df0d",
"name": "my_access_key",
"public_key": "22bc9c6eaa2d8aa7ce4a233b0790bc3248fbdab33cb393c7a8gg2b4fd9fcb551",
"secret_key_last_four": "e653",
"created_at": "2022-06-24T09:59:57.891Z",
"user": {
"id": "decc740c-c942-4624-9b5c-b57688a1f356"
}
}

idstring

Unique identifier for the object.

namestring

A human friendly name for the api keys

public_keystring

The public key

secret_key_last_fourstring

The last four digits of the api key

created_atdatetime

The datetime at which the api key object was created within our systems

user.idstring

The user id that all actions of the api key will be linked to


Fetch all

POST/token/keys

import axios from 'axios';
const response = await axios(
{
method: 'post',
url: 'https://api.felloh.com/token/keys',
data: {
organisation: 'X9876',
},
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function getTokenKeys($token) {
$client = new Client();
$response = $client->post('https://api.felloh.com/token/keys', [
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $token,
],
'json' => [
'organisation' => 'X9876',
],
]);
$data = json_decode($response->getBody(), true);
return $data;
}
$token = 'YOUR_TOKEN_HERE'; // Replace with the actual token
$response = getTokenKeys($token);
import requests
import os
def get_token():
url = 'https://api.felloh.com/token'
public_key = os.environ.get('PUBLIC_KEY')
private_key = os.environ.get('PRIVATE_KEY')
payload = {
'public_key': public_key,
'private_key': private_key
}
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status()
token = response.json()['data']
return token
token = get_token()
print(token)
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var token = await GetToken();
Console.WriteLine(token);
}
static async Task<string> GetToken()
{
using (var httpClient = new HttpClient())
{
var url = "https://api.felloh.com/token";
var publicKey = Environment.GetEnvironmentVariable("PUBLIC_KEY");
var privateKey = Environment.GetEnvironmentVariable("PRIVATE_KEY");
var requestData = new
{
public_key = publicKey,
private_key = privateKey
};
var jsonContent = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(requestData), Encoding.UTF8, "application/json");
var response = await httpClient.PostAsync(url, jsonContent);
response.EnsureSuccessStatusCode();
var responseData = await response.Content.ReadAsStringAsync();
var token = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responseData).data;
return token;
}
}
}

RESPONSE

{
"data": [
{
"id": "6baa5798-46c7-4701-98a6-c1462f57df0d",
"name": "my_access_key",
"public_key": "22bc9c6eaa2d8aa7ce4a233b0790bc3248fbdab33cb393c7a8gg2b4fd9fcb551",
"secret_key_last_four": "e653",
"created_at": "2022-06-24T09:59:57.891Z",
"user": {
"id": "decc740c-c942-4624-9b5c-b57688a1f356"
}
}
],
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6",
"count": 1
}
}

This endpoint retrieves all api keys.

HTTP Method

POST

HTTP Endpoint

PRODhttps://api.felloh.com/token/keys

SANDBOXhttps://sandbox.felloh.com/token/keys

Payload

ParameterRequiredTypeDescription
organisationtruestringThe organisation ID that you want to fetch api keys for. You can find the organisation that you have access to by using the List all organisations method.

Response

Returns an array of API Keys Objects


Create one

PUT/token/key

import axios from 'axios';
const response = await axios(
{
method: 'post',
url: 'https://api.felloh.com/token/key',
data: JSON.stringify({
organisation: 'X9876',
name: 'Test Key',
}),
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
}
);
use GuzzleHttp\Client;
function createTokenKey($token) {
$client = new Client();
$response = $client->post('https://api.felloh.com/token/key', [
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $token,
],
'json' => [
'organisation' => 'X9876',
'name' => 'Test Key',
],
]);
$data = json_decode($response->getBody(), true);
return $data;
}
$token = 'YOUR_TOKEN_HERE'; // Replace with the actual token
$response = createTokenKey($token);
import requests
import json
def post_token_key(access_token):
url = 'https://api.felloh.com/token/key'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
data = {
'organisation': 'X9876',
'name': 'Test Key'
}
response = requests.post(url, data=json.dumps(data), headers=headers)
if not response.ok:
raise Exception(f"Failed to post token key. Status code: {response.status_code}")
return response.text
response_data = post_token_key(access_token)
print(f"Response: {response_data}")
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var token = "<YOUR TOKEN HERE>";
var response = await CreateTokenKey(token);
Console.WriteLine(response);
}
static async Task<string> CreateTokenKey(string token)
{
using (var httpClient = new HttpClient())
{
var url = "https://api.felloh.com/token/key";
var requestData = new
{
organisation = "X9876",
name = "Test Key"
};
var jsonContent = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(requestData), Encoding.UTF8, "application/json");
httpClient.DefaultRequestHeaders.Add("Content-Type", "application/json");
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");
var response = await httpClient.PostAsync(url, jsonContent);
response.EnsureSuccessStatusCode();
var responseData = await response.Content.ReadAsStringAsync();
var result = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responseData).data;
return result;
}
}
}

RESPONSE

{
"data": {
"name": "Test Key",
"public_key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXKkK/TIQ9YhoEoGj7rFwrAxYs7A3DBdc",
"secret_key": "5oMfu26n4VorWC3gNgdDXt6uuVONsA+nPBuvtxe4BUAuv38oI21LGCj/ffJmT2Ie+BhYcK3o1AE/0OFaF80yLEnat2xSoioQkb4zBUP1REEYewRN3CauZ989G"
},
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6"
}
}

This endpoint allows you to create a new API key for an organisation

HTTP Method

PUT

HTTP Endpoint

PRODhttps://api.felloh.com/token/key

SANDBOXhttps://sandbox.felloh.com/token/key

Payload

ParameterRequiredTypeDescription
organisationtruestringThe organisation ID that you want to create the api key in.
nametruestringThe human friendly name of the api key

Delete one

PUT/token/key

import axios from 'axios';
const keyToDelete = 'd5f8e8f5-fa6f-4c00-b943-60d1855afe85';
const response = await axios(
{
method: 'delete',
url: 'https://api.felloh.com/token/key/${keyToDelete}',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
}
);
use GuzzleHttp\Client;
function deleteTokenKey($token, $keyToDelete) {
$url = 'https://api.felloh.com/token/key/' . $keyToDelete;
$client = new Client();
$response = $client->delete($url, [
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $token,
],
]);
$data = json_decode($response->getBody(), true);
return $data;
}
$token = 'YOUR_TOKEN_HERE'; // Replace with the actual token
$keyToDelete = 'd5f8e8f5-fa6f-4c00-b943-60d1855afe85'; // Replace with the actual key you want to delete
$response = deleteTokenKey($token, $keyToDelete);
import requests
def delete_token_key(token, key_to_delete):
url = f'https://api.felloh.com/token/key/{key_to_delete}'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {token}'
}
response = requests.delete(url, headers=headers)
response.raise_for_status()
result = response.json()['data']
return result
key_to_delete = 'd5f8e8f5-fa6f-4c00-b943-60d1855afe85'
result = delete_token_key('<YOUR TOKEN HERE>', key_to_delete)
print(result)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var token = "<YOUR TOKEN HERE>";
var keyToDelete = "d5f8e8f5-fa6f-4c00-b943-60d1855afe85";
var response = await DeleteTokenKey(token, keyToDelete);
Console.WriteLine(response);
}
static async Task<string> DeleteTokenKey(string token, string keyToDelete)
{
using (var httpClient = new HttpClient())
{
var url = $"https://api.felloh.com/token/key/{keyToDelete}";
httpClient.DefaultRequestHeaders.Add("Content-Type", "application/json");
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");
var response = await httpClient.DeleteAsync(url);
response.EnsureSuccessStatusCode();
var responseData = await response.Content.ReadAsStringAsync();
var result = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responseData).data;
return result;
}
}
}

RESPONSE

{
"data": {},
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6"
}
}

This endpoint allows you to delete an API key for an organisation

HTTP Method

DELETE

HTTP Endpoint

PRODhttps://api.felloh.com/token/key/<KEY_ID>

SANDBOXhttps://sandbox.felloh.com/token/key/<KEY_ID>

Path parameter

ParameterRequiredTypeDescription
key_idtruestringThe key ID that you wish to delete