Engagement endpoints

Comment, reply, answer, like or dislike, save, vote in polls, answer MCQs and report content, as you.

View as Markdown

All paths are relative to https://urnextdoor.com/api/v1. See API reference for the envelope and headers every endpoint shares.

EndpointWhat it doesScopeDaily quota
POST /posts/{id}/commentsComment on a postengagecomment
POST /polls/{id}/commentsComment on a pollengagecomment
POST /mcqs/{id}/commentsComment on an MCQengagecomment
POST /comments/{id}/repliesReply to a commentengagecomment
POST /questions/{id}/answersAnswer a questionengageanswer
PUT /reactionsLike, dislike or clearengagereact
PUT /favoritesSave or unsaveengagereact
POST /polls/{id}/voteVote in a pollengagereact
POST /mcqs/{id}/answerAnswer an MCQengagereact
POST /reportsReport contentengagereport

Comment on a post

POST https://urnextdoor.com/api/v1/posts/{id}/comments

Add a comment to a post you can see, as you. The author is notified.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as comment (see limits)
  • Idempotency-Key: supported (see Idempotency)
  • operationId: commentOnPost

Parameters

NameInRequiredDescription
idpathYesThe numeric id of the item.

Request body

Send Content-Type: application/json.

Example

cURL
curl -X POST "https://urnextdoor.com/api/v1/posts/41/comments" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "body": "Great tips, thank you!"
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/posts/41/comments", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    body: "Great tips, thank you!",
  }),
});
console.log(res.status, await res.json());
Python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/posts/41/comments",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "body": "Great tips, thank you!",
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'body' => 'Great tips, thank you!',
];

$ch = curl_init('https://urnextdoor.com/api/v1/posts/41/comments');
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;

Responses

StatusMeaningCodes
201 Created{id, comment, comments}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Comment on a poll

POST https://urnextdoor.com/api/v1/polls/{id}/comments

Add a comment to a poll you can see.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as comment (see limits)
  • Idempotency-Key: supported (see Idempotency)
  • operationId: commentOnPoll

Parameters

NameInRequiredDescription
idpathYesThe numeric id of the item.

Request body

Send Content-Type: application/json.

Example

cURL
curl -X POST "https://urnextdoor.com/api/v1/polls/41/comments" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "body": "I voted for the balcony garden."
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/polls/41/comments", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    body: "I voted for the balcony garden.",
  }),
});
console.log(res.status, await res.json());
Python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/polls/41/comments",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "body": "I voted for the balcony garden.",
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'body' => 'I voted for the balcony garden.',
];

$ch = curl_init('https://urnextdoor.com/api/v1/polls/41/comments');
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;

Responses

StatusMeaningCodes
201 Created{id, comment, comments}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Comment on an MCQ

POST https://urnextdoor.com/api/v1/mcqs/{id}/comments

Add a comment to an MCQ you can see.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as comment (see limits)
  • Idempotency-Key: supported (see Idempotency)
  • operationId: commentOnMcq

Parameters

NameInRequiredDescription
idpathYesThe numeric id of the item.

Request body

Send Content-Type: application/json.

Example

cURL
curl -X POST "https://urnextdoor.com/api/v1/mcqs/41/comments" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "body": "Tricky one!"
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/mcqs/41/comments", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    body: "Tricky one!",
  }),
});
console.log(res.status, await res.json());
Python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/mcqs/41/comments",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "body": "Tricky one!",
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'body' => 'Tricky one!',
];

$ch = curl_init('https://urnextdoor.com/api/v1/mcqs/41/comments');
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;

Responses

StatusMeaningCodes
201 Created{id, comment, comments}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Reply to a comment

POST https://urnextdoor.com/api/v1/comments/{id}/replies

Reply to a comment (one level deep). Its author is notified.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as comment (see limits)
  • Idempotency-Key: supported (see Idempotency)
  • operationId: replyToComment

Parameters

NameInRequiredDescription
idpathYesThe numeric id of the item.

