--- title: "How do I create a webhook to call a third party API when an event occurs?" slug: "how-do-i-create-a-webhook-to-call-a-third-party-api-when-an-event-occurs" tags: ["notification service ", "webhook"] updated: 2025-04-17T09:28:38Z published: 2025-04-17T09:28:38Z canonical: "support.lusid.com/how-do-i-create-a-webhook-to-call-a-third-party-api-when-an-event-occurs" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.lusid.com/llms.txt > Use this file to discover all available pages before exploring further. # How do I create a webhook to call a third party API when an event occurs? Providing you are a LUSID user with sufficient access control permissions, you can create a webhook notification to call a third party (that is, non-LUSID) API when an event you have subscribed to occurs. For example, your webhook could call the Atlassian [Create issue](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post) API to create a JIRA when the LUSID `PortfolioCreated` event occurs. Note the following: - You must have already [subscribed to the event](/v1/docs/how-do-i-subscribe-to-an-event) you want to attach the webhook notification to. - You can only call API endpoints that use `PUT`, `POST` or `DELETE` verbs. - You do not have access to API responses, so calls to API endpoints that get or list data are ineffective. - We guarantee notifications are delivered once but in your implementation you should guard against them being delivered more than once. - Note that alternatively your webhook can call a [LUSID API](/v1/docs/how-do-i-create-a-webhook-to-call-a-lusid-api-when-an-event-occurs). ## Using the Notification REST API Currently, you can create one notification per API call. 1. [Upload your credentials](/v1/docs/how-do-i-upload-information-to-the-configuration-store) for the third party API to the Configuration Store. This can either be a Bearer Token or a Basic Authentication username and password. 2. [Obtain an API access token](/v1/docs/how-do-i-obtain-and-use-a-short-lived-api-access-token-from-okta) for the operations below. 3. Call the [CreateNotification](https://www.lusid.com/docs/api/notification/endpoints/notifications/CreateNotification/) API, passing in your API access token and: Consider the following example, of a webhook notification attached to a subscription with scope `PortfolioEvents` and code `PortfolioCreated`. Note the use of event attributes in [mustache templates](/v1/docs/using-mustache-templates-to-enrich-notifications) as placeholders for values generated by the event each time it occurs: ```json curl -X POST "https://.lusid.com/notification/api/subscriptions/PortfolioEvents/PortfolioCreated/notifications"    -H "Authorization: Bearer "    -H "Content-Type: application/json"    -d '{          "notificationId": "PortfolioCreatedJiraWebhook",           "displayName": "PortfolioCreatedWebhookNotification",           "description": "Create JIRA for new portfolio",           "notificationType": {             "Type": "Webhook",            "HttpMethod": "Post",             "Url": "https://acmecorp.atlassian.net/rest/api/3/issue",             "AuthenticationType": "BearerToken",            "AuthenticationConfigurationItemPaths": {              "BearerToken": "config://personal/00u91lo2d7X42sdse88/external-services/jira/api-token"            },             "ContentType": "Json",             "Content": {                "update": {},               "fields": {                 "summary": "Portfolio with ID {{Body.portfolioScope}}/{{Body.portfolioCode}} created on {{Header.timestamp}} - action required",                 "parent": {                   "key": "PROJ-123"                 },                 "issuetype": {                   "id": "10000"                 }               }             }           }          }' ``` The response is as follows. Note you can use the `id` of the notification to reference it again in subsequent API calls: ```json {   "notificationId": "PortfolioCreatedJiraWebhook",   "displayName": "PortfolioCreatedWebhookNotification",   "description": "Create JIRA for new portfolio",   "notificationType": {     "ContentType": "Json",     "Content": {       "update": {},       "fields": {         "summary": "{{PortfolioName}} with ID {{PortfolioScope}}/{{PortPortfolio}} created on {{PortfolioCreated}} - action required",         "parent": {           "key": "PROJ-123"         },         "issuetype": {           "id": "10000"         }       }     },     "type": "Webhook",     "httpMethod": "Post",     "url": "https://acmecorp.atlassian.net/rest/api/3/issue",     "authenticationType": "BearerToken",     "authenticationConfigurationItemPaths": {       "BearerToken": "config://personal/00u91lo2d7X42sdse88/external-services/jira/api-token"     }   },   "createdAt": "2023-07-21T13:59:58.2881300+00:00",   "userIdCreated": "00u91lo2d7X42sdse2p7",   "modfiedAt": "2023-07-21T13:59:58.2881300+00:00",   "userIdModified": "00u91lo2d7X42sdse2p7",   "href": "https://.lusid.com/notification/api/subscriptions/PortfolioEvents/PortfolioCreated/notifications/PortfolioCreatedJiraWebhook" } ``` - The `scope` and `code` of the [subscription](/v1/docs/how-do-i-subscribe-to-an-event) to attach it to. - A `displayName` and unique `notificationId`. - A `Type` of `Webhook`. - A `HttpMethod` of either `PUT`, `POST` or `DELETE`. - A `Url` that constitutes a full path to the resource, for example `https://acmecorp.atlassian.net/rest/api/3/issue`. - An `AuthenticationType` of either `BearerToken` if the receiving service supports OAuth 2.0, or else `BasicAuth`. - An `AuthenticationConfigurationItemPaths` object that specifies the path to the access token or basic authentication credentials uploaded to the Configuration store. For example, to reference a bearer token uploaded to `external-services/jira` in the Personal area of the Configuration Store: ```json "BearerToken": "config://personal/00u91lo2d7X42sdse88/external-services/jira/api-token" ``` If the token scheme is not `Bearer`, use the `BearerScheme` key to locate an appropriate scheme uploaded to the Configuration Store. To reference Basic Authentication credentials uploaded to the same location: ```json "Username": "config://personal/00u91lo2d7X42sdse88/external-services/jira/username", "Password": "config://personal/00u91lo2d7X42sdse88/external-services/jira/password" ``` To find out the exact syntax of a `config://` path, call the Configuration Store [GetConfigurationItem](https://www.lusid.com/docs/api/configuration/endpoints/configuration-sets/GetConfigurationItem/) API for that item. - A `ContentType` of `Json`. - A `Content` object that contains the expected payload for the API.