# Your profile, CV, preferences and notifications

> Read and update your Ur Next Door profile, CV and notification preferences, read your activity, and read and clear your notifications with the API.

Source: https://docs.urnextdoor.com/guides/profile-and-notifications/

**Scopes:** `profile` and `notifications` · **Quota:** updates use `edit`; reads are not counted

## Profile

`GET /api/v1/me/profile` answers your profile, and an `editable` block with exactly the fields `PUT /api/v1/me/profile` takes, as stored.

**cURL**

```bash
curl -X PUT "https://urnextdoor.com/api/v1/me/profile" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "tagline": "Gardener and weekend baker"
}'
```

**JavaScript**

```js
const res = await fetch("https://urnextdoor.com/api/v1/me/profile", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    tagline: "Gardener and weekend baker",
  }),
});
console.log(res.status, await res.json());
```

**Python**

```python
import os

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.put(
    "https://urnextdoor.com/api/v1/me/profile",
    headers={
        "Authorization": f"Bearer {api_key}",
    },
    json={
        "tagline": "Gardener and weekend baker",
    },
    timeout=30,
)
print(response.status_code, response.json())
```

**PHP**

```php
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'tagline' => 'Gardener and weekend baker',
];

$ch = curl_init('https://urnextdoor.com/api/v1/me/profile');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode($payload),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);

echo $status, PHP_EOL, $body, PHP_EOL;
```

Send only what changes: `display_name`, `tagline`, `bio` (HTML), `location`, `link_url`, `link_title`, `avatar_url`, `banner_url`, `banner_style`. Everything else is kept. An avatar or banner may be one of the built-in images, one of your uploads, or a link to an image elsewhere, which is imported. Your email and password change only on the website.

## CV

`GET /api/v1/me/cv` and `PUT /api/v1/me/cv`. Send the fields you change: a section you send (`experience`, `education`, `skills`, `projects`, `certifications`, `publications`, `honors`, `languages`) replaces that section; sections you leave out are kept. `is_public` is `true` or `false`.

**cURL**

```bash
curl -X PUT "https://urnextdoor.com/api/v1/me/cv" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "headline": "Landscape designer"
}'
```

**JavaScript**

```js
const res = await fetch("https://urnextdoor.com/api/v1/me/cv", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    headline: "Landscape designer",
  }),
});
console.log(res.status, await res.json());
```

**Python**

```python
import os

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.put(
    "https://urnextdoor.com/api/v1/me/cv",
    headers={
        "Authorization": f"Bearer {api_key}",
    },
    json={
        "headline": "Landscape designer",
    },
    timeout=30,
)
print(response.status_code, response.json())
```

**PHP**

```php
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'headline' => 'Landscape designer',
];

$ch = curl_init('https://urnextdoor.com/api/v1/me/cv');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode($payload),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);

echo $status, PHP_EOL, $body, PHP_EOL;
```

## Preferences

`GET /api/v1/me/preferences` lists your privacy settings and every notification switch. `PUT /api/v1/me/preferences` changes the ones you send, and keeps every other switch:

**cURL**

```bash
curl -X PUT "https://urnextdoor.com/api/v1/me/preferences" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "notifications": {
    "comment": {
      "email": false
    }
  }
}'
```

**JavaScript**

```js
const res = await fetch("https://urnextdoor.com/api/v1/me/preferences", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    notifications: {
      comment: {
        email: false,
      },
    },
  }),
});
console.log(res.status, await res.json());
```

**Python**

```python
import os

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.put(
    "https://urnextdoor.com/api/v1/me/preferences",
    headers={
        "Authorization": f"Bearer {api_key}",
    },
    json={
        "notifications": {
            "comment": {
                "email": False,
            },
        },
    },
    timeout=30,
)
print(response.status_code, response.json())
```

**PHP**

```php
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'notifications' => [
        'comment' => [
            'email' => false,
        ],
    ],
];

$ch = curl_init('https://urnextdoor.com/api/v1/me/preferences');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode($payload),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);

echo $status, PHP_EOL, $body, PHP_EOL;
```

## Notifications

| What | Endpoint |
| --- | --- |
| Your newest notifications | `GET /api/v1/notifications?limit=20` |
| How many are unread | `GET /api/v1/notifications/count` |
| Mark one read | `POST /api/v1/notifications/{id}/read` |
| Mark all read | `POST /api/v1/notifications/read-all` |

## Your activity

`GET /api/v1/me/activity` is Settings > Analytics as data: your actions by source (website, app, API) and by key, filtered by `period`, `source`, `key` and `event`. See [Analytics](https://docs.urnextdoor.com/analytics.md).

## Next steps

- [Read the site](https://docs.urnextdoor.com/guides/reading.md).
- [Keep your API key safe](https://docs.urnextdoor.com/security.md).
- [API reference: Profile](https://docs.urnextdoor.com/reference/profile.md).
