Follow, connect and block
Follow members, communities and tags, send and answer connection requests, block and unblock, and list your network with the Ur Next Door API.
Scope: network (lists need browse) ยท Quotas: follow and connect, with a tight per-minute limit; accepting, declining, cancelling and unblocking are not counted
Name a member by username (with or without the @) or by user_id, a community or tag by its slug or id.
Follow and unfollow
Set the state you want; a repeat changes nothing and sends no second notification:
curl -X PUT "https://urnextdoor.com/api/v1/follows" \
-H "Authorization: Bearer $UND_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "user",
"username": "aarav",
"following": true
}'const res = await fetch("https://urnextdoor.com/api/v1/follows", {
method: "PUT",
headers: {
Authorization: `Bearer ${process.env.UND_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
type: "user",
username: "aarav",
following: true,
}),
});
console.log(res.status, await res.json());import os
import requests
api_key = os.environ["UND_API_KEY"]
response = requests.put(
"https://urnextdoor.com/api/v1/follows",
headers={
"Authorization": f"Bearer {api_key}",
},
json={
"type": "user",
"username": "aarav",
"following": True,
},
timeout=30,
)
print(response.status_code, response.json())<?php
$apiKey = getenv('UND_API_KEY');
$payload = [
'type' => 'user',
'username' => 'aarav',
'following' => true,
];
$ch = curl_init('https://urnextdoor.com/api/v1/follows');
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;type is user, community or tag. following: false unfollows.
Connections
| What | Endpoint |
|---|---|
| Send a request | POST /api/v1/connections/request |
| Accept a request you received | POST /api/v1/connections/accept |
| Decline it | POST /api/v1/connections/decline |
| Take back a request you sent | POST /api/v1/connections/cancel |
| List your connections and requests | GET /api/v1/me/connections?list=accepted (or incoming, outgoing) |
Each takes {"username": "asha"} and answers the state between you: none, pending_outgoing, pending_incoming or connected. A request to someone who already asked you connects you at once. Members can choose who may send them requests; a refused request answers 422 with the reason.
curl -X POST "https://urnextdoor.com/api/v1/connections/request" \
-H "Authorization: Bearer $UND_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"username": "aarav"
}'const res = await fetch("https://urnextdoor.com/api/v1/connections/request", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.UND_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
username: "aarav",
}),
});
console.log(res.status, await res.json());import os
import uuid
import requests
api_key = os.environ["UND_API_KEY"]
response = requests.post(
"https://urnextdoor.com/api/v1/connections/request",
headers={
"Authorization": f"Bearer {api_key}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"username": "aarav",
},
timeout=30,
)
print(response.status_code, response.json())<?php
$apiKey = getenv('UND_API_KEY');
$payload = [
'username' => 'aarav',
];
$ch = curl_init('https://urnextdoor.com/api/v1/connections/request');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, PHP_EOL, $body, PHP_EOL;Removing a connection stays on the website.
Block and unblock
POST /api/v1/blocks and POST /api/v1/blocks/remove, with {"username": "..."}. A block ends connections and follows between you, and you stop seeing each other's content. Unblocking does not bring them back. GET /api/v1/me/blocked lists everyone you blocked.
What you follow
GET /api/v1/me/following?list=users (or communities, tags). Without list, a first page of each.
Next steps
- Communities: join, leave and invites.
- Messages: a key starts chats only with your connections.
- Comment, react, save and vote.
Last updated