# createRunEventToken

```graphql
mutation CreateRunEventToken($command: RunsCreateRunEventTokenCommand!) {
  createRunEventToken(command: $command) {
    token
    tokenType
    expiresAt
    runId
    permissions
  }
}
```

Issue a nondelegating event-writer credential for a direct child run.

## Arguments

| Name            | Type                            | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| --------------- | ------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `command`       | RunsCreateRunEventTokenCommand! | Yes      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `command.runId` | ID!                             | Yes      | Nonterminal direct child of the credential-bound run. Requires a runtime credential allowed to delegate under the current execution generation or executor lease. Unrelated runs are hidden as not found (404); a terminal parent or child, stale generation, authentication-parked child, or detached child generation returns 409. The resulting event-writer token is bound to this child run. Modern tokens cannot mint event tokens. Tokens issued under an execution or worker generation retain that generation. For executor-lease-only parent credentials, the lease is checked at issuance; the child token does not retain executorLeaseOwner. Only the retained legacy route preserves nested delegation for delegating generation-bound credentials. It cannot read events, finalize, heartbeat or create children. |

## Variables

```json
{
  "command": {
    "runId": "string"
  }
}
```

## Responses

| Status | Description                                      |
| ------ | ------------------------------------------------ |
| 200    | The RunsEventToken! in data.createRunEventToken. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation CreateRunEventToken($command: RunsCreateRunEventTokenCommand!) {\n  createRunEventToken(command: $command) {\n    token\n    tokenType\n    expiresAt\n    runId\n    permissions\n  }\n}",
  "variables": {
    "command": {
      "runId": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "createRunEventToken": {
      "token": "string",
      "tokenType": "string",
      "expiresAt": "string",
      "runId": "string",
      "permissions": [
        "string"
      ]
    }
  }
}
```
