# Reviews

> 3 endpoints: send a post for review, approve a post, reject a post.

- [Send a post for review](#send-a-post-for-review): `POST /v1/posts/{post_id}/review`
- [Approve a post](#approve-a-post): `POST /v1/posts/{post_id}/review/approve`
- [Reject a post](#reject-a-post): `POST /v1/posts/{post_id}/review/reject`

### Send a post for review

`POST /v1/posts/{post_id}/review`

Asks the Project's reviewers to approve a draft. Optionally assign a person or a Team.

Permission: `posts:write` · Accepts `Idempotency-Key` · Answers `201`

#### Path parameters

| Name | Description |
| --- | --- |
| `post_id` | The post's id. |

#### Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `assigned_user_id` | string | No |  (up to 128 characters) |
| `assigned_team_id` | string | No |  (up to 128 characters) |

#### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | `"post_review"` | Yes |  |
| `post_id` | string | Yes |  (up to 128 characters) |
| `review_status` | `in_review`, `approved`, `rejected` | Yes |  |

```bash
curl -X POST https://api.nowscale.com/v1/posts/POST_ID/review \
  -H "Authorization: Bearer $NOWSCALE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ ... }'
```

### Approve a post

`POST /v1/posts/{post_id}/review/approve`

Approves the post's open review. Send expected_revision from the review to make sure you approve the version you checked.

Permission: `reviews:write` · Accepts `Idempotency-Key`

#### Path parameters

| Name | Description |
| --- | --- |
| `post_id` | The post's id. |

#### Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expected_revision` | integer | No |  (0 to 9007199254740991) |
| `reason` | string | No |  (up to 2000 characters) |

#### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | `"post_review"` | Yes |  |
| `post_id` | string | Yes |  (up to 128 characters) |
| `review_status` | `in_review`, `approved`, `rejected` | Yes |  |

```bash
curl -X POST https://api.nowscale.com/v1/posts/POST_ID/review/approve \
  -H "Authorization: Bearer $NOWSCALE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ ... }'
```

### Reject a post

`POST /v1/posts/{post_id}/review/reject`

Rejects the post's open review with an optional reason for its author.

Permission: `reviews:write` · Accepts `Idempotency-Key`

#### Path parameters

| Name | Description |
| --- | --- |
| `post_id` | The post's id. |

#### Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expected_revision` | integer | No |  (0 to 9007199254740991) |
| `reason` | string | No |  (up to 2000 characters) |

#### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | `"post_review"` | Yes |  |
| `post_id` | string | Yes |  (up to 128 characters) |
| `review_status` | `in_review`, `approved`, `rejected` | Yes |  |

```bash
curl -X POST https://api.nowscale.com/v1/posts/POST_ID/review/reject \
  -H "Authorization: Bearer $NOWSCALE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ ... }'
```
