Issue an API key
curl --request POST \
--url https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "Dealer CRM",
"scopes": [
"salesbot:contacts:read",
"salesbot:contacts:write"
],
"expires_at": null
}
'import requests
url = "https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys"
payload = {
"name": "Dealer CRM",
"scopes": ["salesbot:contacts:read", "salesbot:contacts:write"],
"expires_at": None
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Dealer CRM',
scopes: ['salesbot:contacts:read', 'salesbot:contacts:write'],
expires_at: null
})
};
fetch('https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Dealer CRM',
'scopes' => [
'salesbot:contacts:read',
'salesbot:contacts:write'
],
'expires_at' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys"
payload := strings.NewReader("{\n \"name\": \"Dealer CRM\",\n \"scopes\": [\n \"salesbot:contacts:read\",\n \"salesbot:contacts:write\"\n ],\n \"expires_at\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Dealer CRM\",\n \"scopes\": [\n \"salesbot:contacts:read\",\n \"salesbot:contacts:write\"\n ],\n \"expires_at\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Dealer CRM\",\n \"scopes\": [\n \"salesbot:contacts:read\",\n \"salesbot:contacts:write\"\n ],\n \"expires_at\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "API key created. The token is shown once and cannot be retrieved again.",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Dealer CRM",
"prefix": "<string>",
"scopes": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"last_used_at": {
"publishing": "2023-11-07T05:31:56Z",
"salesbot": "2023-11-07T05:31:56Z",
"biolinks": "2023-11-07T05:31:56Z"
},
"plain_text_token": "osk_…"
}
}{
"success": false,
"message": "Invalid or inactive API key."
}{
"success": false,
"message": "<string>",
"error_code": "<string>"
}{
"success": false,
"message": "Validation failed.",
"errors": {}
}Workspace API keys
Issue an API key
Creates an osk_ key for the workspace. plain_text_token is returned once and cannot be retrieved again. A permission the workspace cannot have is a 422. At most 25 live keys per workspace, shared with the dashboard.
POST
/
partner
/
workspaces
/
{workspace}
/
api-keys
Issue an API key
curl --request POST \
--url https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "Dealer CRM",
"scopes": [
"salesbot:contacts:read",
"salesbot:contacts:write"
],
"expires_at": null
}
'import requests
url = "https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys"
payload = {
"name": "Dealer CRM",
"scopes": ["salesbot:contacts:read", "salesbot:contacts:write"],
"expires_at": None
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Dealer CRM',
scopes: ['salesbot:contacts:read', 'salesbot:contacts:write'],
expires_at: null
})
};
fetch('https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Dealer CRM',
'scopes' => [
'salesbot:contacts:read',
'salesbot:contacts:write'
],
'expires_at' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys"
payload := strings.NewReader("{\n \"name\": \"Dealer CRM\",\n \"scopes\": [\n \"salesbot:contacts:read\",\n \"salesbot:contacts:write\"\n ],\n \"expires_at\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Dealer CRM\",\n \"scopes\": [\n \"salesbot:contacts:read\",\n \"salesbot:contacts:write\"\n ],\n \"expires_at\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onlysocial.io/api/partner/workspaces/{workspace}/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Dealer CRM\",\n \"scopes\": [\n \"salesbot:contacts:read\",\n \"salesbot:contacts:write\"\n ],\n \"expires_at\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "API key created. The token is shown once and cannot be retrieved again.",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Dealer CRM",
"prefix": "<string>",
"scopes": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"last_used_at": {
"publishing": "2023-11-07T05:31:56Z",
"salesbot": "2023-11-07T05:31:56Z",
"biolinks": "2023-11-07T05:31:56Z"
},
"plain_text_token": "osk_…"
}
}{
"success": false,
"message": "Invalid or inactive API key."
}{
"success": false,
"message": "<string>",
"error_code": "<string>"
}{
"success": false,
"message": "Validation failed.",
"errors": {}
}Authorizations
Your partner API key, pk_…. Backend only.
Path Parameters
A workspace uuid from provisioning. It must be administered by a customer you provisioned.
Body
application/json
Maximum string length:
80Example:
"Dealer CRM"
Permissions, as in the dashboard.
Minimum array length:
1Example:
[
"salesbot:contacts:read",
"salesbot:contacts:write"
]
A future time, or null for no expiry.
Example:
null
