# at.happyproto.server.stopInstance

> Published by [happyproto.at](https://lexicon.garden/identity/did:plc:mo7vq4jbioxwafy5zkcc3eux)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.server.stopInstance)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.server.stopInstance/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.server.stopInstance/examples)

## Definitions

### `at.happyproto.server.stopInstance`

**Type**: `procedure`

Stop one of the caller's instances, and start a job that follows the stop. Customers only.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `id` | `string` | Yes | The instance's UUID. |
| `idempotencyKey` | `string` | Yes | A UUID the client generates once per intended change and resends on every retry of it, so a retry gets the original reply instead of acting twice. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `jobId` | `string` | Yes | The background job following the change. Poll it with at.happyproto.server.getJob. |

#### Errors

- **AuthRequired**: This endpoint requires an authenticated caller.
- **Forbidden**: The caller is not a HappyProto customer, or the provisioner refused them.
- **InvalidRequest**: id or idempotencyKey is missing or not a UUID.
- **NotFound**: No such instance, or it is not the caller's. The two are indistinguishable.
- **InvalidSlug**: Passed through from the provisioner: it reserves slugs by configuration as well.
- **SlugTaken**: Passed through from the provisioner.
- **NotEntitled**: Passed through from the provisioner.
- **InstanceLimit**: Passed through from the provisioner.
- **NoCapacity**: Passed through from the provisioner.
- **OperationInProgress**: Passed through from the provisioner: the instance is already changing, or a request with this idempotencyKey is still running.
- **Upstream**: The provisioner is unreachable, not configured, or answered with an error it does not explain to callers, or the job could not be started.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Stop one of the caller's instances, and start a job that follows the stop. Customers only.",
      "errors": [
        {
          "description": "This endpoint requires an authenticated caller.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller is not a HappyProto customer, or the provisioner refused them.",
          "name": "Forbidden"
        },
        {
          "description": "id or idempotencyKey is missing or not a UUID.",
          "name": "InvalidRequest"
        },
        {
          "description": "No such instance, or it is not the caller's. The two are indistinguishable.",
          "name": "NotFound"
        },
        {
          "description": "Passed through from the provisioner: it reserves slugs by configuration as well.",
          "name": "InvalidSlug"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "SlugTaken"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotEntitled"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InstanceLimit"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NoCapacity"
        },
        {
          "description": "Passed through from the provisioner: the instance is already changing, or a request with this idempotencyKey is still running.",
          "name": "OperationInProgress"
        },
        {
          "description": "The provisioner is unreachable, not configured, or answered with an error it does not explain to callers, or the job could not be started.",
          "name": "Upstream"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "id": {
              "description": "The instance's UUID.",
              "type": "string"
            },
            "idempotencyKey": {
              "description": "A UUID the client generates once per intended change and resends on every retry of it, so a retry gets the original reply instead of acting twice.",
              "type": "string"
            }
          },
          "required": [
            "id",
            "idempotencyKey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "jobId": {
              "description": "The background job following the change. Poll it with at.happyproto.server.getJob.",
              "type": "string"
            }
          },
          "required": [
            "jobId"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "at.happyproto.server.stopInstance",
  "lexicon": 1
}
```
