---
type: api
title: Set runner roles
description: Set runner roles.
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/cloud-enterprise/v3/operation/operation-set-runner-roles
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/cloud-enterprise/v3/operation/operation-set-runner-roles
products:
  - Elastic Cloud Enterprise
---

# Set runner roles

Authentication: required

## Paths

- `PUT` `/platform/infrastructure/runners/{runner_id}/roles`

#### Path parameters

- `runner_id` (string) — required
  The identifier for the runner

## Description

Set runner roles.

## Query string parameters

- `bless` (boolean) — optional
  Assigns the runner to the roles.

## Request body

The roles for the runner that you want to apply.

`application/json`

- `roles` (object[]) — required
  List of roles
  - `role_name` (string) — required
    Name of the role

## Responses

#### `200`

The roles for the {runner_id} specified runner are assigned.

`application/json`

- `roles` (object[])
  List of roles
  - `role_name` (string)
    Name of the role
#### `400`

There was an error while assigning the roles for the {runner_id} specified runner. Try your request again. (code: `runners.runner_set_roles_failed`)

`application/json`

- `errors` (object[])
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` (string[])
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `404`

Unable to find the {runner_id} specified runner. Edit your request, then try again. (code: `runners.runner_not_found`)

`application/json`

- `errors` (object[])
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` (string[])
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

## Code examples

#### curl

```curl
curl -X PUT "${API_URL}/platform/infrastructure/runners/${RUNNER_ID}/roles" \
  -u "${USERNAME}:${PASSWORD}" \
  -H "Content-Type: application/json" \
  -d '{
    "roles": [
      {
        "role_name": "string"
      }
    ]
  }'
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "roles": [
    {
      "role_name": "string"
    }
  ]
}
```

#### 400

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "code": "string",
      "message": "string",
      "fields": [
        "string"
      ]
    }
  ]
}
```

#### 404

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "code": "string",
      "message": "string",
      "fields": [
        "string"
      ]
    }
  ]
}
```

