> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.kuudo.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.kuudo.com/_mcp/server.

# Create storage resource

POST https://app.kuudo.com/api/storage
Content-Type: application/json

Registered storage returns 201 with resource. Managed S3 Files returns 202 with storageId/status. Subject to rollout and provider prerequisites.

Requires every scope: `storage:write`.

Reference: https://docs.kuudo.com/api-reference/storage/create-storage-resource

## Authentication

- `Authorization` header (bearer token, required) — JWT returned by POST /api/auth/token-exchange. Amazon, authorization invitations, and developer credentials require API-key-derived tokens.

## Request

### Body (application/json)

This endpoint expects a Storage_createStorageResource_Request.

- `Storage_createStorageResource_Request`
  - RegisteredStorageCreate: RegisteredStorageCreate
  - ManagedStorageCreate: ManagedStorageCreate

## Response

### 201

Success

- `resource` (StorageResource, required) — Storage resource. Managed status can also be supplied beside the resource. Mode in persisted resource data can differ from the request label.

### 202

Managed provisioning queued.

- `storageId` (integer, required)
- `status` (string, required)

## Errors

### 400 Bad Request Error

Invalid request or unsupported resource state.

- `error` (ErrorError, required)
- `code` (string, optional)
- `details` (any, optional) — Endpoint-specific validation or failure details; shape varies.
- `requiredScopes` (list of string, optional)
- `errorCode` (string, optional)
- `message` (string, optional)
- `remediation` (string, optional)

### 401 Unauthorized Error

Missing or invalid credentials, or inactive machine principal.

- `error` (ErrorError, required)
- `code` (string, optional)
- `details` (any, optional) — Endpoint-specific validation or failure details; shape varies.
- `requiredScopes` (list of string, optional)
- `errorCode` (string, optional)
- `message` (string, optional)
- `remediation` (string, optional)

### 403 Forbidden Error

Insufficient scope, authorization policy, or entitlement.

- `error` (ErrorError, required)
- `code` (string, optional)
- `details` (any, optional) — Endpoint-specific validation or failure details; shape varies.
- `requiredScopes` (list of string, optional)
- `errorCode` (string, optional)
- `message` (string, optional)
- `remediation` (string, optional)

### 409 Conflict Error

Conflicting state, duplicate resource, or idempotency conflict.

- `error` (ErrorError, required)
- `code` (string, optional)
- `details` (any, optional) — Endpoint-specific validation or failure details; shape varies.
- `requiredScopes` (list of string, optional)
- `errorCode` (string, optional)
- `message` (string, optional)
- `remediation` (string, optional)

### 422 Unprocessable Entity Error

Provider or organization availability/prerequisite failed.

- `error` (ErrorError, required)
- `code` (string, optional)
- `details` (any, optional) — Endpoint-specific validation or failure details; shape varies.
- `requiredScopes` (list of string, optional)
- `errorCode` (string, optional)
- `message` (string, optional)
- `remediation` (string, optional)

### 500 Internal Server Error

Internal error.

- `error` (ErrorError, required)
- `code` (string, optional)
- `details` (any, optional) — Endpoint-specific validation or failure details; shape varies.
- `requiredScopes` (list of string, optional)
- `errorCode` (string, optional)
- `message` (string, optional)
- `remediation` (string, optional)

### 503 Service Unavailable Error

Dependency unavailable or application maintenance.

- `error` (ErrorError, required)
- `code` (string, optional)
- `details` (any, optional) — Endpoint-specific validation or failure details; shape varies.
- `requiredScopes` (list of string, optional)
- `errorCode` (string, optional)
- `message` (string, optional)
- `remediation` (string, optional)

## Types

### RegisteredStorageCreate

Registered storage requires credentials except s3-files. s3 is normalized to s3-object. S3 Files requires the listed filesystem/access point and role metadata and an enabled organization.

- `environmentId` (integer, required)
- `name` (string, required)
- `bucketName` (string, required)
- `storageProvider` (enum, required)
  - Allowed values: `r2`, `s3`, `s3-object`, `s3-files`, `gcs`
- `mode` (enum, optional, default: registered)
  - Allowed values: `created`, `registered`
- `credentials` (StorageCredentials, optional)
- `endpointUrl` (string, optional)
- `providerMetadata` (map from string to any, optional) — For s3-files, supply S3FilesMetadata role-based fields and omit static credentials.

### ManagedStorageCreate

Managed S3 Files provisioning is asynchronous and subject to provider and organization availability.

- `mode` (enum, required)
  - Allowed values: `managed`
- `storageProvider` (enum, required)
  - Allowed values: `s3-files`
