Documents
Retrieve travel documents and official documents for a crew member.
Read-only Endpoint
Documents can currently only be read, not uploaded via API. Uploading is done through the AeroHR interface or via SFTP import.
Document Object
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
| id | integer | Optional | Unique document ID |
| type | enum | Optional | passport | visa | national_id | residence_permit | certificate |
| name | string | Optional | Document namez.B. German Passport |
| number | string | Optional | Document numberz.B. C01X00T47 |
| country | string | Optional | Issuing country (ISO 3166-1 alpha-2) |
| issued_date | date | Optional | Issue date |
| expiry_date | date|null | Optional | Expiry date |
| status | enum | Optional | valid | expiring_soon | expired |
| days_until_expiry | integer|null | Optional | Days remaining until expiry |
GET /crew/{id}/documents
GEThttps://api.aeroselect.io/api/v1/crew/crew/{id}/documents
cURLBash
curl "https://api.aeroselect.io/api/v1/crew/crew/201/documents" \
-H "X-API-Key: ak_live_YOUR_KEY"Response 200JSON
{
"data": [
{
"id": 701,
"type": "passport",
"name": "German Passport",
"number": "C01X00T47",
"country": "DE",
"issued_date": "2022-03-15",
"expiry_date": "2032-03-14",
"status": "valid",
"days_until_expiry": 2122
},
{
"id": 702,
"type": "visa",
"name": "US B1/B2 Visa",
"number": "US2024-88123",
"country": "US",
"issued_date": "2024-01-10",
"expiry_date": "2034-01-09",
"status": "valid",
"days_until_expiry": 2788
}
]
}Monitor Expiring Documents
document-expiry-check.jsJavaScript
// Check all crew members for expiring documents
async function checkExpiringDocuments(crewIds, warningDays = 90) {
const expiringDocs = [];
for (const crewId of crewIds) {
const response = await fetch(
`https://api.aeroselect.io/api/v1/crew/crew/${crewId}/documents`,
{ headers: { "X-API-Key": process.env.AEROSELECT_API_KEY } }
);
const { data: docs } = await response.json();
for (const doc of docs) {
if (
doc.days_until_expiry !== null &&
doc.days_until_expiry <= warningDays
) {
expiringDocs.push({ crew_id: crewId, ...doc });
}
}
}
return expiringDocs.sort(
(a, b) => (a.days_until_expiry ?? 0) - (b.days_until_expiry ?? 0)
);
}