skip to content
superbot.gg

Unlink a device

Part of Devices, 10 operations. The overview covers keys, scopes and errors.

DELETE /v1/devices/{device_id}

Sign the device out: its tokens and the caller keys it minted are revoked. The caller's own device answers 409 own_device (sign out from that device instead).

A caller key holding devices:write (Authorization: Bearer sbc_… or x-api-key: sbc_…), or a signed-in session.

Operation id deleteDevice in Devices.

Path parameters

  • device_id string required

    The device id (a Device id).

Response 200

The device was unlinked.

application/json: DeletedDevice.

  • id string required
  • object string required

    One of device.

  • deleted boolean required

    One of true.

  • agent_unlink AgentUnlink

    What unlinking an agent computer did, and the credentials to rotate at the source.

    5 fields
    • device_id string required
    • reason string required

      One of user, revoked, link_idle.

    • cancelled object required
      7 fields
      • jobs integer required
      • terminals integer required
      • loci integer required
      • prompts integer required
      • pair_requests integer required
      • live_sessions integer required
      • automations integer required
    • key object required
      3 fields
      • holder_removed boolean required
      • factor_wraps_removed integer required
      • rotation string required

        One of enqueued, no_holder_device, not_needed.

    • rotate_at_source array of object required
      4 fields
      • kind string required
      • adapter string required
      • label string | null required
      • class string required

Errors

StatusCodeWhat to change
400invalid_request

A parameter or body field is invalid; param names it and issues lists every problem.

401unauthorized

Send a live caller key or session as Authorization: Bearer … or x-api-key. No key yet: create one at /account/api, or sign a user in at /auth.md.

403insufficient_scope

The key lacks the scope in required_scopes; mint a key that holds it.

404not_found

No such resource on this account; check the id.

409conflict

The resource is not in a state that allows this change.

429rate_limited

Over the per-key request bucket; retry after x-ratelimit-reset.

view .mdopenapi
Request

curl

curl -sS -X DELETE "https://superbot.gg/v1/devices/$DEVICE_ID" \
  -H "Authorization: Bearer $SUPERBOT_API_KEY"

JavaScript

const deviceId = 'DEVICE_ID';
const res = await fetch(`https://superbot.gg/v1/devices/${deviceId}`, {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
  },
});
console.log(res.status, await res.json());

Python

import os
import requests

device_id = "DEVICE_ID"
res = requests.request(
    "DELETE",
    f"https://superbot.gg/v1/devices/{device_id}",
    headers={
        "Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
    },
)
print(res.status_code, res.json())
Response

200 The device was unlinked.

{
  "id": "your-id",
  "object": "device",
  "deleted": true,
  "agent_unlink": {
    "device_id": "your-device-id",
    "reason": "user",
    "cancelled": {
      "jobs": 0,
      "terminals": 0,
      "loci": 0,
      "prompts": 0,
      "pair_requests": 0,
      "live_sessions": 0,
      "automations": 0
    },
    "key": {
      "holder_removed": true,
      "factor_wraps_removed": 0,
      "rotation": "enqueued"
    },
    "rotate_at_source": [
      {
        "kind": "your-kind",
        "adapter": "your-adapter",
        "label": "your-label",
        "class": "your-class"
      }
    ]
  }
}

400 The request is malformed or a parameter is invalid; `param` names the field.

{
  "error": "invalid_request",
  "message": "A parameter or body field is invalid; param names it and issues lists every problem.",
  "doc_url": "https://superbot.gg/developers#errors-invalid_request",
  "request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}

401 The bearer is missing, malformed or unknown.

{
  "error": "unauthorized",
  "message": "Send a live caller key or session as Authorization: Bearer … or x-api-key. No key yet: create one at /account/api, or sign a user in at /auth.md.",
  "doc_url": "https://superbot.gg/developers#errors-unauthorized",
  "request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}

403 The key lacks a scope (insufficient_scope), is revoked, or may not call this route.

{
  "error": "insufficient_scope",
  "message": "The key lacks the scope in required_scopes; mint a key that holds it.",
  "doc_url": "https://superbot.gg/developers#errors-insufficient_scope",
  "request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}

404 No such resource on this account.

{
  "error": "not_found",
  "message": "No such resource on this account; check the id.",
  "doc_url": "https://superbot.gg/developers#errors-not_found",
  "request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}

409 The resource is not in a state that allows this change.

{
  "error": "conflict",
  "message": "The resource is not in a state that allows this change.",
  "doc_url": "https://superbot.gg/developers#errors-conflict",
  "request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}

429 Over the per-key request bucket; retry after x-ratelimit-reset.

{
  "error": "rate_limited",
  "message": "Over the per-key request bucket; retry after x-ratelimit-reset.",
  "doc_url": "https://superbot.gg/developers#errors-rate_limited",
  "request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}