> ## Documentation Index
> Fetch the complete documentation index at: https://docs.basaltic.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a repository

> Choose a repository name, tag mutability, deletion protection, and resource tags.

Create a repository in your selected account and region. Repository names may
include a namespace such as `team/api`. Set `tag_mutability` to `immutable` when
a tag must never be replaced, and enable `deletion_protection` for repositories
that should survive accidental deletion.

<Tabs>
  <Tab title="Console">
    1. Open [Repositories](https://console.basaltic.sh/registry/repositories) in the selected account and region.
    2. Select **Create repository** to open the creation page and enter a **Name**, such as `team/api`.
    3. Enable **Immutable tags** to keep existing tags from moving.
    4. Enable **Deletion protection** if the repository should survive accidental deletion.
    5. Select **Create repository** and use its returned URI when pushing images.
  </Tab>

  <Tab title="API">
    ```bash theme={null}
    curl --fail-with-body --request POST \
      https://registry.sa-saopaulo-1.basaltic.sh/v1/repositories \
      --header "Authorization: Bearer $TOKEN" \
      --header "X-Account-Id: $ACCOUNT" \
      --header 'Content-Type: application/json' \
      --data '{"name":"team/api","tag_mutability":"immutable","deletion_protection":true}'
    ```
  </Tab>

  <Tab title="CLI">
    Save the JSON request from the API tab as `request-1.json`. Use your configured account and region.

    ```bash theme={null}
    basaltic registry repository create --from-file request-1.json
    ```
  </Tab>

  <Tab title="Go">
    Save the JSON request from the API tab as `request-1.json`. Configure credentials, account, and region through the SDK environment variables.

    ```go theme={null}
    package main

    import (
    	"context"
    	"encoding/json"
    	"fmt"
    	"os"

    	basaltic "github.com/basaltic-sh/sdk-go"
    	"github.com/basaltic-sh/sdk-go/registry"
    )

    func readJSON(path string, value any) error {
    	data, err := os.ReadFile(path)
    	if err != nil {
    		return err
    	}
    	return json.Unmarshal(data, value)
    }

    func run() error {
    	ctx := context.Background()
    	cfg, err := basaltic.NewConfig(ctx)
    	if err != nil {
    		return err
    	}
    	client := registry.New(cfg)
    	var request1 registry.CreateRepositoryRequest
    	if err := readJSON("request-1.json", &request1); err != nil {
    		return err
    	}
    	result1, err := client.CreateRepository(ctx, &request1)
    	if err != nil {
    		return err
    	}
    	fmt.Printf("%+v\n", result1)
    	return nil
    }

    func main() {
    	if err := run(); err != nil {
    		fmt.Fprintln(os.Stderr, err)
    		os.Exit(1)
    	}
    }
    ```
  </Tab>
</Tabs>

The response contains `repository.id` for management calls and `repository.uri`
for image references. Grant the build identity the push actions and grant
runtime identities only the pull actions from [Permissions](/registry/permissions).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.