> ## 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.

# Criar um repositório

> Escolha nome, mutabilidade das tags, proteção contra exclusão e tags de recurso.

Crie um repositório na conta e região selecionadas. Nomes podem incluir um namespace, como `team/api`. Defina `tag_mutability` como `immutable` quando uma tag não puder ser substituída e ative `deletion_protection` para evitar exclusões acidentais.

<Tabs>
  <Tab title="Console">
    1. Abra [Repositórios](https://console.basaltic.sh/registry/repositories) na conta e região selecionadas.
    2. Selecione **Create repository** para abrir o formulário e informe um **Name**, como `team/api`.
    3. Ative **Immutable tags** para impedir mudanças em tags existentes.
    4. Ative **Deletion protection** para proteger contra exclusões acidentais.
    5. Selecione **Create repository** e use a URI retornada ao enviar imagens.
  </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">
    Salve a solicitação JSON da aba API como `request-1.json`. Use sua conta e região configuradas.

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

  <Tab title="Go">
    Salve a solicitação JSON da aba API como `request-1.json`. Configure credenciais, conta e região pelas variáveis de ambiente do SDK.

    ```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>

A resposta contém `repository.id` para gerenciamento e `repository.uri` para referências de imagem. Conceda ações de push à identidade de build e somente ações de pull às identidades de execução, conforme [Permissões](/pt/registry/permissions).


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