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

# create

POST https://api.groundx.ai/api/v1/bucket
Content-Type: application/json

Create a new bucket.


Reference: https://docs.eyelevel.ai/reference/api-reference/buckets/create

## Authentication

- `X-API-Key` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects a BucketCreateRequest.

- `name` (string, required)
- `fileAccess` (FileAccessPolicy, optional, nullable) — Initial settings for this resource. Omit or send null to inherit. Explicit settings take priority over the same account or bucket settings; omitted fields use broader values. Use private staging before uploading a protected file, even in a public bucket. Returns 403 if file access is disabled.

## Response

### 200

Bucket successfully created

- `bucket` (BucketDetail, required)

## Errors

### 400 Bad Request Error

Invalid body parameter

- `any`

### 403 Forbidden Error

File access is disabled or the request is forbidden

- `any`

### 404 Not Found Error

Owned resource not found

- `any`

### 503 Service Unavailable Error

File access is enabled but temporarily unavailable. Retry after the delay in Retry-After.

- `any`

## Types

### FileAccessPolicy

For each field, document settings take priority over bucket settings, then account settings. Omitted fields use the broader value. Explicit public mode and longer sharing lifetimes are allowed. Stable public links never expire. urlTtlSeconds limits new sharing links; an issued link works without API credentials until its storage expiry.

- `mode` (enum, optional)
  - Allowed values: `public`, `protected`
- `urlTtlSeconds` (integer, optional)

### BucketDetail

- `bucketId` (integer, required)
- `fileAccess` (FileAccessPolicy, optional, nullable) — Applied settings for this resource. Null means it inherits settings. Deployments without file access omit this field. Pending changes are not returned.
- `effectiveFileAccess` (EffectivePolicy, optional) — Applied settings after inheritance. Sharing links expire after 300 seconds by default; storage credentials may shorten that time. Protected stable URLs require current authentication on every read.
- `created` (string, optional) — The data time when the bucket was created, in RFC3339 format
- `fileCount` (integer, optional) — The number of files contained in the content bucket
- `fileSize` (string, optional) — The total file size of files contained in the content bucket
- `name` (string, optional)
- `updated` (string, optional) — The data time when the bucket was last updated, in RFC3339 format
- `fileAccessRevision` (integer, optional, deprecated) — Legacy compatibility field. Not required or checked when changing file access.

### EffectivePolicy

Applied settings after inheritance. Sharing links expire after 300 seconds by default; storage credentials may shorten that time. Protected stable URLs require current authentication on every read.

- `mode` (enum, required)
  - Allowed values: `public`, `protected`
- `urlTtlSeconds` (integer, required)

## Examples

**Request**

```json
{
  "name": "private-documents",
  "fileAccess": {
    "mode": "protected",
    "urlTtlSeconds": 300
  }
}
```

**Response**

```json
{
  "bucket": {
    "bucketId": 1234,
    "name": "private-documents"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.groundx.ai/api/v1/bucket"

payload = {
    "name": "private-documents",
    "fileAccess": {
        "mode": "protected",
        "urlTtlSeconds": 300
    }
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.groundx.ai/api/v1/bucket';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"private-documents","fileAccess":{"mode":"protected","urlTtlSeconds":300}}'
};

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://api.groundx.ai/api/v1/bucket"

	payload := strings.NewReader("{\n  \"name\": \"private-documents\",\n  \"fileAccess\": {\n    \"mode\": \"protected\",\n    \"urlTtlSeconds\": 300\n  }\n}")

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

	req.Header.Add("X-API-Key", "<apiKey>")
	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://api.groundx.ai/api/v1/bucket")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"private-documents\",\n  \"fileAccess\": {\n    \"mode\": \"protected\",\n    \"urlTtlSeconds\": 300\n  }\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://api.groundx.ai/api/v1/bucket")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"private-documents\",\n  \"fileAccess\": {\n    \"mode\": \"protected\",\n    \"urlTtlSeconds\": 300\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.groundx.ai/api/v1/bucket', [
  'body' => '{
  "name": "private-documents",
  "fileAccess": {
    "mode": "protected",
    "urlTtlSeconds": 300
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.groundx.ai/api/v1/bucket");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"private-documents\",\n  \"fileAccess\": {\n    \"mode\": \"protected\",\n    \"urlTtlSeconds\": 300\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "private-documents",
  "fileAccess": [
    "mode": "protected",
    "urlTtlSeconds": 300
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.groundx.ai/api/v1/bucket")! 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()
```