# Ask a question

> Post a question on Ur Next Door with the API. Only a title is required; add HTML details, tags, images, a community or a schedule when you need them.

Source: https://docs.urnextdoor.com/guides/create-question/

A question asks members for answers. It needs only a `title` (the question itself); the `body` is optional context. Members answer it on the site, and you can mark it resolved and accept an answer there.

**Endpoint:** `POST /api/v1/questions` · **Scope:** `content` · **Quota:** `question`

## Fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | Yes | The question itself (plain text). |
| `body` | string | No | Optional details as HTML. |
| `tags` | array of string | No | Topic tags, without the leading #. Example: ["water", "home"]. |
| `community_id` | integer | No | Post inside this community. Use an id from GET /communities/postable. You must be an editor (or above) of it. |
| `community` | string | No | Alternative to community_id: the community slug. It is resolved to its id. |
| `featured_image` | string | No | A /storage/... path returned by POST /media (data.url), or any https:// image URL (linked, not copied). |
| `gallery` | array of string | No | Extra images. Each is a /storage/... path from POST /media or an https:// image URL. Up to 12 items. |
| `scheduled_at` | string (date-time) | No | Publish later instead of now. ISO 8601 with an offset or Z, at least 5 minutes and at most 180 days ahead. Stored in UTC. |

## Ask a question now

**cURL**

```bash
curl -X POST "https://urnextdoor.com/api/v1/questions" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "title": "Which plants survive a north facing balcony?",
  "body": "<p>We get about two hours of direct sun. What has worked for you?</p>",
  "tags": [
    "gardening"
  ]
}'
```

**JavaScript**

```js
const res = await fetch("https://urnextdoor.com/api/v1/questions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    title: "Which plants survive a north facing balcony?",
    body: "<p>We get about two hours of direct sun. What has worked for you?</p>",
    tags: ["gardening"],
  }),
});
console.log(res.status, await res.json());
```

**Python**

```python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/questions",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "title": "Which plants survive a north facing balcony?",
        "body": "<p>We get about two hours of direct sun. What has worked for you?</p>",
        "tags": ["gardening"],
    },
    timeout=30,
)
print(response.status_code, response.json())
```

**PHP**

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

$payload = [
    'title' => 'Which plants survive a north facing balcony?',
    'body' => '<p>We get about two hours of direct sun. What has worked for you?</p>',
    'tags' => ['gardening'],
];

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

Sample response: `201 Created`

```json
{
  "ok": true,
  "id": 52,
  "slug": "which-plants-survive-a-north-facing-balcony",
  "url": "/questions/which-plants-survive-a-north-facing-balcony",
  "web_url": "https://urnextdoor.com/questions/which-plants-survive-a-north-facing-balcony",
  "item": {
    "id": 52,
    "type": "question",
    "slug": "which-plants-survive-a-north-facing-balcony"
  },
  "request_id": "9f8e7d6c5b4a3921"
}
```

## Tips for questions that get answers

