API Reference

Get Storage types

List Storage Types

Retrieves a list of storage types supported by Claid.

GET/v1-beta1/storage/storage-types
Authorization
Response

List of storage types.

Body
dataarray of StorageType
Request
const response = await fetch('/v1-beta1/storage/storage-types', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "data": [
    "web_folder"
  ]
}

Request

GET /v1-beta1/storage/storage-types HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}

Response body

{
  "data": [
    "web_folder",
    "s3",
    "gcs"
  ]
}

Get Connected Storages

List Storages

Retrieves a list of storages connected to your Claid account, as well as their id, name, type, and parameters.

GET/v1-beta1/storage/storages
Authorization
Response

Successful Response

Body
dataData
Request
const response = await fetch('/v1-beta1/storage/storages', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "data": [
    {
      "name": "text",
      "type": "web_folder",
      "parameters": {
        "path": "text",
        "bucket": "text"
      },
      "created_at": "2024-11-21T07:50:49.493Z"
    }
  ]
}

Request

GET /v1-beta1/storage/storages HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}

Response body

{
  "data": [
    {
      "id": 1,
      "name": "s3-playground",
      "type": "s3",
      "parameters": {
        "path": "/input/",
        "bucket": "playground"
      },
      "created_at": "2022-01-10T18:27:16.362118+00:00"
    },
    {
      "id": 2,
      "name": "designer-uploads",
      "type": "gcs",
      "parameters": {
        "path": "",
        "bucket": "image-uploads"
      },
      "created_at": "2022-01-10T18:28:22.100041+00:00"
    }
  ]
}

Create a new Claid Storage

Create Storage

Connects storage to Claid. You can connect your AWS S3 or GCP bucket, or your own web folder.

POST/v1-beta1/storage/storages
Authorization
Body
name*The unique name of storage

The name of storage in Claid. Note: it doesn't have to be the same as a global name of a bucket.

type*StorageType

An enumeration.

web_folders3gcs
parameters*Parameters

Global parameters of storage (as opposed to Claid's internal properties, such as name and type)

Response

Successful Response

Body
datastorage
Request
const response = await fetch('/v1-beta1/storage/storages', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "name": "text",
      "type": "web_folder",
      "parameters": {
        "bucket": "text",
        "credentials": {
          "access_key": "text",
          "secret_access_key": "text"
        }
      }
    }),
});
const data = await response.json();
Response
{
  "data": {
    "name": "text",
    "type": "web_folder",
    "parameters": {
      "path": "text",
      "bucket": "text",
      "credentials": {
        "access_key": "text"
      }
    },
    "created_at": "2024-11-21T07:50:49.493Z"
  }
}

Here is an example of creating AWS storage via API:

Request

POST /v1-beta1/storage/storages
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "name": "s3-playground",
  "type": "s3",
  "parameters": {
    "bucket": "playground",
    "credentials": {
      "access_key": "AKIAXXXXXXX",
      "secret_access_key": "YourSecretAccessKey"
    }
  }
}

Response body

{
  "data": {
    "id": 1,
    "name": "s3-playground",
    "type": "s3",
    "parameters": {
      "path": "",
      "bucket": "playground"
    },
    "created_at": "2022-05-10T10:29:12.754824+00:00"
  }
}

parameters supported by the AWS S3 storage:

ParameterType

name

string

bucket

string

prefix

string

credentials.access_key

string

credentials.secret_access_key

string

parameters supported by the GCS storage: #todo

name

string

bucket

string

prefix

string

credentials.access_key

string

credentials.secret_access_key

string

parameters supported by the Web Folder storage:

name

string

base_url

string

Describe storage by id

Get Storage

Retrieves information about particular storage, including its id, name, type, and parameters.

GET/v1-beta1/storage/storages/{storage_id}
Authorization
Path parameters
storage_id*Storage Id
Response

Successful Response

Body
datastorage
Request
const response = await fetch('/v1-beta1/storage/storages/{storage_id}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "data": {
    "name": "text",
    "type": "web_folder",
    "parameters": {
      "path": "text",
      "bucket": "text",
      "credentials": {
        "access_key": "text"
      }
    },
    "created_at": "2024-11-21T07:50:49.493Z"
  }
}

Request

GET /v1-beta1/storage/storages/1 HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}

Response body

{
  "data": {
    "id": 1,
    "name": "s3-playground",
    "type": "s3",
    "parameters": {
      "path": "",
      "bucket": "playground"
    },
    "created_at": "2022-05-10T10:29:12.754824+00:00"
  }
}

Delete Storage

Disconnects storage from Claid. Note: It doesn't delete your bucket on your cloud platform.

DELETE/v1-beta1/storage/storages/{storage_id}
Authorization
Path parameters
storage_id*Storage Id
Response

Successful Response

Body
dataData
Request
const response = await fetch('/v1-beta1/storage/storages/{storage_id}', {
    method: 'DELETE',
    headers: {},
});
const data = await response.json();
Response
{}

Request

DELETE /v1-beta1/storage/storages/1 HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}

Patch Storage

Changes storage name, type, and/or parameters.

PATCH/v1-beta1/storage/storages/{storage_id}
Authorization
Path parameters
storage_id*Storage Id
Body
nameThe unique name of storage
typeStorageType

An enumeration.

web_folders3gcs
parametersParameters
Response

Successful Response

Body
datastorage
Request
const response = await fetch('/v1-beta1/storage/storages/{storage_id}', {
    method: 'PATCH',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "data": {
    "name": "text",
    "type": "web_folder",
    "parameters": {
      "path": "text",
      "bucket": "text",
      "credentials": {
        "access_key": "text"
      }
    },
    "created_at": "2024-11-21T07:50:49.493Z"
  }
}

Request

PATCH /v1-beta1/storage/storages/1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "name": "s3-playground",
  "type": "s3",
  "parameters": {
    "bucket": "playground",
    "credentials": {
      "access_key": "AKIAXXXXXXX",
      "secret_access_key": "YourSecretAccessKey"
    }
  }
}

Response body

{
  "data": {
    "id": 1,
    "name": "s3-playground",
    "type": "s3",
    "parameters": {
      "path": "",
      "bucket": "playground"
    },
    "created_at": "2022-05-10T10:29:12.754824+00:00"
  }
}

Last updated