# Replace all repository topics

From **GitHub v3 REST API**.

`PUT /repos/{owner}/{repo}/topics`

Replace all repository topics

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

## Request body

- Required: true
### `application/json`

- Type: `object`

```json
{
  "names": [
    "octocat",
    "atom",
    "electron",
    "api"
  ]
}
```

```json
{"properties":{"names":{"description":"An array of topics to add to the repository. Pass one or more topics to _replace_ the set of existing topics. Send an empty array (`[]`) to clear all topics from the repository. **Note:** Topic `names` cannot contain uppercase letters.","items":{"type":"string"},"type":"array"}},"required":["names"],"type":"object"}
```

## Responses

### `200`

Response

### `application/json`

- Type: `object`

A topic aggregates entities that are related to a subject.

```json
{
  "names": [
    "octocat",
    "atom",
    "electron",
    "api"
  ]
}
```

```json
{"description":"A topic aggregates entities that are related to a subject.","properties":{"names":{"items":{"type":"string"},"type":"array"}},"required":["names"],"title":"Topic","type":"object"}
```

### `404`

Resource not found

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `415`

Preview header missing

### `application/json`

- Type: `object`

```json
{"properties":{"documentation_url":{"type":"string"},"message":{"type":"string"}},"required":["message","documentation_url"],"type":"object"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error Simple

```json
{"description":"Validation Error Simple","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"type":"string"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error Simple","type":"object"}
```

## Request examples

### cURL

```shell
curl --request PUT \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/topics \
  --header 'content-type: application/json' \
  --data '{
  "names": [
    "octocat",
    "atom",
    "electron",
    "api"
  ]
}'
```
