---
title: Gestión de Usuarios
slug: gestion-de-usuarios
docTags: 
createdAt: 2024-01-10T13:34:55.704Z
---

Con el siguiente conjunto de API's podrán ser gestionados los usuarios que posee un Operador dentro de Suga

:::ApiMethodV2
```json
{
  "name": "Alta de Usuario",
  "method": "POST",
  "url": "https://{suga-id}.sugaway.io/p/operator/user",
  "description": "Este endpoint permite gestionar el alta de un usuario de la plataforma para poder ser luego asignado dentro de un comercio",
  "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": [],
    "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": [
      {
        "name": "name",
        "kind": "required",
        "type": "string",
        "description": "Nombre y Apellido del usuario"
      },
      {
        "name": "email",
        "kind": "required",
        "type": "string",
        "description": "Email del usuario. No se podrá crear más de un usuario con el mismo email",
        "children": []
      },
      {
        "name": "phone",
        "kind": "required",
        "type": "string",
        "description": "Teléfono del usuario",
        "children": []
      },
      {
        "name": "identification",
        "kind": "required",
        "type": "string",
        "description": "Número de identificación legal del usuario. Para Argentina enviar CUIL.\nNo se podrá crear más de un usuario con el mismo valor de este campo.",
        "children": []
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Header Parameter",
    "value": "headerParameters"
  },
  "autoGeneratedAnchorSlug": "alta-de-usuario",
  "legacyHash": "S4x2BXzt3qTFyUOSlJB83"
}
```
:::

:::ApiMethodV2
```json
{
  "name": "Modificación de Usuario",
  "method": "PUT",
  "url": "https://{suga-id}.sugaway.io/p/operator/user/{uid}",
  "description": "Este endpoint permite modificar un usuario previamente dado de alta en el operador",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "_uLgT9Ud9fYkhxFkdbXKi",
        "language": "curl",
        "code": "curl --location --globoff --request PUT 'https://{suga-id}.sugaway.io/p/operator/user/{uid}/{uid}' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\"name\":\"string\",\"email\":\"string\",\"phone\":\"string\"}'",
        "customLabel": ""
      },
      {
        "id": "THhvi6cassvM0_lMjdEhu",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'PUT',\n   'url': 'https://{suga-id}.sugaway.io/p/operator/user/{uid}/{uid}',\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   })\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "U10o2vSJIG2gN4tTQEf9v",
        "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});\n\nvar requestOptions = {\n   method: 'PUT',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://{suga-id}.sugaway.io/p/operator/user/{uid}/{uid}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "103RhUmINLgz18xA-J5mU",
        "language": "python",
        "code": "import requests\nimport json\n\nurl = \"https://{suga-id}.sugaway.io/p/operator/user/{uid}/{uid}\"\n\npayload = json.dumps({\n   \"name\": \"string\",\n   \"email\": \"string\",\n   \"phone\": \"string\"\n})\nheaders = {\n   'Accept': 'application/json',\n   'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"PUT\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "customLabel": ""
      },
      {
        "id": "uj4sjCcHj1P5mLUK_j2aw",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://{suga-id}.sugaway.io/p/operator/user/{uid}/{uid}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Put.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})\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "_uLgT9Ud9fYkhxFkdbXKi"
  },
  "results": {
    "selectedLanguageId": "oe-7xA5I41AT12JL11T9L",
    "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    }"
      }
    ]
  },
  "request": {
    "pathParameters": [
      {
        "name": "uid",
        "kind": "required",
        "type": "string",
        "description": "ID del usuario a editar",
        "children": []
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "x-api-key",
        "kind": "required",
        "type": "string",
        "description": "API Key del Operador",
        "children": []
      },
      {
        "name": "x-access-token",
        "kind": "required",
        "type": "string",
        "description": "Access Token del Operador",
        "children": []
      }
    ],
    "bodyDataParameters": [
      {
        "name": "name",
        "kind": "optional",
        "type": "string",
        "description": "Nombre y Apellido del usuario. Enviar en caso de querer modificar"
      },
      {
        "name": "email",
        "kind": "optional",
        "type": "string",
        "description": "Email del usuario. Enviar en caso de querer modificar el email actual.",
        "children": []
      },
      {
        "name": "phone",
        "kind": "optional",
        "type": "string",
        "description": "Teléfono del usuario. Enviar en caso de querer modificar.",
        "children": []
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  },
  "autoGeneratedAnchorSlug": "modificacin-de-usuario",
  "legacyHash": "oMwa4Weq5olMiR1phY-vR"
}
```
:::

