Create API Key
curl --request POST \
--url https://api.dispersed.com/v1/api-keys \
--header 'Content-Type: application/json' \
--data '
{
"name": "My API Key",
"permissions": [
"nodes.read.own",
"nodes.update.own",
"jobs.read.own",
"job_runs.read.own",
"job_runs.update.own"
],
"allowed_ips": [
"127.0.0.1",
"192.168.1.1/24"
],
"expires_at": "2023-01-01T00:00:00Z"
}
'import requests
url = "https://api.dispersed.com/v1/api-keys"
payload = {
"name": "My API Key",
"permissions": ["nodes.read.own", "nodes.update.own", "jobs.read.own", "job_runs.read.own", "job_runs.update.own"],
"allowed_ips": ["127.0.0.1", "192.168.1.1/24"],
"expires_at": "2023-01-01T00:00:00Z"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'My API Key',
permissions: [
'nodes.read.own',
'nodes.update.own',
'jobs.read.own',
'job_runs.read.own',
'job_runs.update.own'
],
allowed_ips: ['127.0.0.1', '192.168.1.1/24'],
expires_at: '2023-01-01T00:00:00Z'
})
};
fetch('https://api.dispersed.com/v1/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://api.dispersed.com/v1/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' => 'My API Key',
'permissions' => [
'nodes.read.own',
'nodes.update.own',
'jobs.read.own',
'job_runs.read.own',
'job_runs.update.own'
],
'allowed_ips' => [
'127.0.0.1',
'192.168.1.1/24'
],
'expires_at' => '2023-01-01T00:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.dispersed.com/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"My API Key\",\n \"permissions\": [\n \"nodes.read.own\",\n \"nodes.update.own\",\n \"jobs.read.own\",\n \"job_runs.read.own\",\n \"job_runs.update.own\"\n ],\n \"allowed_ips\": [\n \"127.0.0.1\",\n \"192.168.1.1/24\"\n ],\n \"expires_at\": \"2023-01-01T00:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.dispersed.com/v1/api-keys")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My API Key\",\n \"permissions\": [\n \"nodes.read.own\",\n \"nodes.update.own\",\n \"jobs.read.own\",\n \"job_runs.read.own\",\n \"job_runs.update.own\"\n ],\n \"allowed_ips\": [\n \"127.0.0.1\",\n \"192.168.1.1/24\"\n ],\n \"expires_at\": \"2023-01-01T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dispersed.com/v1/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My API Key\",\n \"permissions\": [\n \"nodes.read.own\",\n \"nodes.update.own\",\n \"jobs.read.own\",\n \"job_runs.read.own\",\n \"job_runs.update.own\"\n ],\n \"allowed_ips\": [\n \"127.0.0.1\",\n \"192.168.1.1/24\"\n ],\n \"expires_at\": \"2023-01-01T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"is_revoked": true,
"name": "<string>",
"object": "api_key",
"permissions": [
"<string>"
],
"public_key": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"secret_key": "<string>",
"_id": "<string>",
"account": "<string>",
"account_uuid": "<string>",
"allowed_ips": [
"127.0.0.1",
"192.168.1.1/24"
],
"deleted_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"uuid": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}API Keys
Create API Key
POST
/
v1
/
api-keys
Create API Key
curl --request POST \
--url https://api.dispersed.com/v1/api-keys \
--header 'Content-Type: application/json' \
--data '
{
"name": "My API Key",
"permissions": [
"nodes.read.own",
"nodes.update.own",
"jobs.read.own",
"job_runs.read.own",
"job_runs.update.own"
],
"allowed_ips": [
"127.0.0.1",
"192.168.1.1/24"
],
"expires_at": "2023-01-01T00:00:00Z"
}
'import requests
url = "https://api.dispersed.com/v1/api-keys"
payload = {
"name": "My API Key",
"permissions": ["nodes.read.own", "nodes.update.own", "jobs.read.own", "job_runs.read.own", "job_runs.update.own"],
"allowed_ips": ["127.0.0.1", "192.168.1.1/24"],
"expires_at": "2023-01-01T00:00:00Z"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'My API Key',
permissions: [
'nodes.read.own',
'nodes.update.own',
'jobs.read.own',
'job_runs.read.own',
'job_runs.update.own'
],
allowed_ips: ['127.0.0.1', '192.168.1.1/24'],
expires_at: '2023-01-01T00:00:00Z'
})
};
fetch('https://api.dispersed.com/v1/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://api.dispersed.com/v1/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' => 'My API Key',
'permissions' => [
'nodes.read.own',
'nodes.update.own',
'jobs.read.own',
'job_runs.read.own',
'job_runs.update.own'
],
'allowed_ips' => [
'127.0.0.1',
'192.168.1.1/24'
],
'expires_at' => '2023-01-01T00:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.dispersed.com/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"My API Key\",\n \"permissions\": [\n \"nodes.read.own\",\n \"nodes.update.own\",\n \"jobs.read.own\",\n \"job_runs.read.own\",\n \"job_runs.update.own\"\n ],\n \"allowed_ips\": [\n \"127.0.0.1\",\n \"192.168.1.1/24\"\n ],\n \"expires_at\": \"2023-01-01T00:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.dispersed.com/v1/api-keys")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My API Key\",\n \"permissions\": [\n \"nodes.read.own\",\n \"nodes.update.own\",\n \"jobs.read.own\",\n \"job_runs.read.own\",\n \"job_runs.update.own\"\n ],\n \"allowed_ips\": [\n \"127.0.0.1\",\n \"192.168.1.1/24\"\n ],\n \"expires_at\": \"2023-01-01T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dispersed.com/v1/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My API Key\",\n \"permissions\": [\n \"nodes.read.own\",\n \"nodes.update.own\",\n \"jobs.read.own\",\n \"job_runs.read.own\",\n \"job_runs.update.own\"\n ],\n \"allowed_ips\": [\n \"127.0.0.1\",\n \"192.168.1.1/24\"\n ],\n \"expires_at\": \"2023-01-01T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"is_revoked": true,
"name": "<string>",
"object": "api_key",
"permissions": [
"<string>"
],
"public_key": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"secret_key": "<string>",
"_id": "<string>",
"account": "<string>",
"account_uuid": "<string>",
"allowed_ips": [
"127.0.0.1",
"192.168.1.1/24"
],
"deleted_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"uuid": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"timestamp": "<string>",
"details": []
}
}Body
application/json
Name of the API key
Minimum string length:
1Example:
"My API Key"
List of permissions for the API key
Minimum array length:
1Example:
[
"nodes.read.own",
"nodes.update.own",
"jobs.read.own",
"job_runs.read.own",
"job_runs.update.own"
]
OPTIONAL: List of allowed IP addresses or CIDR ranges. If no IPs are provided, the API key can be used from any IP address.
Example:
["127.0.0.1", "192.168.1.1/24"]
Date and time when the API key should expire. If not provided, the API key will never expire.
Example:
"2023-01-01T00:00:00Z"
Response
API key created successfully
Available options:
api_key OPTIONAL: List of allowed IP addresses or CIDR ranges. If no IPs are provided, the API key can be used from any IP address.
Example:
["127.0.0.1", "192.168.1.1/24"]
⌘I