- Put the whole question in the `title`, ending with a question mark. Keep it under about 150 characters so it reads well in the feed.
- Use the `body` for context: what you tried, where you are, any constraints. It is HTML; see [Format content with HTML](https://docs.urnextdoor.com/guides/formatting.md).
- Add 1 to 3 `tags` so the right people find it.
- Ask inside a community (`community_id` or `community`) when the question is local or specialised. You must be an editor of that community; see [Look up ids](https://docs.urnextdoor.com/guides/lookups.md).

## Schedule a question

**cURL**

```bash
curl -X POST "https://urnextdoor.com/api/v1/questions" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "title": "Which plants survive a north facing balcony?",
  "tags": [
    "gardening"
  ],
  "scheduled_at": "2026-10-20T09:30:00Z"
}'
```

**JavaScript**

```js
const res = await fetch("https://urnextdoor.com/api/v1/questions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    title: "Which plants survive a north facing balcony?",
    tags: ["gardening"],
    scheduled_at: "2026-10-20T09:30:00Z",
  }),
});
console.log(res.status, await res.json());
```

**Python**

```python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/questions",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "title": "Which plants survive a north facing balcony?",
        "tags": ["gardening"],
        "scheduled_at": "2026-10-20T09:30:00Z",
    },
    timeout=30,
)
print(response.status_code, response.json())
```

**PHP**

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

$payload = [
    'title' => 'Which plants survive a north facing balcony?',
    'tags' => ['gardening'],
    'scheduled_at' => '2026-10-20T09:30:00Z',
];

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

Sample response: `201 Created`

```json
{
  "ok": true,
  "id": 52,
  "slug": "which-plants-survive-a-north-facing-balcony",
  "url": "/questions/which-plants-survive-a-north-facing-balcony",
  "web_url": "https://urnextdoor.com/questions/which-plants-survive-a-north-facing-balcony",
  "status": "scheduled",
  "scheduled_at": "2026-10-20T09:30:00Z",
  "item": {
    "id": 52,
    "type": "question",
    "slug": "which-plants-survive-a-north-facing-balcony"
  },
  "request_id": "9f8e7d6c5b4a3921"
}
```

## Add an image

Upload it first with `POST /api/v1/media`, then pass `data.url` as `featured_image`:

**cURL**

```bash
curl -X POST "https://urnextdoor.com/api/v1/questions" \
  -H "Authorization: Bearer $UND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "title": "Which plants survive a north facing balcony?",
  "featured_image": "/storage/aarav/post/cover_3f9a1c2b7d4e_1792054800.webp",
  "tags": [
    "gardening"
  ]
}'
```

**JavaScript**

```js
const res = await fetch("https://urnextdoor.com/api/v1/questions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UND_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    title: "Which plants survive a north facing balcony?",
    featured_image: "/storage/aarav/post/cover_3f9a1c2b7d4e_1792054800.webp",
    tags: ["gardening"],
  }),
});
console.log(res.status, await res.json());
```

**Python**

```python
import os
import uuid

import requests

api_key = os.environ["UND_API_KEY"]

response = requests.post(
    "https://urnextdoor.com/api/v1/questions",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "title": "Which plants survive a north facing balcony?",
        "featured_image": "/storage/aarav/post/cover_3f9a1c2b7d4e_1792054800.webp",
        "tags": ["gardening"],
    },
    timeout=30,
)
print(response.status_code, response.json())
```

**PHP**

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

$payload = [
    'title' => 'Which plants survive a north facing balcony?',
    'featured_image' => '/storage/aarav/post/cover_3f9a1c2b7d4e_1792054800.webp',
    'tags' => ['gardening'],
];

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

Sample response: `201 Created`

```json
{
  "ok": true,
  "id": 52,
  "slug": "which-plants-survive-a-north-facing-balcony",
  "url": "/questions/which-plants-survive-a-north-facing-balcony",
  "web_url": "https://urnextdoor.com/questions/which-plants-survive-a-north-facing-balcony",
  "item": {
    "id": 52,
    "type": "question",
    "slug": "which-plants-survive-a-north-facing-balcony"
  },
  "request_id": "9f8e7d6c5b4a3921"
}
```

## Common errors

| Status and code | Cause | Fix |
| --- | --- | --- |
| `422 validation_failed` | `title` is missing or empty | Send a title |
| `403 forbidden` | You are not an editor of that community | Ask without a community |
| `429 quota_exceeded` | Today's question quota is used up | Wait until 00:00 UTC |

## Next steps

- [Create a poll](https://docs.urnextdoor.com/guides/create-poll.md) when you want votes rather than answers.
- [Schedule content](https://docs.urnextdoor.com/guides/schedule-content.md).
- [Prompt recipes](https://docs.urnextdoor.com/ai/prompt-recipes.md) for asking an agent to draft questions.
