> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create CoworkerNotification

> Create a new CoworkerNotification record.

A **CoworkerNotification** represents a push notification sent to a customer (coworker). Notifications are generated by the system in response to various events such as new blog posts, community messages, invoices, identity checks, and more.

Notifications are read-only — they can be listed and retrieved but not created or modified via the API.

The `NotificationType` field indicates the source event. Common values include:

| NotificationType         | Meaning                              |
| ------------------------ | ------------------------------------ |
| `blog`                   | New blog post published              |
| `community-event`        | Community event update               |
| `community-message`      | New community message                |
| `community-thread`       | New community thread                 |
| `course`                 | Course update                        |
| `coworkerinvoice`        | New invoice generated                |
| `identitycheck-fail`     | Identity check failed                |
| `identity-check-failed`  | Identity check failed (alternate)    |
| `identity-check-success` | Identity check succeeded             |
| `identitycheck-success`  | Identity check succeeded (alternate) |
| `push-notification`      | Generic push notification            |
| `reply-like`             | Someone liked a reply                |
| `salto-locker`           | Salto locker event                   |
| `survey`                 | Survey notification                  |
| `thread-like`            | Someone liked a thread               |

## Authentication

<Note>
  This endpoint requires OAuth2 authentication. Include a valid bearer token in the `Authorization` header.
  The authenticated user must be a full unrestricted administrator or have the **`CoworkerNotification-Create`** role.
</Note>

## Request Body

### Required Fields

<ParamField body="CoworkerId" type="integer" required>
  Coworker Id.
</ParamField>

<ParamField body="Message" type="string" required>
  The notification message body displayed to the coworker.
</ParamField>

<ParamField body="NotificationType" type="string" required>
  The type of event that triggered this notification (e.g. blog, community-event, coworkerinvoice, push-notification).
</ParamField>

<ParamField body="EntityId" type="integer" required>
  The ID of the entity related to this notification (e.g. the blog post, invoice, or thread that triggered it).
</ParamField>

### Optional Fields

<ParamField body="IsDismissed" type="boolean">
  Whether the coworker has dismissed this notification.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    "https://spaces.nexudus.com/api/spaces/coworkernotifications" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "CoworkerId": 0,
      "Message": "",
      "NotificationType": "",
      "EntityId": 0
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/spaces/coworkernotifications',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        CoworkerId: 0,
        Message: '',
        NotificationType: '',
        EntityId: 0
      })
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://spaces.nexudus.com/api/spaces/coworkernotifications',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'CoworkerId': 0,
          'Message': '',
          'NotificationType': '',
          'EntityId': 0
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Response

### 200

<ResponseField name="Status" type="integer">
  HTTP status code. `200` on success.
</ResponseField>

<ResponseField name="Message" type="string">
  A human-readable message confirming the creation.
</ResponseField>

<ResponseField name="Value" type="object">
  Contains the `Id` of the newly created record.
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `true` if the coworkernotification was created successfully.
</ResponseField>

<ResponseField name="Errors" type="array">
  `null` on success.
</ResponseField>

```json Example Response theme={null}
{
  "Status": 200,
  "Message": "CoworkerNotification was successfully created.",
  "Value": {
    "Id": 87654321
  },
  "OpenInDialog": false,
  "OpenInWindow": false,
  "RedirectURL": null,
  "JavaScript": null,
  "UpdatedOn": "2025-01-15T10:30:00Z",
  "UpdatedBy": "admin@example.com",
  "Errors": null,
  "WasSuccessful": true
}
```

### 400

<ResponseField name="Message" type="string">
  A summary of the validation error(s), in the format `PropertyName: error message`.
</ResponseField>

<ResponseField name="Value" type="any">
  `null` on validation failure.
</ResponseField>

<ResponseField name="Errors" type="object[]">
  Array of validation errors.

  <Expandable>
    <ResponseField name="AttemptedValue" type="any">
      The value that was submitted for the field, or `null` if missing.
    </ResponseField>

    <ResponseField name="Message" type="string">
      The validation error message.
    </ResponseField>

    <ResponseField name="PropertyName" type="string">
      The name of the property that failed validation.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `false` when the request fails validation.
</ResponseField>

```json Example Response theme={null}
{
  "Message": "Message: is a required field",
  "Value": null,
  "Errors": [
    {
      "AttemptedValue": null,
      "Message": "is a required field",
      "PropertyName": "Message"
    }
  ],
  "WasSuccessful": false
}
```
