Appearance
GET legal_entities/[id]/documents
Retrieve documents for a specific legal entity.
Endpoint
GET /api/v1/legal_entities/{id}/documentsAuthentication
This endpoint accepts:
- a standard API key (
sk-) - an Agent Key (
ak-) with theagent:entity.documents.readscope
Send the key in the Authorization header:
text
Authorization: Bearer <your-api-key-or-agent-key>Agent Keys can use this endpoint only when they already know the legal entity ID. There is currently no agent-capable /api/v1/legal_entities list endpoint, and /api/v1/me/legal-entities* remains OAuth-only. Agent Keys can only access entities whose underlying residency application was created via the API (residencyApplication.createdViaAPI === true); requests against any other entity return a 404.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | Yes | The unique identifier of the legal entity |
Example Request
bash
curl -X GET https://portal.eprospera.com/api/v1/legal_entities/7c7397bc-bd67-4f7d-90fe-318b667595cc/documents \
-H "Authorization: Bearer <your-api-key-or-agent-key>"Response
Success Response (200 OK)
| Field | Type | Description |
|---|---|---|
data | array | Array of document objects |
Document Object Fields
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Document unique identifier |
name | string | Document name |
createdAt | string | Creation timestamp (ISO 8601) |
slug | string | Document slug |
version | number | Document version |
fileUrl | string | URL to access the document file |
Example Response
json
{
"data": [
{
"id": "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d",
"name": "Certificate of Formation",
"createdAt": "2024-01-15T10:30:00.000Z",
"slug": "certificate-of-formation",
"version": 1,
"fileUrl": "https://example.com/documents/cert.pdf"
}
]
}Pagination
This endpoint is not currently paginated. The full result set is returned in a single response under data. Treat this as the current contract; in the future a pagination envelope (page/pageSize/totalCount/pageCount, matching /api/v1/nomadlayer/applications) may be added — design clients so an additional top-level pagination field would not break them. See Conventions → Pagination.
Error Responses
401 Unauthorized
Invalid or missing API key:
json
{
"error": "Invalid API key"
}403 Forbidden
Agent Key missing the required agent:entity.documents.read scope:
json
{
"error": "Insufficient permissions"
}404 Not Found
Legal entity not found or you don't have access:
json
{
"error": "Legal entity not found"
}500 Internal Server Error
Server error:
json
{
"error": "Internal server error"
}Access Control
You can only access documents for legal entities where you are a representative.