Skip to main content
POST
/
api
/
disks
Create a new disk
curl --request POST \
  --url https://control.green.us-east-1.aws.prod.archil.com/api/disks \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "my-data-disk",
  "mounts": [
    {
      "type": "s3",
      "bucketName": "my-bucket",
      "accessKeyId": "<string>",
      "secretAccessKey": "<string>",
      "sessionToken": "<string>",
      "bucketPrefix": "data/"
    }
  ],
  "authMethods": [
    {
      "type": "token",
      "nickname": "<string>",
      "principal": "<string>",
      "tokenSuffix": "<string>"
    }
  ]
}
'
import requests

url = "https://control.green.us-east-1.aws.prod.archil.com/api/disks"

payload = {
"name": "my-data-disk",
"mounts": [
{
"type": "s3",
"bucketName": "my-bucket",
"accessKeyId": "<string>",
"secretAccessKey": "<string>",
"sessionToken": "<string>",
"bucketPrefix": "data/"
}
],
"authMethods": [
{
"type": "token",
"nickname": "<string>",
"principal": "<string>",
"tokenSuffix": "<string>"
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my-data-disk',
mounts: [
{
type: 's3',
bucketName: 'my-bucket',
accessKeyId: '<string>',
secretAccessKey: '<string>',
sessionToken: '<string>',
bucketPrefix: 'data/'
}
],
authMethods: [
{
type: 'token',
nickname: '<string>',
principal: '<string>',
tokenSuffix: '<string>'
}
]
})
};

fetch('https://control.green.us-east-1.aws.prod.archil.com/api/disks', 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://control.green.us-east-1.aws.prod.archil.com/api/disks",
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-data-disk',
'mounts' => [
[
'type' => 's3',
'bucketName' => 'my-bucket',
'accessKeyId' => '<string>',
'secretAccessKey' => '<string>',
'sessionToken' => '<string>',
'bucketPrefix' => 'data/'
]
],
'authMethods' => [
[
'type' => 'token',
'nickname' => '<string>',
'principal' => '<string>',
'tokenSuffix' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://control.green.us-east-1.aws.prod.archil.com/api/disks"

payload := strings.NewReader("{\n \"name\": \"my-data-disk\",\n \"mounts\": [\n {\n \"type\": \"s3\",\n \"bucketName\": \"my-bucket\",\n \"accessKeyId\": \"<string>\",\n \"secretAccessKey\": \"<string>\",\n \"sessionToken\": \"<string>\",\n \"bucketPrefix\": \"data/\"\n }\n ],\n \"authMethods\": [\n {\n \"type\": \"token\",\n \"nickname\": \"<string>\",\n \"principal\": \"<string>\",\n \"tokenSuffix\": \"<string>\"\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<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://control.green.us-east-1.aws.prod.archil.com/api/disks")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-data-disk\",\n \"mounts\": [\n {\n \"type\": \"s3\",\n \"bucketName\": \"my-bucket\",\n \"accessKeyId\": \"<string>\",\n \"secretAccessKey\": \"<string>\",\n \"sessionToken\": \"<string>\",\n \"bucketPrefix\": \"data/\"\n }\n ],\n \"authMethods\": [\n {\n \"type\": \"token\",\n \"nickname\": \"<string>\",\n \"principal\": \"<string>\",\n \"tokenSuffix\": \"<string>\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://control.green.us-east-1.aws.prod.archil.com/api/disks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my-data-disk\",\n \"mounts\": [\n {\n \"type\": \"s3\",\n \"bucketName\": \"my-bucket\",\n \"accessKeyId\": \"<string>\",\n \"secretAccessKey\": \"<string>\",\n \"sessionToken\": \"<string>\",\n \"bucketPrefix\": \"data/\"\n }\n ],\n \"authMethods\": [\n {\n \"type\": \"token\",\n \"nickname\": \"<string>\",\n \"principal\": \"<string>\",\n \"tokenSuffix\": \"<string>\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "diskId": "dsk-0123456789abcdef",
    "authorizedUsers": [
      {
        "principal": "<string>",
        "nickname": "<string>",
        "tokenSuffix": "<string>",
        "token": "<string>",
        "identifier": "<string>",
        "createdAt": "2023-11-07T05:31:56Z"
      }
    ]
  }
}
{
"success": true,
"data": {
"diskId": "dsk-0123456789abcdef",
"authorizedUsers": [
{
"principal": "<string>",
"nickname": "<string>",
"tokenSuffix": "<string>",
"token": "<string>",
"identifier": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
]
}
}
{
"success": false,
"error": "Invalid request parameters"
}
{
"success": false,
"error": "Invalid request parameters"
}
{
"success": false,
"error": "Invalid request parameters"
}
{
"success": false,
"error": "Invalid request parameters"
}
{
"success": false,
"error": "Invalid request parameters"
}

Authorizations

Authorization
string
header
required

API key

Body

application/json
name
string
required

Disk name (alphanumeric, dashes, underscores)

Required string length: 1 - 100
Pattern: ^[a-zA-Z0-9_-]+$
Example:

"my-data-disk"

mounts
(S3 · object | Google Cloud Storage · object | Cloudflare R2 · object | S3-Compatible · object | Azure Blob Storage · object)[]

Storage mount to attach. Omit for archil-managed storage.

Maximum array length: 1

Mount configuration for Amazon S3 buckets

authMethods
object[]
deprecated

Deprecated. Use AddDiskUser after creation instead. When provided, suppresses the default auto-generated token user.

Response

Disk with this name already exists and configuration matches (idempotent)

success
boolean
required
Example:

true

data
object
required