# Attach a custom domain to a bucket

```
POST https://mgmt.storage.dev/v1/providers/:provider_id/orgs/:org_id/buckets/:bucket_name/domain
```

Sets a custom domain for a bucket. If the domain is already set, it will be replaced.

**Note**  
The custom domain must have a CNAME record that points to the bucket URL.

##### Example:  
If your bucket is `my-bucket` and you want to use `images.example.com`, create a CNAME record pointing `images.example.com` to `my-bucket.t3.storage.dev`.

After setting the custom domain, objects will be accessible via:

- `https://images.example.com/object.jpg`
- `https://my-bucket.t3.storage.dev/object.jpg` (original URL still works)

## Request

### Path Parameters

**provider_id** string  **required**  
Provider ID

**org_id** string  **required**  
Organization ID

**bucket_name** string  **required**  
Bucket name

- application/json

### Body **required**

**website** object  **required**

**domain_name** string  
Custom domain name for the bucket. Must be a valid fully-qualified domain name (FQDN) and have a CNAME record pointing to the bucket URL.

**Example:** `images.example.com`

```json
{
  "website": {
    "domain_name": "images.example.com"
  }
}
```

## Responses

- **200**
    
    OK
    
- application/json

**Schema**

**object** object

```json
{}
```

Unexpected error

- application/json

**Schema**

**message** string

```json
{
  "message": "string"
}
```

#### Authorization: X-Tigris-Signature

````
name: X-Tigris-Signature  
type: apiKey  
in: header  
description: HMAC-SHA256 of the canonical request signed using the signing key.  
To create the signature, concatenate the HTTP method, URL, timestamp, and nonce with a newline character in between.  
Then, calculate the HMAC-SHA256 of the concatenated string using the signing key. Example:

Create the `canonical_request` as:
```
POST
https://mgmt.storage.dev/provider/your-provider-id/orgs/user-org-id/provision
1731703213870
f8d133cb-5a42-47b1-9ef2-874bb55bab72
```
Then, calculate HMAC-SHA256 of the canonical request using the signing key as:
```
Signature = hex(sha256sign(canonical_request, "signing_key"))
```
````

```
name: X-Tigris-Nonce  
type: apiKey  
in: header  
description: Random unique string to identify the request and prevent replay attacks. Example: "f8d133cb-5a42-47b1-9ef2-874bb55bab72"
```

```
name: X-Tigris-Time  
type: apiKey  
in: header  
description: Unix timestamp in milliseconds of the request. Example: 1731703213870
```

### Example Code

```csharp
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://mgmt.storage.dev/v1/providers/:provider_id/orgs/:org_id/buckets/:bucket_name/domain");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("X-Tigris-Signature", "<X-Tigris-Signature>");
request.Headers.Add("X-Tigris-Nonce", "<X-Tigris-Nonce>");
request.Headers.Add("X-Tigris-Time", "<X-Tigris-Time>");
var content = new StringContent("{\n  \"website\": {\n    \"domain_name\": \"images.example.com\"\n  }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

**Base URL**  
https://mgmt.storage.dev  
**Auth**  
Signature  
Nonce  
Timestamp  
**Parameters**  
provider_id — path **required**  
org_id — path **required**  
bucket_name — path **required**  
**Body**  **required**  
```json
{
  "website": {
    "domain_name": "images.example.com"
  }
}
```
