# Platform Notification Service

{% hint style="warning" %}
**Welcome to Our New API Docs!** This is the new home for all things API (previously at [Canvas LMS REST API Documentation](https://api.instructure.com)).
{% endhint %}

## Platform Notification Service

Platform Notification Service (PNS) enables server-to-server communication by allowing the Platform to send messages, known as Notices, to Tools outside the scope of an active user session. Tools can register a "webhook" or handler endpoint using PNS to receive specific types of Notices, facilitating seamless integration and automation.

See also [endpoint-level documentation](/services/canvas/resources/notice_handlers.md) and [Official (1EdTech) documentation](https://www.imsglobal.org/spec/lti-pns/v1p0/main).

### Tool Configuration

Make sure the tool has the required `https://purl.imsglobal.org/spec/lti/scope/noticehandlers` scope.

#### Dynamic Registration

<img src="/files/gmw7pM7ZtHXikviVN7Tm" alt="Dynamic Registration Scopes" width="600">

#### Manual Registration

<img src="/files/JUmCr52SBB9pRl8tMNoX" alt="Manual Registration Scopes" width="600">

### Registering Notice Handlers

To register a Notice Handler (webhook), the tool has to call the platform notification service endpoint. The endpoint URL is advertised in every LTI launch in the `https://purl.imsglobal.org/spec/lti/claim/platformnotificationservice` claim:

```json
...
 "https://purl.imsglobal.org/spec/lti/claim/platformnotificationservice": {
    "service_versions": [
      "1.0"
    ],
    "platform_notification_service_url": "http://canvas-web.inseng.test/api/lti/notice-handlers/106",
    "scope": [
      "https://purl.imsglobal.org/spec/lti/scope/noticehandlers"
    ],
    "notice_types_supported": [
      "LtiHelloWorldNotice",
      "LtiAssetProcessorSubmissionNotice",
      "LtiContextCopyNotice"
    ]
  },
...
```

#### Register the notice handler:

```http
PUT http://canvas-web.inseng.test/api/lti/notice-handlers/106
Content-Type: application/json
Authorization: Bearer <LTI Advantage token>

{
"notice_type": "LtiContextCopyNotice",
"handler": "http://lti-13-test-tool.inseng.test/notice_handlers/106:8865aa05b4b79b64a91a86042e43af5ea8ae79eb"
}
```

Response:

```json
{
    "notice_type": "LtiContextCopyNotice",
    "handler": "http://lti-13-test-tool.inseng.test/notice_handlers/106:8865aa05b4b79b64a91a86042e43af5ea8ae79eb"
}
```

#### Get registered notice handlers:

```http
GET http://canvas-web.inseng.test/api/lti/notice-handlers/106
Content-Type: application/json
Authorization: Bearer <LTI Advantage token>
```

Response:

```json
{
    "client_id": 10000000000068,
    "deployment_id": "106:8865aa05b4b79b64a91a86042e43af5ea8ae79eb",
    "notice_handlers": [
        {
            "notice_type": "LtiContextCopyNotice",
            "handler": "http://lti-13-test-tool.inseng.test/notice_handlers/106:8865aa05b4b79b64a91a86042e43af5ea8ae79eb"
        },
        {
            "notice_type": "LtiHelloWorldNotice",
            "handler": ""
        }
    ]
}
```

#### Notes:

* Use [LTI Advantage token](/services/canvas/oauth2/file.oauth.md#accessing-lti-advantage-services-link) for authentication.
* You can have only one notice handler for a given notice type.
* You can remove the notice handler by setting `""` as a handler.
* Notice handler endpoint must be public, without any authentication.
* Notice handler domain must match the domain of the tool.
* Canvas does not retry delivery of a notice if the notice handler is unavailable.

### Receiving Notices

Canvas sends notices with POST to the registered handlers. The body contains an array of notices. Every notice is a signed JWT. Example body:

```json
{
    "notices": [
        {
            "jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjIwMjUtMDItMDFUMDE6MTY6NDNaXzMwMTg2ODVkLTA1YjctNDNjYi1iODY1LTAyN2VlYzM1MjcxNCJ9.eyJodHRwczovL3B1cmwuaW1zZ2xvYmFsLm9yZy9zcGVjL2x0aS9jbGFpbS92ZXJzaW9uIjoiMS4zLjAiLCJodHRwczovL3B1cmwuaW1zZ2xvYmFsLm9yZy9zcGVjL2x0aS9jbGFpbS9ub3RpY2UiOnsiaWQiOiIxMjU4ZTg1MC04NDQ2LTQzYmYtOTQ2MC1kMjQ5YTYwMDA5MDQiLCJ0aW1lc3RhbXAiOiIyMDI1LTAzLTE5VDExOjExOjE3WiIsInR5cGUiOiJMdGlIZWxsb1dvcmxkTm90aWNlIn0sImF1ZCI6IjEwMDAwMDAwMDAwMDY4IiwiYXpwIjoiMTAwMDAwMDAwMDAwNjgiLCJodHRwczovL3B1cmwu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otice

LtiContextCopyNotice is sent to registered notice handlers when course content is imported to a new or existing course.

Example notice content:

```json
{
  "https://purl.imsglobal.org/spec/lti/claim/version": "1.3.0",
  "https://purl.imsglobal.org/spec/lti/claim/notice": {
    "id": "7a70e604-5b2e-4013-b628-4806228999f1",
    "timestamp": "2025-03-19T11:24:25Z",
    "type": "LtiContextCopyNotice"
  },
  "aud": "10000000000068",
  "azp": "10000000000068",
  "https://purl.imsglobal.org/spec/lti/claim/deployment_id": "106:8865aa05b4b79b64a91a86042e43af5ea8ae79eb",
  "exp": 1742387069,
  "iat": 1742383469,
  "iss": "https://canvas.instructure.com",
  "nonce": "2d220edf-2f1c-4be4-b38e-ec80b1c6749d",
  "https://purl.imsglobal.org/spec/lti/claim/context": {
    "id": "4dde05e8ca1973bcca9bffc13e1548820eee93a3",
    "label": "zzz",
    "title": "zzz",
    "type": [
      "http://purl.imsglobal.org/vocab/lis/v2/course#CourseOffering"
    ]
  },
  "https://purl.imsglobal.org/spec/lti/claim/origin_contexts": [
    "5098686ffc86cae4e0784b533a18af229ff5074e"
  ]
}
```

**Claims**

`context`: metadata about the new LTI Context (Course)

`origin_contexts`: array with 1 element: LTI Context id of the source course

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developerdocs.instructure.com/services/canvas/external-tools/lti/file.pns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