Los posibles códigos de error al crear o modificar un usuario son:
\*USER\:MISSING\_DATA
\*USER\:USER\_EXIST\_NO\_VALID
\*NDFE -> El &#x7B;uid} de usuario no corresponde a un usuario válido

:::ApiMethodV2
```json
{
  "name": "Desactivar Usuario",
  "method": "PUT",
  "url": "https://{suga-id}.sugaway.io/p/operator/user/{uid}/action/inactive",
  "description": "Este endpoint permite desactivar un usuario",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "uj4sjCcHj1P5mLUK_j2aw",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://{suga-id}.sugaway.io/p/operator/user/{uid}/action/inactive\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest.body = JSON.dump({})\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "uj4sjCcHj1P5mLUK_j2aw"
  },
  "results": {
    "languages": [
      {
        "id": "oe-7xA5I41AT12JL11T9L",
        "language": "200",
        "customLabel": "",
        "code": "{\n    \"result\": true,\n    \"data\": {}\n}"
      },
      {
        "id": "dbqsB_6mmKAtC7DKKrd1d",
        "language": "404",
        "customLabel": "",
        "code": "{\n      \"message\": \"Ain't no cake like that.\"\n    }"
      }
    ],
    "selectedLanguageId": "dbqsB_6mmKAtC7DKKrd1d"
  },
  "request": {
    "pathParameters": [
      {
        "name": "uid",
        "kind": "required",
        "type": "string",
        "description": "ID del usuario a inactivar",
        "children": []
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "x-api-key",
        "kind": "required",
        "type": "string",
        "description": "API Key del Operador",
        "children": []
      },
      {
        "name": "x-access-token",
        "kind": "required",
        "type": "string",
        "description": "Access Token del Operador",
        "children": []
      }
    ],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  },
  "autoGeneratedAnchorSlug": "desactivar-usuario",
  "legacyHash": "nFIPqhxVwHhMdbd5D7Amn"
}
```
:::

:::ApiMethodV2
```json
{
  "name": "Reactivar Usuario",
  "method": "PUT",
  "url": "https://{suga-id}.sugaway.io/p/operator/user/{uid}/action/active",
  "description": "Este endpoint permite reactivar un usuario previamente inhabilitado",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "uj4sjCcHj1P5mLUK_j2aw",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://{suga-id}.sugaway.io/p/operator/user/{uid}/action/active\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest.body = JSON.dump({})\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "uj4sjCcHj1P5mLUK_j2aw"
  },
  "results": {
    "languages": [
      {
        "id": "oe-7xA5I41AT12JL11T9L",
        "language": "200",
        "customLabel": "",
        "code": "{\n    \"result\": true,\n    \"data\": {}\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": "required",
        "type": "string",
        "description": "ID del usuario a re-activar",
        "children": []
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "x-api-key",
        "kind": "required",
        "type": "string",
        "description": "API Key del Operador",
        "children": []
      },
      {
        "name": "x-access-token",
        "kind": "required",
        "type": "string",
        "description": "Access Token del Operador",
        "children": []
      }
    ],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  },
  "autoGeneratedAnchorSlug": "reactivar-usuario",
  "legacyHash": "9QANSmRMY2k3AlJ-x7wdt"
}
```
:::