- `environmentId` (integer, required)
- `name` (string, required)
- `bucketSuffix` (string, required)

### StorageResource

Storage resource. Managed status can also be supplied beside the resource. Mode in persisted resource data can differ from the request label.

- `id` (integer, required)
- `environmentId` (integer, required)
- `name` (string, required)
- `bucketName` (string, required)
- `storageProvider` (enum, required)
  - Allowed values: `r2`, `s3-object`, `s3-files`, `gcs`
- `organizationId` (string, optional)
- `mode` (string, optional)
- `status` (string, optional)
- `endpointUrl` (string, optional, nullable)
- `providerMetadata` (map from string to any, optional)
- `createdAt` (datetime, optional, nullable)

### ErrorError

- string
- ErrorError1

### StorageCredentials

- `accessKeyId` (string, required)
- `secretAccessKey` (string, required)

### ErrorError1

- `code` (string, required)
- `message` (string, required)

## Examples

### Example 1

**Request**

```json
{
  "bucketName": "string",
  "environmentId": 1,
  "name": "string",
  "storageProvider": "r2"
}
```

**Response**

```json
{
  "resource": {
    "id": 1,
    "environmentId": 1,
    "name": "string",
    "bucketName": "string",
    "storageProvider": "r2",
    "organizationId": "string",
    "mode": "string",
    "status": "string",
    "endpointUrl": "string",
    "providerMetadata": {},
    "createdAt": "2024-01-15T09:30:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://app.kuudo.com/api/storage"

payload = {
    "bucketName": "string",
    "environmentId": 1,
    "name": "string",
    "storageProvider": "r2"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://app.kuudo.com/api/storage';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"bucketName":"string","environmentId":1,"name":"string","storageProvider":"r2"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.kuudo.com/api/storage"

	payload := strings.NewReader("{\n  \"bucketName\": \"string\",\n  \"environmentId\": 1,\n  \"name\": \"string\",\n  \"storageProvider\": \"r2\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.kuudo.com/api/storage")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"bucketName\": \"string\",\n  \"environmentId\": 1,\n  \"name\": \"string\",\n  \"storageProvider\": \"r2\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.kuudo.com/api/storage")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"bucketName\": \"string\",\n  \"environmentId\": 1,\n  \"name\": \"string\",\n  \"storageProvider\": \"r2\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.kuudo.com/api/storage', [
  'body' => '{
  "bucketName": "string",
  "environmentId": 1,
  "name": "string",
  "storageProvider": "r2"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.kuudo.com/api/storage");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"bucketName\": \"string\",\n  \"environmentId\": 1,\n  \"name\": \"string\",\n  \"storageProvider\": \"r2\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "bucketName": "string",
  "environmentId": 1,
  "name": "string",
  "storageProvider": "r2"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.kuudo.com/api/storage")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Example 2

**Request**

```json
{
  "bucketName": "string",
  "environmentId": 1,
  "name": "string",
  "storageProvider": "r2"
}
```

**Response**

```json
{
  "resource": {
    "id": 1,
    "environmentId": 1,
    "name": "string",
    "bucketName": "string",
    "storageProvider": "r2",
    "organizationId": "string",
    "mode": "string",
    "status": "string",
    "endpointUrl": "string",
    "providerMetadata": {},
    "createdAt": "2024-01-15T09:30:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://app.kuudo.com/api/storage"

payload = {
    "bucketName": "string",
    "environmentId": 1,
    "name": "string",
    "storageProvider": "r2"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://app.kuudo.com/api/storage';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"bucketName":"string","environmentId":1,"name":"string","storageProvider":"r2"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.kuudo.com/api/storage"

	payload := strings.NewReader("{\n  \"bucketName\": \"string\",\n  \"environmentId\": 1,\n  \"name\": \"string\",\n  \"storageProvider\": \"r2\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.kuudo.com/api/storage")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"bucketName\": \"string\",\n  \"environmentId\": 1,\n  \"name\": \"string\",\n  \"storageProvider\": \"r2\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.kuudo.com/api/storage")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"bucketName\": \"string\",\n  \"environmentId\": 1,\n  \"name\": \"string\",\n  \"storageProvider\": \"r2\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.kuudo.com/api/storage', [
  'body' => '{
  "bucketName": "string",
  "environmentId": 1,
  "name": "string",
  "storageProvider": "r2"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.kuudo.com/api/storage");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"bucketName\": \"string\",\n  \"environmentId\": 1,\n  \"name\": \"string\",\n  \"storageProvider\": \"r2\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "bucketName": "string",
  "environmentId": 1,
  "name": "string",
  "storageProvider": "r2"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.kuudo.com/api/storage")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```