---
title: "Creates a component repository"
method: POST
path: "/components"
tags: ["components"]
---

# Creates a component repository

`POST /components`

You need `contracts.repository.edit` permission to access this resource

## Path parameters

- `contract_id` string, required

## Request body

- object
  - `data` object, required
    - `type` 'component', required
    - `attributes` object, required
      - `name` string — Repository name
      - `icon` string — Component icon as base64 string
      - `team_name` string — Developer Team name
      - `access` 'team' | 'tenant' | 'global'
      - `whitelisted_contract_ids` string[] — List of Contracts where this components is available for full Workspaces
      - `docker_repo_name` string — String representing component’s name in docker registry. Available only if team supports docker registry
      - `docker_target_tag` string — String representing component’s tag in docker registry. Available only if team supports docker registry
    - `relationships` object, required
      - `team` object, required
        - `data` object, required
          - `type` 'team', required
          - `id` string, required — Team ID the repository to create for
      - `contract` object, required
        - `data` object, required
          - `type` 'contract', required
          - `id` string, required — Contract ID the repository to create for

## Response `201`

Created

- object
  - `data` object, required
    - `id` string, required
    - `type` 'component', required
    - `links` object, required
      - `self` string, required
    - `attributes` object, required
      - `name` string, required — Repository name
      - `icon` string — Component icon as base64 string
      - `team_name` string — Developer Team name
      - `access` 'team' | 'tenant' | 'global'
      - `whitelisted_contract_ids` string[] — List of Contracts where this components is available for full Workspaces
      - `docker_repo_name` string — String representing component’s name in docker registry. Available only if team supports docker registry
      - `docker_target_tag` string — String representing component’s tag in docker registry. Available only if team supports docker registry
    - `relationships` object, required
      - `versions` object, required
        - `links` object, required
          - `related` string, required
  - `meta` object, required

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden

---

[API](https://skmtc.net/elastic/apis/elastic-io-rest-api-documentation-v2.md) · [All operations](https://skmtc.net/elastic/apis/elastic-io-rest-api-documentation-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/elastic-io-rest-api-documentation-v2/revisions/411f9f98c01e/schema)
