> For the complete documentation index, see [llms.txt](https://docs.corpdev.ai/corpdev.ai-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.corpdev.ai/corpdev.ai-docs/rest-quick-start.md).

# REST quick start

Start with a read-only request to confirm authentication and workspace scope. You need an enabled API workspace and a key with `read` scope. See [API access](https://docs.corpdev.ai/corpdev.ai-docs/api-access-and-authentication).

## List documents

Supply `CORPDEV_API_KEY` through your protected runtime environment, then run:

```sh
curl --fail-with-body --get \
  'https://api.corpdev.ai/v1/public/documents' \
  --header "Authorization: Bearer ${CORPDEV_API_KEY}" \
  --data-urlencode 'limit=10'
```

The response contains a `documents` array and `nextCursor`. The array may be empty even when another page exists, because permissions and filters can remove items from a fetched page. Continue while `nextCursor` is non-null.

```json
{
  "documents": [],
  "nextCursor": null
}
```

This illustrative response represents a finished empty result, not a live account response.

## Read one document

Use a document identifier returned for your key's workspace:

```sh
curl --fail-with-body \
  'https://api.corpdev.ai/v1/public/documents/DOCUMENT_ID' \
  --header "Authorization: Bearer ${CORPDEV_API_KEY}"
```

Do not use a complete browser URL as the identifier. A missing or inaccessible document can return 404; that response does not establish whether another workspace contains it.

## Create a draft

This request writes a document and requires `write` scope plus an allowed role. Use a test workspace for your first attempt.

```sh
curl --fail-with-body \
  'https://api.corpdev.ai/v1/public/documents' \
  --header "Authorization: Bearer ${CORPDEV_API_KEY}" \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: onboarding-draft-001' \
  --data '{"name":"API test memo","markdown":"# Test memo\nSynthetic onboarding content."}'
```

Creation without an Analyst prompt returns a draft with HTTP 201. Adding a non-empty `prompt` requests generation and can consume credits; that path returns HTTP 202 and job information. Keep the returned identifiers and poll the job rather than creating another document to check progress.

Use a unique idempotency key for each distinct creation request. Reuse it only to retry the same request. Do not assume other mutation endpoints support this header.

## Next steps

Read [Documents and generation](https://docs.corpdev.ai/corpdev.ai-docs/documents-generation-and-exports-api) for job polling and export, [Research and sourcing](https://docs.corpdev.ai/corpdev.ai-docs/company-research-and-sourcing-api) for company searches, and [Errors, limits and retries](https://docs.corpdev.ai/corpdev.ai-docs/errors-pagination-and-retries) before integrating a production workflow.