Request body

Send Content-Type: application/json.

Example

cURL
curl -X POST "https://urnextdoor.com/api/v1/comments/41/replies" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "body": "Agreed, thank you."
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/comments/41/replies", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    body: "Agreed, thank you.",
  }),
});
console.log(res.status, await res.json());
Python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/comments/41/replies",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "body": "Agreed, thank you.",
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'body' => 'Agreed, thank you.',
];

$ch = curl_init('https://urnextdoor.com/api/v1/comments/41/replies');
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;

Responses

StatusMeaningCodes
201 Created{id, comment, comments}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Answer a question

POST https://urnextdoor.com/api/v1/questions/{id}/answers

Post an answer to a question you can see. In a community, editors and above can answer. Outside images are imported.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as answer (see limits)
  • Idempotency-Key: supported (see Idempotency)
  • operationId: answerQuestion

Parameters

NameInRequiredDescription
idpathYesThe numeric id of the item.

Request body

Send Content-Type: application/json.

Example

cURL
curl -X POST "https://urnextdoor.com/api/v1/questions/41/answers" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "body": "<p>Use a drip line on a timer.</p>"
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/questions/41/answers", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    body: "<p>Use a drip line on a timer.</p>",
  }),
});
console.log(res.status, await res.json());
Python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/questions/41/answers",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "body": "<p>Use a drip line on a timer.</p>",
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'body' => '<p>Use a drip line on a timer.</p>',
];

$ch = curl_init('https://urnextdoor.com/api/v1/questions/41/answers');
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;

Responses

StatusMeaningCodes
201 Created{id, answer, answers}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Like, dislike or clear

PUT https://urnextdoor.com/api/v1/reactions

Set your reaction: 1 like, -1 dislike, 0 none. Sending what is already there changes nothing.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as react (see limits)
  • operationId: setReaction

Request body

Send Content-Type: application/json.

Example

cURL
curl -X PUT "https://urnextdoor.com/api/v1/reactions" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "post",
  "id": 41,
  "reaction": 1
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/reactions", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    type: "post",
    id: 41,
    reaction: 1,
  }),
});
console.log(res.status, await res.json());
Python
import os

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.put(
    "https://urnextdoor.com/api/v1/reactions",
    headers={
        "Authorization": f"Bearer {api_key}",
    },
    json={
        "type": "post",
        "id": 41,
        "reaction": 1,
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'type' => 'post',
    'id' => 41,
    'reaction' => 1,
];

$ch = curl_init('https://urnextdoor.com/api/v1/reactions');
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;

Responses

StatusMeaningCodes
200 OK{likes, dislikes, my_vote, changed}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Save or unsave

PUT https://urnextdoor.com/api/v1/favorites

Set whether an item is in your saved list.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as react (see limits)
  • operationId: setSaved

Request body

Send Content-Type: application/json.

Example

cURL
curl -X PUT "https://urnextdoor.com/api/v1/favorites" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "question",
  "id": 12,
  "saved": true
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/favorites", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    type: "question",
    id: 12,
    saved: true,
  }),
});
console.log(res.status, await res.json());
Python
import os

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.put(
    "https://urnextdoor.com/api/v1/favorites",
    headers={
        "Authorization": f"Bearer {api_key}",
    },
    json={
        "type": "question",
        "id": 12,
        "saved": True,
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'type' => 'question',
    'id' => 12,
    'saved' => true,
];

$ch = curl_init('https://urnextdoor.com/api/v1/favorites');
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;

Responses

StatusMeaningCodes
200 OK{saved, changed}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Vote in a poll

POST https://urnextdoor.com/api/v1/polls/{id}/vote

Vote for an option, switch, or take your vote back with option_id null. Voting for your current option again changes nothing.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as react (see limits)
  • Idempotency-Key: supported (see Idempotency)
  • operationId: voteInPoll

Parameters

NameInRequiredDescription
idpathYesThe numeric id of the item.

Request body

Send Content-Type: application/json.

Example

cURL
curl -X POST "https://urnextdoor.com/api/v1/polls/41/vote" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "option_id": 301
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/polls/41/vote", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    option_id: 301,
  }),
});
console.log(res.status, await res.json());
Python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/polls/41/vote",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "option_id": 301,
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'option_id' => 301,
];