:::ApiMethodV2
```json
{
  "name": "Asignar usuario a Entidad",
  "method": "POST",
  "url": "https://{suga-id}.sugaway.io/p/entity/users/{action}",
  "description": "",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "JEuOqm584WpUdByS9QKFj",
        "language": "curl",
        "code": "curl --location --globoff 'https://{suga-id}.sugaway.io/p/entity/users/{action}/{action}' \\\n--header 'x-api-key: string' \\\n--header 'x-access-token: string' \\\n--header 'x-suga-entity: string' \\\n--data '{\"role\":\"String\",\"email\":\"String\"}'",
        "customLabel": ""
      },
      {
        "id": "W_kB4d1AUvTohL6Jg2Ir1",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://{suga-id}.sugaway.io/p/entity/users/{action}/{action}',\n   'headers': {\n      'x-api-key': 'string',\n      'x-access-token': 'string',\n      'x-suga-entity': 'string'\n   },\n   body: '{\"role\":\"String\",\"email\":\"String\"}'\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "0p6se-ZIRz_rIxM6nS-_d",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"x-api-key\", \"string\");\nmyHeaders.append(\"x-access-token\", \"string\");\nmyHeaders.append(\"x-suga-entity\", \"string\");\n\nvar raw = \"{\\\"role\\\":\\\"String\\\",\\\"email\\\":\\\"String\\\"}\";\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://{suga-id}.sugaway.io/p/entity/users/{action}/{action}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "rvHk0n9j2LEkL4lGer8SO",
        "language": "python",
        "code": "import requests\n\nurl = \"https://{suga-id}.sugaway.io/p/entity/users/{action}/{action}\"\n\npayload = \"{\\\"role\\\":\\\"String\\\",\\\"email\\\":\\\"String\\\"}\"\nheaders = {\n   'x-api-key': 'string',\n   'x-access-token': 'string',\n   'x-suga-entity': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "customLabel": ""
      },
      {
        "id": "bs3znDa044-lKThBMvxpM",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://{suga-id}.sugaway.io/p/entity/users/{action}/{action}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"x-api-key\"] = \"string\"\nrequest[\"x-access-token\"] = \"string\"\nrequest[\"x-suga-entity\"] = \"string\"\nrequest.body = \"{\\\"role\\\":\\\"String\\\",\\\"email\\\":\\\"String\\\"}\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "JEuOqm584WpUdByS9QKFj"
  },
  "results": {
    "languages": [
      {
        "id": "ZPj2UDfCZOPLQENyv3uUi",
        "language": "200",
        "customLabel": "",
        "code": "{\n  \"name\": \"Cake's name\",\n}"
      },
      {
        "id": "vTH3wwn38CS1RaOq3ILwa",
        "language": "404",
        "customLabel": "",
        "code": "{\n  \"message\": \"Ain't no cake like that.\"\n}"
      }
    ],
    "selectedLanguageId": "ZPj2UDfCZOPLQENyv3uUi"
  },
  "request": {
    "pathParameters": [
      {
        "name": "action",
        "kind": "required",
        "type": "string",
        "description": "Acción a realizar sobre el usuario y la entidad. Valores disponibles: add, remove",
        "children": []
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "x-api-key",
        "kind": "required",
        "type": "string",
        "description": "API Key del Operador.",
        "children": []
      },
      {
        "name": "x-access-token",
        "kind": "required",
        "type": "string",
        "description": "Token de acceso del Operador.",
        "children": []
      },
      {
        "name": "x-suga-entity",
        "kind": "required",
        "type": "string",
        "description": "ID de la entidad sobre la cual se desea realizar la operación.",
        "children": []
      }
    ],
    "bodyDataParameters": [
      {
        "name": "role",
        "kind": "optional",
        "type": "string",
        "description": "Rol a asignar al usuario. Solo enviar en caso de alta (add). Valores disponibles: admin"
      },
      {
        "name": "email",
        "kind": "required",
        "type": "string",
        "description": "Email del usuario sobre el que se desea ejecutar la acción",
        "children": []
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Header Parameter",
    "value": "headerParameters"
  },
  "autoGeneratedAnchorSlug": "asignar-usuario-a-entidad",
  "legacyHash": "dpu-yv5eyLQt1rsQhrrsP"
}
```
:::

