# APIs

API Documentation:

Detailed API information present in this Reference - [API Document](https://project-sunbird.atlassian.net/wiki/spaces/UM/pages/2847178765/SB-24361+Group+Notification+Design)

**Example**:

Group Notification will use the new notification create API to create notifications as defined in the document [Notification Design Discussion](https://project-sunbird.atlassian.net/wiki/spaces/UM/pages/2632613972/SB-24321+Group+Notification+Design+Discussion).

## Create Notification

> This API allows to send email, sms, device and feed type notifications. This will only be accessible internally by different service to send notification. Template configuration needs to be configured to use this service.

```json
{"openapi":"3.0.1","info":{"title":"Notification Service API's","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v2/send":{"post":{"summary":"Create Notification","operationId":"CreateNotification","tags":["Notification APIs"],"description":"This API allows to send email, sms, device and feed type notifications. This will only be accessible internally by different service to send notification. Template configuration needs to be configured to use this service.","parameters":[{"$ref":"#/components/parameters/notification-delivery-mode"},{"name":"ts","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-msgid","in":"header","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Content-Type"},{"$ref":"#/components/parameters/Authorization"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/notificationSendRequest"}}}},"responses":{"200":{"description":"OK ! Successful operation. Send Notification operation was successfully executed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response200"}}}},"400":{"description":"BAD REQUEST. The Send Notifications operation failed ! The possible reason for failure is that you may have missed providing input for a mandatory parameter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response400"}}}},"401":{"description":"Unauthorized User","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response401"}}}},"500":{"description":"INTERNAL SERVER ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response500"}}}}}}}},"components":{"parameters":{"notification-delivery-mode":{"name":"notification-delivery-mode","in":"header","required":true,"schema":{"type":"string"}},"Content-Type":{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string"}},"Authorization":{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"}}},"schemas":{"notificationSendRequest":{"type":"object","properties":{"request":{"type":"object","properties":{"notifications":{"type":"array","items":{"$ref":"#/components/schemas/notificationObj"}}},"required":["notifications"]}},"required":["request"]},"notificationObj":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"}},"type":{"type":"string"},"priority":{"type":"number"},"action":{"$ref":"#/components/schemas/actionObj"}},"required":["ids","type","priority","action"]},"actionObj":{"type":"object","properties":{"type":{"type":"string"},"category":{"type":"string"},"template":{"$ref":"#/components/schemas/templateObj"},"createdBy":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"}},"required":["id","type"]},"additionalInfo":{"type":"object"}},"required":["type","category","template","createdBy"]},"templateObj":{"type":"object","properties":{"type":{"type":"string"},"params":{"type":"object"}},"required":["type","params"]},"response200":{"type":"object","properties":{"id":{"type":"string","default":"v2.notification.send"},"ver":{"type":"string","default":"v1"},"ts":{"type":"string"},"params":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"responseCode":{"type":"string","default":"OK"},"result":{"type":"object","properties":{"response":{"type":"string","default":"SUCCESS"}}}}},"response400":{"type":"object","properties":{"id":{"type":"string","default":"notification.send"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","default":"INVALID_REQUESTED_DATA"},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","default":"#/notifications/0: required key [type] not found"},"responseCode":{"type":"string","default":"CLIENT_ERROR"}}},"result":{"type":"object"}}},"response401":{"type":"object","properties":{"id":{"type":"string","default":"notification.feed.read"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","default":"unauthorized"},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","default":"you are an unauthorized user"},"responseCode":{"type":"string","default":"UNAUTHORIZED"}}},"result":{"type":"object"}}},"response500":{"type":"object","properties":{"id":{"type":"string","default":"v2.notification.send"},"ver":{"type":"string","default":"v1"},"ts":{"type":"string"},"params":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","default":"SERVER_ERROR"}}},"responseCode":{"type":"string","default":"SERVER_ERROR"},"result":{"type":"object"}}}}}}
```

## Read User Notification Feed

> This API is used for getting in-App notification of the user

```json
{"openapi":"3.0.1","info":{"title":"Notification Feed Service API","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v1/feed/read/{userId}":{"get":{"summary":"Read User Notification Feed","description":"This API is used for getting in-App notification of the user","tags":["Notification APIs"],"operationId":"getNotificationFeed","parameters":[{"in":"path","name":"userId","required":true,"description":"User ID to fetch notifications for","schema":{"type":"string"}},{"$ref":"#/components/parameters/Authorization"},{"$ref":"#/components/parameters/XAuthenticatedUserToken"},{"$ref":"#/components/parameters/XAuthenticatedFor"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/XMsgId"}],"responses":{"200":{"description":"Successfully retrieved user notification feed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedReadResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"Authorization":{"name":"Authorization","in":"header","required":true,"description":"Bearer token for API authorization","schema":{"type":"string"}},"XAuthenticatedUserToken":{"name":"x-authenticated-user-token","in":"header","required":true,"description":"User authentication token","schema":{"type":"string"}},"XAuthenticatedFor":{"name":"x-authenticated-for","in":"header","required":false,"description":"Managed User token for MUA users","schema":{"type":"string"}},"Timestamp":{"name":"ts","in":"header","required":false,"description":"Request timestamp","schema":{"type":"string"}},"XMsgId":{"name":"X-msgid","in":"header","required":false,"description":"Unique request identifier","schema":{"type":"string"}}},"schemas":{"FeedReadResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string"},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ResponseParams"},"responseCode":{"type":"string"},"result":{"type":"object","properties":{"feeds":{"type":"array","items":{"$ref":"#/components/schemas/FeedItem"}}}}}},"ResponseParams":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"FeedItem":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"category":{"type":"string"},"priority":{"type":"number"},"status":{"type":"string","enum":["read","unread"]},"createdOn":{"type":"number"},"updatedOn":{"type":"number","nullable":true},"createdBy":{"type":"string"},"updatedBy":{"type":"string","nullable":true},"action":{"$ref":"#/components/schemas/FeedAction"}}},"FeedAction":{"type":"object","properties":{"type":{"type":"string"},"template":{"$ref":"#/components/schemas/Template"},"createdBy":{"$ref":"#/components/schemas/UserReference"},"additionalInfo":{"type":"object"}}},"Template":{"type":"object","properties":{"type":{"type":"string"},"ver":{"type":"string"},"data":{"type":"string"}}},"UserReference":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ErrorParams"},"responseCode":{"type":"string"},"result":{"type":"object"}}},"ErrorParams":{"allOf":[{"$ref":"#/components/schemas/ResponseParams"}],"properties":{"err":{"type":"string"},"errmsg":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

## PATCH /notification/v1/feed/update

> Update Notification Feed Status

```json
{"openapi":"3.0.1","info":{"title":"Notification Feed Service API","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v1/feed/update":{"patch":{"summary":"Update Notification Feed Status","operationId":"updateNotificationFeedStatus","tags":["Notification APIs"],"parameters":[{"$ref":"#/components/parameters/ContentType"},{"$ref":"#/components/parameters/Authorization"},{"$ref":"#/components/parameters/XAuthenticatedUserToken"},{"$ref":"#/components/parameters/XAuthenticatedFor"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/XMsgId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFeedRequest"}}}},"responses":{"200":{"description":"Successfully updated notification status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request - missing or invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"ContentType":{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string","enum":["application/json"],"default":"application/json"}},"Authorization":{"name":"Authorization","in":"header","required":true,"description":"Bearer token for API authorization","schema":{"type":"string"}},"XAuthenticatedUserToken":{"name":"x-authenticated-user-token","in":"header","required":true,"description":"User authentication token","schema":{"type":"string"}},"XAuthenticatedFor":{"name":"x-authenticated-for","in":"header","required":false,"description":"Managed User token for MUA users","schema":{"type":"string"}},"Timestamp":{"name":"ts","in":"header","required":false,"description":"Request timestamp","schema":{"type":"string"}},"XMsgId":{"name":"X-msgid","in":"header","required":false,"description":"Unique request identifier","schema":{"type":"string"}}},"schemas":{"UpdateFeedRequest":{"type":"object","properties":{"request":{"type":"array","items":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"}},"userId":{"type":"string"}},"required":["ids","userId"]}}},"required":["request"]},"SuccessResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string"},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ResponseParams"},"responseCode":{"type":"string"},"result":{"type":"object","properties":{"response":{"type":"string"}}}}},"ResponseParams":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"ErrorResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ErrorParams"},"responseCode":{"type":"string"},"result":{"type":"object"}}},"ErrorParams":{"allOf":[{"$ref":"#/components/schemas/ResponseParams"}],"properties":{"err":{"type":"string"},"errmsg":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

## PATCH /notification/v1/feed/delete

> Delete Notification Feed

```json
{"openapi":"3.0.1","info":{"title":"Notification Feed Management API","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v1/feed/delete":{"patch":{"summary":"Delete Notification Feed","operationId":"deleteNotificationFeed","tags":["Notification Feed"],"parameters":[{"$ref":"#/components/parameters/ContentType"},{"$ref":"#/components/parameters/Authorization"},{"$ref":"#/components/parameters/XAuthenticatedUserToken"},{"$ref":"#/components/parameters/XAuthenticatedFor"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/XMsgId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteFeedRequest"}}}},"responses":{"200":{"description":"Successfully deleted notification feed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"ContentType":{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string","enum":["application/json"],"default":"application/json"}},"Authorization":{"name":"Authorization","in":"header","required":true,"description":"Bearer token for API authorization","schema":{"type":"string"}},"XAuthenticatedUserToken":{"name":"x-authenticated-user-token","in":"header","required":true,"description":"User authentication token","schema":{"type":"string"}},"XAuthenticatedFor":{"name":"x-authenticated-for","in":"header","required":false,"description":"Managed User token for MUA users","schema":{"type":"string"}},"Timestamp":{"name":"ts","in":"header","required":false,"description":"Request timestamp","schema":{"type":"string"}},"XMsgId":{"name":"X-msgid","in":"header","required":false,"description":"Unique request identifier","schema":{"type":"string"}}},"schemas":{"DeleteFeedRequest":{"type":"object","properties":{"request":{"type":"array","items":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"},"minItems":1},"userId":{"type":"string"},"category":{"type":"string"}},"required":["ids","userId"]}}},"required":["request"]},"SuccessResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string"},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ResponseParams"},"responseCode":{"type":"string","enum":["OK"]},"result":{"type":"object","properties":{"response":{"type":"string","enum":["SUCCESS"]}}}}},"ResponseParams":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"ErrorResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ErrorParams"},"responseCode":{"type":"string","enum":["CLIENT_ERROR","SERVER_ERROR","UNAUTHORIZED"]},"result":{"type":"object"}}},"ErrorParams":{"allOf":[{"$ref":"#/components/schemas/ResponseParams"}],"properties":{"err":{"type":"string"},"errmsg":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

## POST /notification/v1/template/create

> Create Notification Template

```json
{"openapi":"3.0.1","info":{"title":"Notification Feed Management API","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v1/template/create":{"post":{"summary":"Create Notification Template","operationId":"createNotificationTemplate","tags":["Notification Templates"],"parameters":[{"$ref":"#/components/parameters/ContentType"},{"$ref":"#/components/parameters/Authorization"},{"$ref":"#/components/parameters/XAuthenticatedUserToken"},{"$ref":"#/components/parameters/XAuthenticatedFor"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/XMsgId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateRequest"}}}},"responses":{"200":{"description":"Successfully created notification template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"ContentType":{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string","enum":["application/json"],"default":"application/json"}},"Authorization":{"name":"Authorization","in":"header","required":true,"description":"Bearer token for API authorization","schema":{"type":"string"}},"XAuthenticatedUserToken":{"name":"x-authenticated-user-token","in":"header","required":true,"description":"User authentication token","schema":{"type":"string"}},"XAuthenticatedFor":{"name":"x-authenticated-for","in":"header","required":false,"description":"Managed User token for MUA users","schema":{"type":"string"}},"Timestamp":{"name":"ts","in":"header","required":false,"description":"Request timestamp","schema":{"type":"string"}},"XMsgId":{"name":"X-msgid","in":"header","required":false,"description":"Unique request identifier","schema":{"type":"string"}}},"schemas":{"CreateTemplateRequest":{"type":"object","properties":{"request":{"type":"object","properties":{"ver":{"type":"string","description":"Version of the template"},"data":{"type":"string","description":"Template content with placeholders"},"templateId":{"type":"string","description":"Unique identifier for the template"},"type":{"type":"string","enum":["JSON","TEXT","HTML"],"description":"Type of the template"},"config":{"type":"object","additionalProperties":true,"description":"Additional configuration for the template"},"template_schema":{"type":"string","description":"JSON schema for template parameter validation"}},"required":["ver","data","templateId","type","template_schema"]}},"required":["request"]},"SuccessResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string"},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ResponseParams"},"responseCode":{"type":"string","enum":["OK"]},"result":{"type":"object","properties":{"response":{"type":"string","enum":["SUCCESS"]}}}}},"ResponseParams":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"ErrorResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ErrorParams"},"responseCode":{"type":"string","enum":["CLIENT_ERROR","SERVER_ERROR","UNAUTHORIZED"]},"result":{"type":"object"}}},"ErrorParams":{"allOf":[{"$ref":"#/components/schemas/ResponseParams"}],"properties":{"err":{"type":"string"},"errmsg":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

## PATCH /notification/v1/template/update

> Update Notification Template

```json
{"openapi":"3.0.1","info":{"title":"Notification Template Management API","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v1/template/update":{"patch":{"summary":"Update Notification Template","operationId":"updateNotificationTemplate","tags":["Notification Templates"],"parameters":[{"$ref":"#/components/parameters/ContentType"},{"$ref":"#/components/parameters/Authorization"},{"$ref":"#/components/parameters/XAuthenticatedUserToken"},{"$ref":"#/components/parameters/XAuthenticatedFor"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/XMsgId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTemplateRequest"}}}},"responses":{"200":{"description":"Successfully updated notification template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"ContentType":{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string","enum":["application/json"],"default":"application/json"}},"Authorization":{"name":"Authorization","in":"header","required":true,"description":"Bearer token for API authorization","schema":{"type":"string"}},"XAuthenticatedUserToken":{"name":"x-authenticated-user-token","in":"header","required":true,"description":"User authentication token","schema":{"type":"string"}},"XAuthenticatedFor":{"name":"x-authenticated-for","in":"header","required":false,"description":"Managed User token for MUA users","schema":{"type":"string"}},"Timestamp":{"name":"ts","in":"header","required":false,"description":"Request timestamp","schema":{"type":"string"}},"XMsgId":{"name":"X-msgid","in":"header","required":false,"description":"Unique request identifier","schema":{"type":"string"}}},"schemas":{"UpdateTemplateRequest":{"type":"object","properties":{"request":{"type":"object","properties":{"templateId":{"type":"string","description":"Unique identifier of the template to update"},"ver":{"type":"string","description":"Version of the template"},"data":{"type":"string","description":"Updated template content with placeholders"},"type":{"type":"string","enum":["JSON","TEXT","HTML"],"description":"Type of the template"},"config":{"type":"object","additionalProperties":true,"description":"Additional configuration for the template"},"template_schema":{"type":"string","description":"JSON schema for template parameter validation"}},"required":["templateId"]}},"required":["request"]},"SuccessResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string"},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ResponseParams"},"responseCode":{"type":"string","enum":["OK"]},"result":{"type":"object","properties":{"response":{"type":"string","enum":["SUCCESS"]}}}}},"ResponseParams":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"ErrorResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ErrorParams"},"responseCode":{"type":"string","enum":["CLIENT_ERROR","SERVER_ERROR","UNAUTHORIZED"]},"result":{"type":"object"}}},"ErrorParams":{"allOf":[{"$ref":"#/components/schemas/ResponseParams"}],"properties":{"err":{"type":"string"},"errmsg":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

## PATCH /notification/v1/template/delete

> Delete Notification Template

```json
{"openapi":"3.0.1","info":{"title":"Notification Template Management API","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v1/template/delete":{"patch":{"summary":"Delete Notification Template","operationId":"deleteNotificationTemplate","tags":["Notification Templates"],"parameters":[{"$ref":"#/components/parameters/ContentType"},{"$ref":"#/components/parameters/Authorization"},{"$ref":"#/components/parameters/XAuthenticatedUserToken"},{"$ref":"#/components/parameters/XAuthenticatedFor"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/XMsgId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteTemplateRequest"}}}},"responses":{"200":{"description":"Successfully deleted notification template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"ContentType":{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string","enum":["application/json"],"default":"application/json"}},"Authorization":{"name":"Authorization","in":"header","required":true,"description":"Bearer token for API authorization","schema":{"type":"string"}},"XAuthenticatedUserToken":{"name":"x-authenticated-user-token","in":"header","required":true,"description":"User authentication token","schema":{"type":"string"}},"XAuthenticatedFor":{"name":"x-authenticated-for","in":"header","required":false,"description":"Managed User token for MUA users","schema":{"type":"string"}},"Timestamp":{"name":"ts","in":"header","required":false,"description":"Request timestamp","schema":{"type":"string"}},"XMsgId":{"name":"X-msgid","in":"header","required":false,"description":"Unique request identifier","schema":{"type":"string"}}},"schemas":{"DeleteTemplateRequest":{"type":"object","properties":{"request":{"type":"object","properties":{"templateId":{"type":"string","description":"Unique identifier of the template to delete"}},"required":["templateId"]}},"required":["request"]},"SuccessResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string"},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ResponseParams"},"responseCode":{"type":"string","enum":["OK"]},"result":{"type":"object","properties":{"response":{"type":"string","enum":["SUCCESS"]}}}}},"ResponseParams":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"ErrorResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ErrorParams"},"responseCode":{"type":"string","enum":["CLIENT_ERROR","SERVER_ERROR","UNAUTHORIZED"]},"result":{"type":"object"}}},"ErrorParams":{"allOf":[{"$ref":"#/components/schemas/ResponseParams"}],"properties":{"err":{"type":"string"},"errmsg":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

***

## List all available notification templates

> Retrieve a list of all notification templates available in the system

```json
{"openapi":"3.0.1","info":{"title":"Notification Template Management API","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v1/template/list":{"get":{"summary":"List all available notification templates","description":"Retrieve a list of all notification templates available in the system","tags":["Notification Templates"],"operationId":"listNotificationTemplates","parameters":[{"$ref":"#/components/parameters/Authorization"},{"$ref":"#/components/parameters/XAuthenticatedUserToken"},{"$ref":"#/components/parameters/XAuthenticatedFor"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/XMsgId"}],"responses":{"200":{"description":"Successfully retrieved templates","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateListResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"Authorization":{"name":"Authorization","in":"header","required":true,"description":"Bearer token for API authorization","schema":{"type":"string"}},"XAuthenticatedUserToken":{"name":"x-authenticated-user-token","in":"header","required":true,"description":"User authentication token","schema":{"type":"string"}},"XAuthenticatedFor":{"name":"x-authenticated-for","in":"header","required":false,"description":"Managed User token for MUA users","schema":{"type":"string"}},"Timestamp":{"name":"ts","in":"header","required":false,"description":"Request timestamp","schema":{"type":"string"}},"XMsgId":{"name":"X-msgid","in":"header","required":false,"description":"Unique request identifier","schema":{"type":"string"}}},"schemas":{"TemplateListResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string"},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ResponseParams"},"responseCode":{"type":"string","enum":["OK"]},"result":{"type":"object","properties":{"templates":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}}},"ResponseParams":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"Template":{"type":"object","properties":{"lastUpdatedBy":{"type":"string"},"createdBy":{"type":"string"},"ver":{"type":"string"},"data":{"type":"string"},"templateId":{"type":"string"},"type":{"type":"string","enum":["JSON","TEXT","HTML"]},"config":{"type":"object","additionalProperties":true},"template_schema":{"type":"string"},"lastUpdatedOn":{"type":"string","nullable":true},"createdOn":{"type":"number"}}},"ErrorResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ErrorParams"},"responseCode":{"type":"string","enum":["CLIENT_ERROR","SERVER_ERROR","UNAUTHORIZED"]},"result":{"type":"object"}}},"ErrorParams":{"allOf":[{"$ref":"#/components/schemas/ResponseParams"}],"properties":{"err":{"type":"string"},"errmsg":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

## Map action to notification template

> Associate a notification template with a specific action

```json
{"openapi":"3.0.1","info":{"title":"Notification Template Management API","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v1/template/action/update":{"patch":{"summary":"Map action to notification template","description":"Associate a notification template with a specific action","tags":["Notification Templates"],"operationId":"mapActionToTemplate","parameters":[{"$ref":"#/components/parameters/ContentType"},{"$ref":"#/components/parameters/Authorization"},{"$ref":"#/components/parameters/XAuthenticatedUserToken"},{"$ref":"#/components/parameters/XAuthenticatedFor"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/XMsgId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapActionTemplateRequest"}}}},"responses":{"200":{"description":"Successfully mapped action to template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"ContentType":{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string","enum":["application/json"],"default":"application/json"}},"Authorization":{"name":"Authorization","in":"header","required":true,"description":"Bearer token for API authorization","schema":{"type":"string"}},"XAuthenticatedUserToken":{"name":"x-authenticated-user-token","in":"header","required":true,"description":"User authentication token","schema":{"type":"string"}},"XAuthenticatedFor":{"name":"x-authenticated-for","in":"header","required":false,"description":"Managed User token for MUA users","schema":{"type":"string"}},"Timestamp":{"name":"ts","in":"header","required":false,"description":"Request timestamp","schema":{"type":"string"}},"XMsgId":{"name":"X-msgid","in":"header","required":false,"description":"Unique request identifier","schema":{"type":"string"}}},"schemas":{"MapActionTemplateRequest":{"type":"object","properties":{"request":{"type":"object","properties":{"templateId":{"type":"string","description":"ID of the template to map"},"action":{"type":"string","description":"Action to map the template to"},"type":{"type":"string","enum":["Feed","Email","SMS","Device"],"description":"Type of notification"}},"required":["templateId","action","type"]}},"required":["request"]},"SuccessResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string"},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ResponseParams"},"responseCode":{"type":"string","enum":["OK"]},"result":{"type":"object","properties":{"response":{"type":"string","enum":["SUCCESS"]}}}}},"ResponseParams":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"ErrorResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ErrorParams"},"responseCode":{"type":"string","enum":["CLIENT_ERROR","SERVER_ERROR","UNAUTHORIZED"]},"result":{"type":"object"}}},"ErrorParams":{"allOf":[{"$ref":"#/components/schemas/ResponseParams"}],"properties":{"err":{"type":"string"},"errmsg":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

## Get template mapped to an action

> Retrieve the notification template associated with a specific action

```json
{"openapi":"3.0.1","info":{"title":"Notification Template Management API","version":"1.0"},"servers":[{"url":"https://staging.sunbirded.org/api"}],"paths":{"/notification/v1/template/{action}":{"get":{"summary":"Get template mapped to an action","description":"Retrieve the notification template associated with a specific action","tags":["Notification Templates"],"operationId":"getTemplateByAction","parameters":[{"name":"action","in":"path","required":true,"description":"The action to get the mapped template for","schema":{"type":"string"}},{"$ref":"#/components/parameters/Authorization"},{"$ref":"#/components/parameters/XAuthenticatedUserToken"},{"$ref":"#/components/parameters/XAuthenticatedFor"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/XMsgId"}],"responses":{"200":{"description":"Successfully retrieved template for action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionTemplateResponse"}}}},"400":{"description":"Action configuration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"Authorization":{"name":"Authorization","in":"header","required":true,"description":"Bearer token for API authorization","schema":{"type":"string"}},"XAuthenticatedUserToken":{"name":"x-authenticated-user-token","in":"header","required":true,"description":"User authentication token","schema":{"type":"string"}},"XAuthenticatedFor":{"name":"x-authenticated-for","in":"header","required":false,"description":"Managed User token for MUA users","schema":{"type":"string"}},"Timestamp":{"name":"ts","in":"header","required":false,"description":"Request timestamp","schema":{"type":"string"}},"XMsgId":{"name":"X-msgid","in":"header","required":false,"description":"Unique request identifier","schema":{"type":"string"}}},"schemas":{"ActionTemplateResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string"},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ResponseParams"},"responseCode":{"type":"string","enum":["OK"]},"result":{"type":"object","properties":{"action":{"type":"string"},"type":{"type":"string"},"template":{"$ref":"#/components/schemas/Template"}}}}},"ResponseParams":{"type":"object","properties":{"resmsgid":{"type":"string","nullable":true},"msgid":{"type":"string"},"err":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"errmsg":{"type":"string","nullable":true}}},"Template":{"type":"object","properties":{"lastUpdatedBy":{"type":"string"},"createdBy":{"type":"string"},"ver":{"type":"string"},"data":{"type":"string"},"templateId":{"type":"string"},"type":{"type":"string","enum":["JSON","TEXT","HTML"]},"config":{"type":"object","additionalProperties":true},"template_schema":{"type":"string"},"lastUpdatedOn":{"type":"string","nullable":true},"createdOn":{"type":"number"}}},"ErrorResponse":{"type":"object","properties":{"id":{"type":"string"},"ver":{"type":"string","nullable":true},"ts":{"type":"string"},"params":{"$ref":"#/components/schemas/ErrorParams"},"responseCode":{"type":"string","enum":["CLIENT_ERROR","SERVER_ERROR","UNAUTHORIZED"]},"result":{"type":"object"}}},"ErrorParams":{"allOf":[{"$ref":"#/components/schemas/ResponseParams"}],"properties":{"err":{"type":"string"},"errmsg":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

***