$ch = curl_init('https://urnextdoor.com/api/v1/polls/41/vote');
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;

Responses

StatusMeaningCodes
200 OK{options, my_vote_option_id, total_votes, changed}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Answer an MCQ

POST https://urnextdoor.com/api/v1/mcqs/{id}/answer

Choose an option. Once only: a second answer is 409. The answer tells you if you were right.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as react (see limits)
  • Idempotency-Key: supported (see Idempotency)
  • operationId: answerMcq

Parameters

NameInRequiredDescription
idpathYesThe numeric id of the item.

Request body

Send Content-Type: application/json.

Example

cURL
curl -X POST "https://urnextdoor.com/api/v1/mcqs/41/answer" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "option_id": 402
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/mcqs/41/answer", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    option_id: 402,
  }),
});
console.log(res.status, await res.json());
Python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/mcqs/41/answer",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "option_id": 402,
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'option_id' => 402,
];

$ch = curl_init('https://urnextdoor.com/api/v1/mcqs/41/answer');
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;

Responses

StatusMeaningCodes
200 OK{is_correct, correct_option_id, options}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Report content

POST https://urnextdoor.com/api/v1/reports

Report a member or an item to the moderators.

  • Auth: your API key (Bearer or X-API-Key)
  • Scope: engage
  • Daily quota: counts as report (see limits)
  • Idempotency-Key: supported (see Idempotency)
  • operationId: reportContent

Request body

Send Content-Type: application/json.

Example

cURL
curl -X POST "https://urnextdoor.com/api/v1/reports" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "type": "post",
  "id": 41,
  "reason": "spam"
}'
JavaScript
const res = await fetch("https://urnextdoor.com/api/v1/reports", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    type: "post",
    id: 41,
    reason: "spam",
  }),
});
console.log(res.status, await res.json());
Python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/reports",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "type": "post",
        "id": 41,
        "reason": "spam",
    },
    timeout=30,
)
print(response.status_code, response.json())
PHP
<?php
$apiKey = getenv('UND_API_KEY');

$payload = [
    'type' => 'post',
    'id' => 41,
    'reason' => 'spam',
];

$ch = curl_init('https://urnextdoor.com/api/v1/reports');
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;

Responses

StatusMeaningCodes
200 OK{reported}.
400 Bad RequestThe body is not a JSON object, or the Idempotency-Key header is malformed.invalid_json, invalid_idempotency_key
401 UnauthorizedNo key, or the key is unknown, malformed, revoked or expired, or the member is not active.missing_api_key, invalid_api_key
403 ForbiddenThe key lacks the scope, or the member may not do this.insufficient_scope, forbidden
404 Not FoundUnknown route or item, or the item is not yours.not_found
409 ConflictConflicts with the current state, or the same Idempotency-Key is still being processed.conflict, idempotency_in_progress
413 Payload Too LargeThe body is over the limit, or the image is over 8 MB.payload_too_large
415 Unsupported Media TypeWrong Content-Type, or a file type that is not allowed.unsupported_media_type
421 Misdirected RequestCalled on a community subdomain. Use https://urnextdoor.com.wrong_host
422 Unprocessable ContentField errors, or an Idempotency-Key reused with a different body.validation_failed, idempotency_key_reused
429 Too Many RequestsOver 60 requests a minute from this member (or too many failed key checks from one address), or today's quota for this action is used up.rate_limited, quota_exceeded
500 Internal Server ErrorOur fault. Safe to retry with the same Idempotency-Key.server_error
503 Service UnavailableThe API is switched off.api_disabled

Last updated