---
title: Sesiones
slug: sesiones
docTags: 
createdAt: 2024-11-25T03:30:04.021Z
---

Aqui se describe cómo gestionar las sesiones de los usuarios

:::ApiMethodV2
```json
{
  "name": "Obtener Sesiones de un Usuario",
  "method": "GET",
  "url": "https://{suga-id}.sugaway.io/p/user/:uid/session",
  "description": "Este endpoint permite obtener las sesiones activas de un usuario",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "McCdN9xClXes4-hueV01X",
        "language": "curl",
        "code": "curl --location --globoff 'https://{suga-id}.sugaway.io/p/operator/user' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\"name\":\"string\",\"email\":\"string\",\"phone\":\"string\",\"identification\":\"string\"}'",
        "customLabel": ""
      },
      {
        "id": "zC4nTFTsGeZ7OziWfhYDM",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://{suga-id}.sugaway.io/p/operator/user',\n   'headers': {\n      'Accept': 'application/json',\n      'Content-Type': 'application/json'\n   },\n   body: JSON.stringify({\n      \"name\": \"string\",\n      \"email\": \"string\",\n      \"phone\": \"string\",\n      \"identification\": \"string\"\n   })\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "7sTzOGFJEo2guCHDgtJ1k",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\",\n   \"identification\": \"string\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://{suga-id}.sugaway.io/p/operator/user\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "sZYRBCC8cEAjop9LM7ELm",
        "language": "python",
        "code": "import requests\nimport json\n\nurl = \"https://{suga-id}.sugaway.io/p/operator/user\"\n\npayload = json.dumps({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\",\n   \"identification\": \"string\"\n})\nheaders = {\n   'Accept': 'application/json',\n   'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "customLabel": ""
      },
      {
        "id": "c3S730H2_HL4vjBJIwL89",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://{suga-id}.sugaway.io/p/operator/user\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\",\n   \"identification\": \"string\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "McCdN9xClXes4-hueV01X"
  },
  "results": {
    "languages": [
      {
        "id": "oe-7xA5I41AT12JL11T9L",
        "language": "200",
        "customLabel": "",
        "code": "{\n      \"name\": \"Cake's name\",\n    }"
      },
      {
        "id": "dbqsB_6mmKAtC7DKKrd1d",
        "language": "404",
        "customLabel": "",
        "code": "{\n      \"message\": \"Ain't no cake like that.\"\n    }"
      }
    ],
    "selectedLanguageId": "oe-7xA5I41AT12JL11T9L"
  },
  "request": {
    "pathParameters": [
      {
        "name": "uid",
        "kind": "optional",
        "type": "string",
        "description": "UID del Usuario",
        "children": []
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "x-api-key",
        "kind": "optional",
        "type": "string",
        "description": "API Key del Operador",
        "children": []
      },
      {
        "name": "x-access-token",
        "kind": "optional",
        "type": "string",
        "description": "Access Token del Operador",
        "children": []
      }
    ],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  },
  "autoGeneratedAnchorSlug": "obtener-sesiones-de-un-usuario",
  "legacyHash": "NAUyFprpz03qoomfP-rd1"
}
```
:::

