# social.colibri.beta.notification.registerPush

> Published by [colibri.social](https://lexicon.garden/identity/did:plc:mprdjqjluoswa7awzggaggj3)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.notification.registerPush)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.notification.registerPush/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.notification.registerPush/examples)

## Definitions

### `social.colibri.beta.notification.registerPush`

**Type**: `procedure`

Registers a push endpoint for the requesting user's device. Web Push requires endpoint, p256dh, and auth. FCM requires token.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `auth` | `string` | No | The Web Push subscription's auth secret. Required when provider is webpush. |
| `token` | `string` | No | The FCM registration token. Required when provider is fcm. |
| `p256dh` | `string` | No | The Web Push subscription's p256dh key. Required when provider is webpush. |
| `endpoint` | `string` (uri) | No | The Web Push subscription endpoint. Required when provider is webpush. |
| `platform` | `string` | Yes | The platform the device runs. |
| `provider` | `string` | Yes | The push provider to register with. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|

#### Errors

- **AuthRequired**: The request has no valid service auth.
- **InvalidRequest**: The fields required for the given provider are missing or malformed.
- **PushNotConfigured**: This AppView has no keypair for the requested provider.

## Raw Schema

```json
{
  "id": "social.colibri.beta.notification.registerPush",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "provider",
            "platform"
          ],
          "properties": {
            "auth": {
              "type": "string",
              "description": "The Web Push subscription's auth secret. Required when provider is webpush."
            },
            "token": {
              "type": "string",
              "description": "The FCM registration token. Required when provider is fcm."
            },
            "p256dh": {
              "type": "string",
              "description": "The Web Push subscription's p256dh key. Required when provider is webpush."
            },
            "endpoint": {
              "type": "string",
              "format": "uri",
              "description": "The Web Push subscription endpoint. Required when provider is webpush."
            },
            "platform": {
              "type": "string",
              "description": "The platform the device runs.",
              "knownValues": [
                "web",
                "ios",
                "android"
              ]
            },
            "provider": {
              "type": "string",
              "description": "The push provider to register with.",
              "knownValues": [
                "webpush",
                "fcm"
              ]
            }
          }
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "AuthRequired",
          "description": "The request has no valid service auth."
        },
        {
          "name": "InvalidRequest",
          "description": "The fields required for the given provider are missing or malformed."
        },
        {
          "name": "PushNotConfigured",
          "description": "This AppView has no keypair for the requested provider."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "properties": {}
        },
        "encoding": "application/json"
      },
      "description": "Registers a push endpoint for the requesting user's device. Web Push requires endpoint, p256dh, and auth. FCM requires token."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
