{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/the-things-network/json-schema/the-things-network-v3-claim-gateway-request-schema.json",
  "title": "v3ClaimGatewayRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/the-things-network-gatewayclaimingserver-api-openapi.yml#/components/schemas/v3ClaimGatewayRequest",
  "type": "object",
  "properties": {
    "authenticated_identifiers": {
      "$ref": "#/$defs/v3ClaimGatewayRequestAuthenticatedIdentifiers"
    },
    "qr_code": {
      "type": "string",
      "format": "byte"
    },
    "collaborator": {
      "$ref": "#/$defs/v3OrganizationOrUserIdentifiers",
      "description": "Collaborator to grant all rights on the target gateway."
    },
    "target_gateway_id": {
      "type": "string",
      "description": "Gateway ID for the target gateway. This must be a unique value.\nIf this is not set, the target ID for the target gateway will be set to `<gateway-eui>`."
    },
    "target_gateway_server_address": {
      "type": "string",
      "description": "Target Gateway Server Address for the target gateway."
    },
    "cups_redirection": {
      "$ref": "#/$defs/v3CUPSRedirection",
      "description": "Parameters to set CUPS redirection for the gateway.\nDEPRECATED: This field is deprecated and will be removed in a future version of The Things Stack."
    },
    "target_frequency_plan_id": {
      "type": "string",
      "description": "Frequency plan ID of the target gateway.\nTODO: Remove this field (https://github.com/TheThingsIndustries/lorawan-stack/issues/4024)\nDEPRECATED: Use target_frequency_plan_ids instead."
    },
    "target_frequency_plan_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Frequency plan IDs of the target gateway."
    }
  },
  "$defs": {
    "CUPSRedirectionClientTLS": {
      "type": "object",
      "properties": {
        "cert": {
          "type": "string",
          "format": "byte",
          "description": "PEM encoded Client Certificate."
        },
        "key": {
          "type": "string",
          "format": "byte",
          "description": "PEM encoded Client Private Key."
        }
      }
    },
    "v3CUPSRedirection": {
      "type": "object",
      "properties": {
        "target_cups_uri": {
          "type": "string",
          "description": "CUPS URI for LoRa Basics Station CUPS redirection."
        },
        "current_gateway_key": {
          "type": "string",
          "description": "The key set in the gateway to authenticate itself."
        },
        "target_cups_trust": {
          "type": "string",
          "format": "byte",
          "description": "Optional PEM encoded CA Root certificate. If this field is empty, DCS will attempt to dial the Target CUPS server and fetch the CA."
        },
        "client_tls": {
          "$ref": "#/$defs/CUPSRedirectionClientTLS",
          "title": "TODO: Support mTLS (https://github.com/TheThingsNetwork/lorawan-stack/issues/137)"
        },
        "auth_token": {
          "type": "string",
          "description": "The Device Claiming Server will fill this field with a The Things Stack API Key."
        }
      },
      "description": "DEPRECATED: This message is deprecated and will be removed in a future version of The Things Stack."
    },
    "v3ClaimGatewayRequestAuthenticatedIdentifiers": {
      "type": "object",
      "properties": {
        "gateway_eui": {
          "type": "string",
          "format": "string"
        },
        "authentication_code": {
          "type": "string",
          "format": "byte"
        }
      }
    },
    "v3OrganizationIdentifiers": {
      "type": "object",
      "properties": {
        "organization_id": {
          "type": "string",
          "description": "This ID shares namespace with user IDs."
        }
      }
    },
    "v3OrganizationOrUserIdentifiers": {
      "type": "object",
      "properties": {
        "organization_ids": {
          "$ref": "#/$defs/v3OrganizationIdentifiers"
        },
        "user_ids": {
          "$ref": "#/$defs/v3UserIdentifiers"
        }
      },
      "description": "OrganizationOrUserIdentifiers contains either organization or user identifiers."
    },
    "v3UserIdentifiers": {
      "type": "object",
      "properties": {
        "user_id": {
          "type": "string",
          "description": "This ID shares namespace with organization IDs."
        },
        "email": {
          "type": "string",
          "description": "Secondary identifier, which can only be used in specific requests."
        }
      }
    }
  }
}