Dokumente
Reisedokumente und offizielle Dokumente eines Crew-Mitglieds abrufen.
Read-only Endpoint
Dokumente können aktuell nur gelesen, nicht via API hochgeladen werden. Der Upload erfolgt über die AeroHR-Oberfläche oder via SFTP-Import.
Dokument-Objekt
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
| id | integer | Optional | Eindeutige Dokument-ID |
| type | enum | Optional | passport | visa | national_id | residence_permit | certificate |
| name | string | Optional | Dokumentenbezeichnungz.B. Reisepass DE |
| number | string | Optional | Dokumentennummerz.B. C01X00T47 |
| country | string | Optional | Ausstellendes Land (ISO 3166-1 alpha-2) |
| issued_date | date | Optional | Ausstellungsdatum |
| expiry_date | date|null | Optional | Ablaufdatum |
| status | enum | Optional | valid | expiring_soon | expired |
| days_until_expiry | integer|null | Optional | Verbleibende Tage bis Ablauf |
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": "Reisepass Deutschland",
"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
}
]
}Auslaufende Dokumente überwachen
document-expiry-check.jsJavaScript
// Alle Crew-Mitglieder auf ablaufende Dokumente prüfen
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)
);
}