# Example: answer listing questions from your website

Send a prospect's question from your website or your own software to Perch. Perch prepares the answer from your listing facts, your team reviews and sends it, and your system reads back the exact reply.

## Before you start

You need a Perch workspace with your listings set up and a connection approved once by your workspace account holder (see Connect your system). Every call sends your access token as `Authorization: Bearer TOKEN`.

## 1. Send the question

```
curl -sS -X POST 'https://perch.gofactai.com/api/v1/messages' \
  -H 'Authorization: Bearer TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: website-chat-1042-1' \
  -d '{
    "from": { "name": "Sam Rivera", "email": "sam.rivera@example.com" },
    "subject": "Unit 1204 at 888 Beach",
    "text": "Hi, is the one-bedroom still available? Are cats allowed, and could I see it Saturday?",
    "conversation": "chat-1042"
  }'
```

Perch answers `202` with the message and its status. Sending the same Idempotency-Key and body again returns the same message.

```
{
  "id": "3d6f1b2c-8a47-4e0b-9c51-2f7d8e6a1b90",
  "status": "received",
  "received_at": "2026-10-04T18:20:00Z",
  "updated_at": "2026-10-04T18:20:00Z",
  "conversation": "chat-1042"
}
```

## 2. Read the result

`GET https://perch.gofactai.com/api/v1/messages/3d6f1b2c-8a47-4e0b-9c51-2f7d8e6a1b90`

Status moves through `received` (waiting to start), `working` (being prepared), `in_review` (waiting for a person), then `replied` (a person sent the reply) or `closed` (no reply from Perch). A replied message includes the exact reply:

```
{
  "id": "3d6f1b2c-8a47-4e0b-9c51-2f7d8e6a1b90",
  "status": "replied",
  "received_at": "2026-10-04T18:20:00Z",
  "updated_at": "2026-10-04T18:41:00Z",
  "conversation": "chat-1042",
  "reply": {
    "subject": "Re: Unit 1204 at 888 Beach",
    "text": "Hi Sam, unit 1204 is still available and one cat is allowed. I can show it Saturday at 11:00 am or 2:00 pm. Which time suits you?",
    "sent_at": "2026-10-04T18:41:00Z",
    "edited_by_team": false
  }
}
```

## 3. Check for changes

`GET https://perch.gofactai.com/api/v1/messages?updated_after=2026-10-04T18:00:00Z` returns up to 50 messages that changed after that time. Pass `next_updated_after` back on your next check.

## What stays with your team

The connection hands work to Perch and reads its status. It cannot approve or send a reply. Your team reviews the draft beside the prospect's question in the workspace and sends it.

## When a call fails

Errors come back as `application/problem+json` with a `code` such as `invalid_request`, `token_expired` or `rate_limited`. On `token_expired`, refresh the token as described in Connect your system and try again. The full shapes are in https://perch.gofactai.com/openapi.json.

## Links

- [Overview](https://perch.gofactai.com/docs/overview.md)
- [Connect your system](https://perch.gofactai.com/docs/connect.md)
- [Example: listing questions](https://perch.gofactai.com/docs/listing-questions.md)
- [Get started](https://perch.gofactai.com/get-started)
- [Privacy](https://perch.gofactai.com/privacy)
- [Contact](mailto:perch@gofactai.com)
- [Blog](https://gofactai.com/blog)