:::ApiMethodV2
```json
{
  "name": "Eliminar Sesión de un Usuario",
  "method": "DELETE",
  "url": "https://{suga-id}.sugaway.io/p/user/:uid/session/:sid/action/terminate",
  "description": "Este endpoint permite eliminar una sesión activa de un usuario",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "McCdN9xClXes4-hueV01X",
        "language": "curl",
        "code": "curl --location --globoff 'https://{suga-id}.sugaway.io/p/operator/user' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\"name\":\"string\",\"email\":\"string\",\"phone\":\"string\",\"identification\":\"string\"}'",
        "customLabel": ""
      },
      {
        "id": "zC4nTFTsGeZ7OziWfhYDM",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://{suga-id}.sugaway.io/p/operator/user',\n   'headers': {\n      'Accept': 'application/json',\n      'Content-Type': 'application/json'\n   },\n   body: JSON.stringify({\n      \"name\": \"string\",\n      \"email\": \"string\",\n      \"phone\": \"string\",\n      \"identification\": \"string\"\n   })\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "7sTzOGFJEo2guCHDgtJ1k",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\",\n   \"identification\": \"string\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://{suga-id}.sugaway.io/p/operator/user\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "sZYRBCC8cEAjop9LM7ELm",
        "language": "python",
        "code": "import requests\nimport json\n\nurl = \"https://{suga-id}.sugaway.io/p/operator/user\"\n\npayload = json.dumps({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\",\n   \"identification\": \"string\"\n})\nheaders = {\n   'Accept': 'application/json',\n   'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "customLabel": ""
      },
      {
        "id": "c3S730H2_HL4vjBJIwL89",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://{suga-id}.sugaway.io/p/operator/user\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\",\n   \"identification\": \"string\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "McCdN9xClXes4-hueV01X"
  },
  "results": {
    "languages": [
      {
        "id": "oe-7xA5I41AT12JL11T9L",
        "language": "200",
        "customLabel": "",
        "code": "{\n      \"name\": \"Cake's name\",\n    }"
      },
      {
        "id": "dbqsB_6mmKAtC7DKKrd1d",
        "language": "404",
        "customLabel": "",
        "code": "{\n      \"message\": \"Ain't no cake like that.\"\n    }"
      }
    ],
    "selectedLanguageId": "oe-7xA5I41AT12JL11T9L"
  },
  "request": {
    "pathParameters": [
      {
        "name": "uid",
        "kind": "optional",
        "type": "string",
        "description": "UID del Usuario",
        "children": []
      },
      {
        "name": "sid",
        "kind": "optional",
        "type": "string",
        "description": "UID de la Sesión",
        "children": []
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "x-api-key",
        "kind": "optional",
        "type": "string",
        "description": "API Key del Operador",
        "children": []
      },
      {
        "name": "x-access-token",
        "kind": "optional",
        "type": "string",
        "description": "Access Token del Operador",
        "children": []
      }
    ],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  },
  "autoGeneratedAnchorSlug": "eliminar-sesin-de-un-usuario",
  "legacyHash": "Ghj78SK9fYGpEj6VaaRrl"
}
```
:::

:::ApiMethodV2
```json
{
  "name": "Eliminar Sesiones activas de un Usuario",
  "method": "DELETE",
  "url": "https://{suga-id}.sugaway.io/p/user/:uid/session/action/terminate",
  "description": "Este endpoint permite eliminar todas las sesiones activas de un usuario",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "McCdN9xClXes4-hueV01X",
        "language": "curl",
        "code": "curl --location --globoff 'https://{suga-id}.sugaway.io/p/operator/user' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\"name\":\"string\",\"email\":\"string\",\"phone\":\"string\",\"identification\":\"string\"}'",
        "customLabel": ""
      },
      {
        "id": "zC4nTFTsGeZ7OziWfhYDM",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://{suga-id}.sugaway.io/p/operator/user',\n   'headers': {\n      'Accept': 'application/json',\n      'Content-Type': 'application/json'\n   },\n   body: JSON.stringify({\n      \"name\": \"string\",\n      \"email\": \"string\",\n      \"phone\": \"string\",\n      \"identification\": \"string\"\n   })\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "7sTzOGFJEo2guCHDgtJ1k",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\",\n   \"identification\": \"string\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://{suga-id}.sugaway.io/p/operator/user\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "sZYRBCC8cEAjop9LM7ELm",
        "language": "python",
        "code": "import requests\nimport json\n\nurl = \"https://{suga-id}.sugaway.io/p/operator/user\"\n\npayload = json.dumps({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\",\n   \"identification\": \"string\"\n})\nheaders = {\n   'Accept': 'application/json',\n   'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "customLabel": ""
      },
      {
        "id": "c3S730H2_HL4vjBJIwL89",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://{suga-id}.sugaway.io/p/operator/user\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\",\n   \"identification\": \"string\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "McCdN9xClXes4-hueV01X"
  },
  "results": {
    "languages": [
      {
        "id": "oe-7xA5I41AT12JL11T9L",
        "language": "200",
        "customLabel": "",
        "code": "{\n      \"name\": \"Cake's name\",\n    }"
      },
      {
        "id": "dbqsB_6mmKAtC7DKKrd1d",
        "language": "404",
        "customLabel": "",
        "code": "{\n      \"message\": \"Ain't no cake like that.\"\n    }"
      }
    ],
    "selectedLanguageId": "oe-7xA5I41AT12JL11T9L"
  },
  "request": {
    "pathParameters": [
      {
        "name": "uid",
        "kind": "optional",
        "type": "string",
        "description": "UID del Usuario",
        "children": []
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "x-api-key",
        "kind": "optional",
        "type": "string",
        "description": "API Key del Operador",
        "children": []
      },
      {
        "name": "x-access-token",
        "kind": "optional",
        "type": "string",
        "description": "Access Token del Operador",
        "children": []
      }
    ],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  },
  "autoGeneratedAnchorSlug": "eliminar-sesiones-activas-de-un-usuario",
  "legacyHash": "gfgteeukqC2IqkUASKrr6"
}
```
:::

