# Fix PandaDoc "document not found" via API when it's visible in the UI

## TL;DR
Your API credential can't see the document because it's scoped to a different workspace, or you're mixing sandbox and production credentials, or the ID you're passing isn't the document UUID. List documents through the same credential and compare: if the document isn't in the list, it's a scope/environment mismatch; if it is, your ID is wrong.

```text
document not found
```

## Steps
1. Call the document list endpoint with the exact credential your failing call uses.
   Expected: either the document appears (your ID was wrong) or it doesn't (scope or environment mismatch).
2. Check environments: confirm whether the credential is sandbox or production, and that it matches the UI where you see the document.
   Expected: credential environment and UI environment agree.
3. Verify the ID is the document UUID, not a template ID, session ID, or the ID from a different document.
   Expected: the ID matches an entry from the list call in step 1.
4. If the document belongs to another workspace member, have an admin share it or switch to a credential with the right workspace scope, then retry the GET.
   Expected: 200 with the document payload.

## Use this when
- API calls 404 on a PandaDoc document you can open in the web app
- An integration works for some documents but not others
- You recently switched between sandbox and production keys

## Not for this skill when
- The API credential itself is rejected (that's an auth problem)
- Document creation fails (that's a payload problem, not a lookup problem)
- The document opens in the API but renders wrong (that's a content problem)

## Variant phrasings
### pandadoc api 404 document exists in ui
Classic workspace or environment scoping mismatch.
### pandadoc document id not found api
Double-check you're passing the document UUID and not a template ID.
### pandadoc sandbox vs production document not found
Sandbox and production are fully separate; documents don't cross over.

## Why it happens
PandaDoc separates workspaces and environments at the credential level. The web UI shows you everything your user can access across workspaces, but an API credential is scoped narrower. Sandbox and production are entirely separate datastores, so a production document ID is meaningless to a sandbox credential.

## Edge cases
- Deleted or archived documents return the same 404; check the UI's trash and archive views.
- Very recently created documents can lag in list results; retry after a short wait before assuming a scope problem.
- Service-user credentials may need explicit sharing on documents created by humans.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_aeOQ8cu_mLlIhzc7168vsQ
