---
title: User Subscribe
slug: user-subscribe
docTags: 
createdAt: 2022-12-01T15:51:16.000Z
---

This API notifies the Pathfix Automation's webhook module to start listening for webhooks for the given user\_id.

:::hint{type="warning"}
The API will always return a success message but will only really work if the user\_id is connected via Pathfix OAuth and the webhook is in an active state.
:::





:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe",
  "name": "User Subscribe API",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "kind": "required",
        "name": "user_id",
        "type": "string",
        "description": "Identifier of your currently logged in user"
      },
      {
        "kind": "required",
        "name": "public_key",
        "type": "string",
        "description": "Your Pathfix Application's Public Key"
      },
      {
        "kind": "required",
        "name": "private_key",
        "type": "string",
        "description": "Your Pathfix Application's Private Key"
      }
    ],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "_bhhPSILcjvcku-umegEK",
        "code": "{\n    \"rows\": [\n        {\n            \"pincStatus\": \"success\",\n            \"callId\": \"00dd76ab-f623-48ae-9448-8b3f665ceef5\",\n            \"data\": \"Webhook Subscription Notification sent to Pathfix Automation for user_id: {{user_id}} and provider: {{provider}}\"\n        }\n    ]\n}",
        "language": "200"
      },
      {
        "id": "jeo4IOHKBJ3wfmtigvE55",
        "code": "Unauthorized",
        "language": "403",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "jeo4IOHKBJ3wfmtigvE55"
  },
  "examples": {
    "languages": [
      {
        "id": "mrPkXrNjpLn-WchjnXhkS",
        "code": "curl --request GET\n  --url https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe\n  -d  user_id={{user_id}}\n  -d  public_key={{public_key}}\n  -d  private_key={{private_key}}\n  --header 'Accept: application/json'",
        "language": "curl",
        "customLabel": ""
      },
      {
        "id": "wxFfUDrtSwJ50kkFGJR7g",
        "code": "const fetch = require('node-fetch');\n\nlet url = 'https://labs.pathfix.com/api/connection';\nlet options = {\n  method: 'GET', \nheaders: {\n    Accept: 'application/json',\n  }\n};\nfetch(url, options)\n  .then(res => res.json())\n  .then(json => console.log(json))\n  .catch(err => console.error('error:' + err));",
        "language": "nodejs"
      },
      {
        "id": "O22uMSCxnzDNLhqoR1Eqv",
        "code": "import requests\n\nurl = \"https://labs.pathfix.com/api/connection\"\nheaders = {\"Accept\": \"application/json\"}\nresponse = requests.request(\"GET\", url, headers=headers)\nprint(response.text)",
        "language": "python"
      },
      {
        "id": "vyB1pSi4iBaoeNIwgTyH4",
        "code": "const fetch = require('node-fetch');\n\nlet url = 'https://labs.pathfix.com/api/connection';\nlet options = {method: 'GET', headers: {Accept: 'application/json'}};\nfetch(url, options)\n  .then(res => res.json())\n  .then(json => console.log(json))\n  .catch(err => console.error('error:' + err));",
        "language": "ruby"
      },
      {
        "id": "MybsSoyON9cxL6ytAnIjc",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string',\n   'headers': {\n      'Accept': 'application/json'\n   }\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      },
      {
        "id": "UNBb7fUCUEeFg1HUoXLa9",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "8Kt5PTgrkjjHiP1SI8-7U",
        "code": "import requests\n\nurl = \"https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string\"\n\npayload={}\nheaders = {\n   'Accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "language": "python",
        "customLabel": ""
      },
      {
        "id": "qSG4IUKwPYB0eIINH971G",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "language": "ruby",
        "customLabel": ""
      },
      {
        "id": "WeL3t8gxH8uMO-MLn4Oph",
        "code": "curl --location -g --request POST 'https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string' \\\n--header 'Accept: application/json'",
        "language": "curl",
        "customLabel": ""
      },
      {
        "id": "9NQnmfOM8YM6YDGkUOEO_",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string',\n   'headers': {\n      'Accept': 'application/json'\n   }\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      },
      {
        "id": "yB0VPZdFx2FvkH2vQuKVq",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "klnrCLq8poDaZyuifr4Uu",
        "code": "import requests\n\nurl = \"https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string\"\n\npayload={}\nheaders = {\n   'Accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "language": "python",
        "customLabel": ""
      },
      {
        "id": "dt_ErX7fZYavaFm-d35Sa",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "language": "ruby",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "mrPkXrNjpLn-WchjnXhkS"
  },
  "description": "Call this API to subscribe a user to an active webhook. \n",
  "currentNewParameter": {
    "label": "Query Parameter",
    "value": "queryParameters"
  },
  "autoGeneratedAnchorSlug": "user-subscribe-api",
  "legacyHash": "fLoHngWpNwplRFtEG8kO9"
}
```
:::

