{"openapi":"3.1.0","info":{"title":"Selfcare API","version":"1.0.0","description":"API pública do Selfcare. Actua sempre em nome de um utilizador e vê exactamente o que ele vê na app. O processamento salarial e os dados de saúde não são expostos.","license":{"name":"Proprietary"}},"servers":[{"url":"https://api.selfcare.work"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Absences","description":"Ausências e férias"},{"name":"Approvals","description":"Aprovações"},{"name":"Me","description":"Eu"},{"name":"Expenses","description":"Despesas"},{"name":"Business trips","description":"Ajudas de custo"},{"name":"Documents","description":"Documentos"},{"name":"Employees","description":"Colaboradores"},{"name":"Teams","description":"Equipas"},{"name":"Webhooks","description":"Avisos assinados quando algo muda (ausências, despesas, documentos, pessoas, equipas). Cada endpoint é de uma pessoa e só recebe o que ela vê no momento da entrega."}],"x-selfcare-scopes":[{"scope":"me:read","sensitive":false},{"scope":"absences:read","sensitive":false},{"scope":"absences:write","sensitive":false},{"scope":"absences:decide","sensitive":false},{"scope":"expenses:read","sensitive":false},{"scope":"expenses:write","sensitive":false},{"scope":"expenses:decide","sensitive":false},{"scope":"trips:read","sensitive":false},{"scope":"trips:write","sensitive":false},{"scope":"trips:decide","sensitive":false},{"scope":"documents:read","sensitive":false},{"scope":"documents:write","sensitive":false},{"scope":"employees:read","sensitive":false},{"scope":"employees:write","sensitive":false},{"scope":"teams:read","sensitive":false},{"scope":"teams:write","sensitive":false},{"scope":"webhooks:manage","sensitive":false},{"scope":"contracts:read","sensitive":true},{"scope":"contracts:write","sensitive":true},{"scope":"compensation:read","sensitive":true},{"scope":"compensation:write","sensitive":true},{"scope":"bank-details:write","sensitive":true}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Chave de API pessoal (`sc_live_…` ou, numa empresa de teste, `sc_test_…`), no cabeçalho `Authorization: Bearer`."}},"schemas":{"AbsenceType":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"code":{"type":"string","example":"FERIAS"},"name":{"type":"string","example":"Férias"},"color":{"type":"string"},"isPaid":{"type":"boolean"},"countsCalendarDays":{"type":"boolean"},"countsAgainstVacation":{"type":"boolean"},"requiresApproval":{"type":"boolean"},"maxDaysPerYear":{"type":["integer","null"]},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","code","name","color","isPaid","countsCalendarDays","countsAgainstVacation","requiresApproval","maxDaysPerYear","createdAt","updatedAt"]},"Error":{"type":"object","properties":{"data":{"type":"null"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["BAD_REQUEST","INVALID_CURSOR","UNAUTHORIZED","PAYMENT_REQUIRED","FORBIDDEN","SCOPE_MISSING","API_BLOCKED","NOT_FOUND","CONFLICT","CONFIRMATION_PENDING","PRECONDITION_FAILED","PRECONDITION_REQUIRED","VALIDATION_ERROR","IDEMPOTENCY_CONFLICT","CHECKSUM_MISMATCH","RATE_LIMITED","INTERNAL_ERROR","SERVICE_UNAVAILABLE"]},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"requestId":{"type":"string"},"docUrl":{"type":"string","format":"uri"}},"required":["code","message","requestId","docUrl"]}},"required":["data","error"]},"EmployeeRef":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"fullName":{"type":"string"},"employeeNumber":{"type":"string"}},"required":["id","fullName","employeeNumber"]},"AbsenceTypeRef":{"type":"object","properties":{"id":{"type":["string","null"],"format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"code":{"type":"string"},"name":{"type":"string"},"color":{"type":"string"}},"required":["id","code","name","color"],"description":"Para quem não pode ver o tipo de uma ausência de saúde, sai com `id` null, código `AUSENCIA` e nome `Ausência`, como na app."},"Absence":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"employee":{"$ref":"#/components/schemas/EmployeeRef"},"absenceType":{"$ref":"#/components/schemas/AbsenceTypeRef"},"startDate":{"type":"string","format":"date","example":"2026-10-16"},"endDate":{"type":"string","format":"date","example":"2026-10-16"},"startHalfDay":{"type":"boolean"},"endHalfDay":{"type":"boolean"},"workingDays":{"type":"number"},"reason":{"type":["string","null"],"description":"Só para quem o vê na app: administradores, o próprio e os aprovadores."},"status":{"type":"string","enum":["DRAFT","PENDING","APPROVED","REJECTED","CANCELLED","PENDING_CANCELLATION"]},"source":{"type":"string"},"submittedAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"decidedAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"cancellationRequestedAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"approvals":{"type":"array","items":{"type":"object","properties":{"approverId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"viaTeams":{"type":"string"},"decision":{"type":["string","null"]},"decidedAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"comment":{"type":["string","null"]}},"required":["approverId","viaTeams","decision","decidedAt","comment"]}},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","employee","absenceType","startDate","endDate","startHalfDay","endHalfDay","workingDays","reason","status","source","submittedAt","decidedAt","cancellationRequestedAt","approvals","createdAt","updatedAt"],"description":"Nunca leva o anexo (atestado)."},"VacationBalance":{"type":"object","properties":{"employeeId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"year":{"type":"integer"},"entitled":{"type":"number","description":"Direito do ano (pro-rata no ano de admissão)."},"carriedOver":{"type":"number","description":"Transitados do ano anterior."},"used":{"type":"number","description":"Gozados (aprovados e já passados)."},"scheduled":{"type":"number","description":"Marcados (aprovados futuros e pendentes)."},"available":{"type":"number","description":"Por gozar: direito + transitados − gozados − marcados."},"carryRemaining":{"type":"number"},"carryWindowOpen":{"type":"boolean"},"carryDeadline":{"type":"string","example":"30/04"}},"required":["employeeId","year","entitled","carriedOver","used","scheduled","available","carryRemaining","carryWindowOpen","carryDeadline"]},"ApprovalItem":{"type":"object","properties":{"id":{"type":"string","description":"`<kind>:<id do recurso>`, estável."},"kind":{"type":"string","enum":["absence","absence_cancellation","expense","business_trip","document_review"]},"resourceId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"employee":{"$ref":"#/components/schemas/EmployeeRef"},"summary":{"type":"string","description":"Datas, valor ou título; sem dados de saúde."},"viaTeams":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","kind","resourceId","employee","summary","viaTeams","createdAt"]},"MobileDevice":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"platform":{"type":"string","enum":["ios","android"]},"locale":{"type":"string","enum":["pt","en"],"description":"Idioma das notificações deste telefone (pt ou en)."},"appVersion":{"type":["string","null"]},"app":{"type":["object","null"],"properties":{"clientId":{"type":"string"},"name":{"type":"string"}},"required":["clientId","name"],"description":"A app OAuth que registou o dispositivo."},"lastSeenAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","platform","locale","appVersion","app","lastSeenAt","createdAt","updatedAt"]},"MobileDeviceDeleted":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"deleted":{"type":"boolean","enum":[true]}},"required":["id","deleted"]},"MeSummary":{"type":"object","properties":{"vacationBalance":{"anyOf":[{"$ref":"#/components/schemas/VacationBalance"},{"type":"null"}],"description":"Saldo de férias do ano corrente (âmbito absences:read)."},"upcomingAbsences":{"type":["array","null"],"items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"startDate":{"type":"string"},"endDate":{"type":"string"},"status":{"type":"string"},"workingDays":{"type":"number"}},"required":["id","startDate","endDate","status","workingDays"]},"description":"As próximas 5 ausências, pedidas ou aprovadas (âmbito absences:read)."},"approvalsPending":{"type":["integer","null"],"description":"Pedidos na caixa de Aprovações à espera da minha decisão (âmbito absences:read)."},"documentsToAcknowledge":{"type":["integer","null"],"description":"Documentos à espera de que confirme a leitura (âmbito documents:read)."},"bankDetailsConfirmationPending":{"type":"boolean"},"unreadNotifications":{"type":"integer"}},"required":["vacationBalance","upcomingAbsences","approvalsPending","documentsToAcknowledge","bankDetailsConfirmationPending","unreadNotifications"]},"ExpenseAttachment":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"fileName":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"type":"integer"},"amountCents":{"type":"integer"}},"required":["id","fileName","contentType","sizeBytes","amountCents"]},"Expense":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"employee":{"$ref":"#/components/schemas/EmployeeRef"},"date":{"type":"string","format":"date","example":"2026-10-16"},"description":{"type":"string"},"category":{"type":"string","enum":["MEALS","TRANSPORT","FUEL_TOLLS","ACCOMMODATION","TECHNOLOGY","OFFICE","TRAINING","REPRESENTATION","OTHER"]},"amountCents":{"type":"integer"},"currency":{"type":"string","enum":["EUR"],"example":"EUR"},"status":{"type":"string","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PAID","CANCELLED"]},"rejectionNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"decidedAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"decidedByName":{"type":["string","null"]},"paidAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/ExpenseAttachment"}},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","employee","date","description","category","amountCents","currency","status","rejectionNote","submittedAt","decidedAt","decidedByName","paidAt","attachments","createdAt","updatedAt"]},"FileLink":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"URL pré-assinado de GET, válido 5 minutos. Usar já; não guardar nem partilhar."},"expiresAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"fileName":{"type":"string"},"contentType":{"type":"string"}},"required":["url","expiresAt","fileName","contentType"]},"ExpenseCategory":{"type":"object","properties":{"code":{"type":"string","enum":["MEALS","TRANSPORT","FUEL_TOLLS","ACCOMMODATION","TECHNOLOGY","OFFICE","TRAINING","REPRESENTATION","OTHER"]},"name":{"type":"string"}},"required":["code","name"]},"BusinessTrip":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"employee":{"$ref":"#/components/schemas/EmployeeRef"},"destination":{"type":"string"},"purpose":{"type":"string"},"departureAt":{"type":"string","description":"Hora local de Portugal, sem fuso.","example":"2026-10-05T09:00"},"returnAt":{"type":"string","example":"2026-10-06T18:30"},"abroad":{"type":"boolean"},"status":{"type":"string","enum":["SUBMITTED","APPROVED","REJECTED","CANCELLED"]},"mode":{"type":"string"},"nights":{"type":"integer"},"legalPercent":{"type":"integer"},"currency":{"type":"string","enum":["EUR"],"example":"EUR"},"amountCents":{"type":"integer"},"exemptAmountCents":{"type":"integer"},"taxableAmountCents":{"type":"integer"},"submittedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"decidedAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"decidedByName":{"type":["string","null"]},"rejectionNote":{"type":["string","null"]},"paidAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","employee","destination","purpose","departureAt","returnAt","abroad","status","mode","nights","legalPercent","currency","amountCents","exemptAmountCents","taxableAmountCents","submittedAt","decidedAt","decidedByName","rejectionNote","paidAt","createdAt","updatedAt"]},"DocumentType":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"code":{"type":"string","example":"PAYSLIP"},"name":{"type":"string"},"scope":{"type":"string","enum":["PERSON","TEAM","ORGANIZATION"]},"hasExpiry":{"type":"boolean"},"requiresAck":{"type":"boolean"},"system":{"type":"boolean"},"active":{"type":"boolean"}},"required":["id","code","name","scope","hasExpiry","requiresAck","system","active"]},"DocumentVersion":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"number":{"type":"integer"},"fileName":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"type":"integer"},"sha256":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","number","fileName","contentType","sizeBytes","sha256","createdAt"]},"Document":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"title":{"type":"string"},"type":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"]},"space":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"kind":{"type":"string","enum":["PERSON","TEAM","ORGANIZATION"]},"employeeId":{"type":["string","null"],"format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"teamId":{"type":["string","null"],"format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"}},"required":["id","kind","employeeId","teamId"]},"ownerEmployeeId":{"type":["string","null"],"format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"folder":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"name":{"type":"string"}},"required":["id","name"]},"visibility":{"type":"string","enum":["PRIVATE","TEAM","SHARED","COMPANY"]},"status":{"type":"string","enum":["PENDING_REVIEW","ACTIVE","REJECTED"]},"origin":{"type":"string"},"expiresAt":{"type":["string","null"],"format":"date","example":"2026-10-16"},"period":{"type":["string","null"],"description":"Recibos de vencimento: o mês.","example":"2026-09"},"ackRequested":{"type":"boolean"},"ackDueDate":{"type":["string","null"],"format":"date","example":"2026-10-16"},"currentVersion":{"anyOf":[{"$ref":"#/components/schemas/DocumentVersion"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","title","type","space","ownerEmployeeId","folder","visibility","status","origin","expiresAt","period","ackRequested","ackDueDate","currentVersion","createdAt","updatedAt"]},"DocumentRequirement":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"type":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"]},"requiresExpiry":{"type":"boolean"},"active":{"type":"boolean"}},"required":["id","type","requiresExpiry","active"]},"DocumentChecklistItem":{"type":"object","properties":{"requirementId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"type":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"]},"state":{"type":"string","enum":["MISSING","PENDING_REVIEW","MISSING_EXPIRY","EXPIRED","EXPIRING","VALID"]},"documentId":{"type":["string","null"],"format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"expiresAt":{"type":["string","null"],"format":"date","example":"2026-10-16"},"daysLeft":{"type":["integer","null"]}},"required":["requirementId","type","state","documentId","expiresAt","daysLeft"]},"UploadUrl":{"type":"object","properties":{"url":{"type":"string","description":"URL pré-assinado para o PUT dos bytes (15 minutos)."},"method":{"type":"string","enum":["PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Cabeçalhos que o PUT tem de levar."},"ticket":{"type":"string","description":"Bilhete para confirmar o upload (30 minutos)."},"expiresAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["url","method","headers","ticket","expiresAt"]},"Deleted":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"deleted":{"type":"boolean","enum":[true]}},"required":["id","deleted"]},"TeamRef":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"name":{"type":"string"}},"required":["id","name"]},"Employee":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"employeeNumber":{"type":"string"},"externalCode":{"type":["string","null"],"description":"Código no ERP; só para quem vê dados pessoais."},"fullName":{"type":"string"},"preferredName":{"type":["string","null"]},"workEmail":{"type":["string","null"]},"workPhone":{"type":["string","null"]},"jobTitle":{"type":["string","null"]},"status":{"type":"string","enum":["ACTIVE","ON_LEAVE","TERMINATED","ARCHIVED"]},"kind":{"type":"string"},"photoUrl":{"type":["string","null"]},"workLocation":{"type":["string","null"]},"locationId":{"type":["string","null"],"format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"teams":{"type":"array","items":{"$ref":"#/components/schemas/TeamRef"}},"personalEmail":{"type":["string","null"],"description":"Para colegas, só com o consentimento da pessoa."},"phone":{"type":["string","null"]},"personalData":{"type":["object","null"],"properties":{"dateOfBirth":{"type":["string","null"],"format":"date","example":"2026-10-16"},"nationality":{"type":["string","null"]},"nif":{"type":["string","null"]},"niss":{"type":["string","null"]},"citizenCardNumber":{"type":["string","null"]},"citizenCardExpiry":{"type":["string","null"],"format":"date","example":"2026-10-16"},"iban":{"type":["string","null"],"description":"Sempre mascarado (só os últimos 4 dígitos), nas listas e no detalhe."},"swiftBic":{"type":["string","null"]},"address":{"type":"object","properties":{"street":{"type":["string","null"]},"city":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"country":{"type":["string","null"]}},"required":["street","city","postalCode"]},"fiscalAddress":{"type":"object","properties":{"street":{"type":["string","null"]},"city":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"country":{"type":["string","null"]}},"required":["street","city","postalCode"]},"emergencyContact":{"type":"object","properties":{"name":{"type":["string","null"]},"relation":{"type":["string","null"]},"phone":{"type":["string","null"]}},"required":["name","relation","phone"]}},"required":["dateOfBirth","nationality","nif","niss","citizenCardNumber","citizenCardExpiry","iban","swiftBic","address","fiscalAddress","emergencyContact"],"description":"Só para dono, RH, contabilista e o próprio; null para os outros."},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","employeeNumber","externalCode","fullName","preferredName","workEmail","workPhone","jobTitle","status","kind","photoUrl","workLocation","locationId","teams","personalEmail","phone","personalData","createdAt","updatedAt"]},"Contract":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"employeeId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"effectiveFrom":{"type":"string","format":"date","example":"2026-10-16"},"effectiveTo":{"type":["string","null"],"format":"date","example":"2026-10-16"},"reason":{"type":"string","enum":["HIRING","RENEWAL","CONVERSION_TO_PERMANENT","CONVERSION_FROM_SERVICE_PROVIDER","CHANGE_OF_HOURS","OTHER"]},"contractType":{"type":"string","enum":["PERMANENT","FIXED_TERM","UNCERTAIN_TERM","INTERNSHIP","SERVICE_PROVIDER"]},"startDate":{"type":"string","format":"date","example":"2026-10-16"},"endDate":{"type":["string","null"],"format":"date","example":"2026-10-16"},"probationEndDate":{"type":["string","null"],"format":"date","example":"2026-10-16"},"weeklyHours":{"type":"number"},"vacationDaysPerYear":{"type":"integer"},"ccts":{"type":["string","null"]},"notes":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","employeeId","effectiveFrom","effectiveTo","reason","contractType","startDate","endDate","probationEndDate","weeklyHours","vacationDaysPerYear","ccts","notes","createdAt"]},"Compensation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"employeeId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"effectiveFrom":{"type":"string","format":"date","example":"2026-10-16"},"effectiveTo":{"type":["string","null"],"format":"date","example":"2026-10-16"},"reason":{"type":"string","enum":["HIRING","RAISE","PROMOTION","ADJUSTMENT","ROLE_CHANGE","BENEFITS_REVIEW"]},"currency":{"type":"string","enum":["EUR"],"example":"EUR"},"baseSalaryMonthlyCents":{"type":"integer"},"salaryPaidMonths":{"type":"integer"},"mealAllowanceDailyCents":{"type":"integer"},"mealAllowanceForm":{"type":"string"},"seniorityBonusCents":{"type":"integer"},"coverflexMonthlyCents":{"type":["integer","null"]},"expenseAllowanceCents":{"type":["integer","null"]},"workingTimeExemption":{"type":"object","properties":{"enabled":{"type":"boolean"},"modality":{"type":["string","null"],"enum":["NOT_SUBJECT_TO_PNT_LIMITS","EXTENDED_DAILY_OR_WEEKLY","PNT_OBSERVED"]},"compensationMode":{"type":["string","null"],"enum":["PERCENT_OF_BASE","HOURS_PER_DAY","HOURS_PER_WEEK","FIXED_MONTHLY"]},"compensationValue":{"type":["number","null"],"description":"Percentagem do vencimento base, horas ou euros por mês, conforme o modo de cálculo."},"agreementDate":{"type":["string","null"],"format":"date","example":"2026-10-16"}},"required":["enabled","modality","compensationMode","compensationValue","agreementDate"],"description":"Isenção de horário de trabalho (CT arts. 218.º e 219.º)."},"external":{"type":["object","null"],"properties":{"rateType":{"type":["string","null"]},"rateAmountCents":{"type":["integer","null"]},"unitsPerMonth":{"type":["number","null"]},"vacationPaid":{"type":["boolean","null"]},"absencesPaid":{"type":["boolean","null"]},"monthsPaidPerYear":{"type":["integer","null"]}},"required":["rateType","rateAmountCents","unitsPerMonth","vacationPaid","absencesPaid","monthsPaidPerYear"]},"notes":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","employeeId","effectiveFrom","effectiveTo","reason","currency","baseSalaryMonthlyCents","salaryPaidMonths","mealAllowanceDailyCents","mealAllowanceForm","seniorityBonusCents","coverflexMonthlyCents","expenseAllowanceCents","workingTimeExemption","external","notes","createdAt"]},"PendingBankDetailsChange":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"employeeId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"status":{"type":"string","enum":["PENDING","CONFIRMED","REJECTED","EXPIRED","CANCELLED"],"description":"PENDING até o colaborador decidir. CONFIRMED aplica o IBAN; REJECTED, CANCELLED e EXPIRED deixam o anterior."},"ibanMasked":{"type":"string","description":"Mascarado: só os últimos 4 dígitos.","example":"****0154"},"requestedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"expiresAt":{"type":"string","format":"date-time","description":"Até quando o colaborador pode confirmar. Nunca entra em vigor sozinha.","example":"2026-10-16T09:30:00.000Z"},"decidedAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","employeeId","status","ibanMasked","requestedAt","expiresAt","decidedAt"]},"Me":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"email":{"type":"string"},"name":{"type":["string","null"]}},"required":["id","email","name"]},"tenant":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"name":{"type":"string"},"slug":{"type":["string","null"]},"timeZone":{"type":"string"},"sandbox":{"type":"boolean"}},"required":["id","name","slug","timeZone","sandbox"]},"role":{"type":"string","example":"HR_ADMIN"},"employee":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"fullName":{"type":"string"},"preferredName":{"type":["string","null"]},"employeeNumber":{"type":"string"},"jobTitle":{"type":["string","null"]},"photoUrl":{"type":["string","null"]},"status":{"type":"string","enum":["ACTIVE","ON_LEAVE","TERMINATED","ARCHIVED"]},"kind":{"type":"string"},"workEmail":{"type":["string","null"]},"teams":{"type":"array","items":{"$ref":"#/components/schemas/TeamRef"}}},"required":["id","fullName","preferredName","employeeNumber","jobTitle","photoUrl","status","kind","workEmail","teams"]},"ledTeams":{"type":"array","items":{"$ref":"#/components/schemas/TeamRef"}},"credential":{"type":"object","properties":{"type":{"type":"string","enum":["api_key","oauth"]},"scopes":{"type":"array","items":{"type":"string","enum":["me:read","absences:read","absences:write","absences:decide","expenses:read","expenses:write","expenses:decide","trips:read","trips:write","trips:decide","documents:read","documents:write","employees:read","employees:write","teams:read","teams:write","webhooks:manage","contracts:read","contracts:write","compensation:read","compensation:write","bank-details:write"]}},"environment":{"type":"string","enum":["LIVE","TEST"]}},"required":["type","scopes","environment"]}},"required":["user","tenant","role","employee","ledTeams","credential"]},"Team":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"name":{"type":"string"},"description":{"type":["string","null"]},"color":{"type":"string"},"leader":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"fullName":{"type":"string"},"employeeNumber":{"type":"string"}},"required":["id","fullName","employeeNumber"]},"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"fullName":{"type":"string"},"employeeNumber":{"type":"string"},"jobTitle":{"type":["string","null"]}},"required":["id","fullName","employeeNumber","jobTitle"]}},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","name","description","color","leader","members","createdAt","updatedAt"]},"BankDetailsUpdate":{"type":"object","properties":{"employeeId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"outcome":{"type":"string","enum":["APPLIED","PENDING_CONFIRMATION"],"description":"APPLIED: era o primeiro IBAN e ficou gravado. PENDING_CONFIRMATION: mudança de um IBAN existente, à espera do colaborador na app."},"ibanMasked":{"type":["string","null"],"description":"O IBAN em vigor na ficha, mascarado (só os últimos 4 dígitos).","example":"****0154"},"pending":{"anyOf":[{"$ref":"#/components/schemas/PendingBankDetailsChange"},{"type":"null"}]}},"required":["employeeId","outcome","ibanMasked","pending"]},"TeamDeleted":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"deleted":{"type":"boolean","enum":[true]}},"required":["id","deleted"]},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"url":{"type":"string","example":"https://erp.example.pt/selfcare/webhooks"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string","enum":["absence.created","absence.updated","absence.approved","absence.rejected","absence.cancellation_requested","absence.cancelled","expense.submitted","expense.approved","expense.rejected","expense.paid","expense.cancelled","business_trip.submitted","business_trip.approved","business_trip.rejected","business_trip.cancelled","document.created","document.version_created","document.deleted","document.acknowledged","document.expiring","document.expired","document.review_requested","document.reviewed","employee.created","employee.updated","employee.status_changed","employee.contract_changed","employee.compensation_changed","employee.bank_details_change_requested","employee.bank_details_changed","employee.bank_details_change_rejected","team.created","team.updated","team.deleted","team.member_added","team.member_removed"]}},"status":{"type":"string","enum":["ACTIVE","DISABLED"]},"failingSince":{"type":["string","null"],"format":"date-time","description":"Desde quando as entregas falham sem interrupção. Ao fim de 3 dias o endpoint desliga-se e o dono é avisado.","example":"2026-10-16T09:30:00.000Z"},"disabledAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"disabledReason":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","url","description","events","status","failingSince","disabledAt","disabledReason","createdAt","updatedAt"]},"WebhookEndpointWithSecret":{"allOf":[{"$ref":"#/components/schemas/WebhookEndpoint"},{"type":"object","properties":{"secret":{"type":["string","null"],"description":"O segredo para verificar a assinatura (Selfcare-Signature). Só aparece nesta resposta; ao repetir com a mesma Idempotency-Key vem null.","example":"whsec_…"}},"required":["secret"]}]},"WebhookEndpointDeleted":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"deleted":{"type":"boolean","enum":[true]}},"required":["id","deleted"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"endpointId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"eventId":{"type":"string","format":"uuid","example":"3f1c2b8e-5d0a-4c1e-9f8a-2b7d6e5c4a10"},"eventType":{"type":"string","enum":["absence.created","absence.updated","absence.approved","absence.rejected","absence.cancellation_requested","absence.cancelled","expense.submitted","expense.approved","expense.rejected","expense.paid","expense.cancelled","business_trip.submitted","business_trip.approved","business_trip.rejected","business_trip.cancelled","document.created","document.version_created","document.deleted","document.acknowledged","document.expiring","document.expired","document.review_requested","document.reviewed","employee.created","employee.updated","employee.status_changed","employee.contract_changed","employee.compensation_changed","employee.bank_details_change_requested","employee.bank_details_changed","employee.bank_details_change_rejected","team.created","team.updated","team.deleted","team.member_added","team.member_removed","webhook.test"]},"status":{"type":"string","enum":["PENDING","SUCCEEDED","FAILED","SKIPPED"],"description":"PENDING (a tentar), SUCCEEDED (2xx), FAILED (8 tentativas sem 2xx) ou SKIPPED (o dono já não vê o recurso, perdeu o acesso ou o endpoint foi desligado)."},"attempts":{"type":"integer"},"lastAttemptAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"nextAttemptAt":{"type":["string","null"],"format":"date-time","example":"2026-10-16T09:30:00.000Z"},"responseStatus":{"type":["integer","null"]},"responseBodyExcerpt":{"type":["string","null"],"description":"Os primeiros 2 KB da resposta do teu servidor."},"durationMs":{"type":["integer","null"]},"error":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"},"updatedAt":{"type":"string","format":"date-time","example":"2026-10-16T09:30:00.000Z"}},"required":["id","endpointId","eventId","eventType","status","attempts","lastAttemptAt","nextAttemptAt","responseStatus","responseBodyExcerpt","durationMs","error","createdAt","updatedAt"]}},"parameters":{}},"paths":{"/v1/absence-types":{"get":{"operationId":"listAbsenceTypes","tags":["Absences"],"summary":"Tipos de ausência da empresa","description":"Âmbito: `absences:read`.","security":[{"bearerAuth":["absences:read"]}],"x-selfcare-scope":"absences:read","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AbsenceType"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/absences":{"get":{"operationId":"listAbsences","tags":["Absences"],"summary":"Ausências que o utilizador vê na app","description":"Sobreposição com o intervalo `from`–`to`. Os rascunhos só aparecem ao próprio.\n\nÂmbito: `absences:read`.","security":[{"bearerAuth":["absences:read"]}],"x-selfcare-scope":"absences:read","parameters":[{"schema":{"type":"string","format":"date","example":"2026-10-01"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","format":"date","example":"2026-10-01"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","description":"Valores separados por vírgulas.","example":"APPROVED,PENDING"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"employeeId","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"teamId","in":"query"},{"schema":{"type":"string","format":"date-time","example":"2026-10-01T00:00:00Z"},"required":false,"name":"updatedSince","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Absence"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createAbsence","tags":["Absences"],"summary":"Marcar uma ausência","description":"Para si (sem employeeId) ou, se for RH, dono ou líder do visado, para outra pessoa. A mesma validação da app: saldo de férias, dias úteis pela escala e feriados, dias bloqueados, máximo anual do tipo. Não deixa marcar por cima de outra ausência da mesma pessoa.\n\nÂmbito: `absences:write`.","security":[{"bearerAuth":["absences:write"]}],"x-selfcare-scope":"absences:write","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"employeeId":{"type":"string","format":"uuid","description":"Por omissão, a ficha de quem usa a credencial."},"absenceTypeCode":{"type":"string","minLength":1,"maxLength":60,"example":"FERIAS"},"startDate":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-02"},"endDate":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-06"},"startHalfDay":{"type":"boolean","description":"Meio-dia no primeiro dia."},"endHalfDay":{"type":"boolean","description":"Meio-dia no último dia."},"reason":{"type":"string","maxLength":2000},"forceBlocked":{"type":"boolean","description":"Dono e RH: marcar férias por cima de um período bloqueado (fica registado)."}},"required":["absenceTypeCode","startDate","endDate"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Absence"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/absences/{id}":{"get":{"operationId":"getAbsence","tags":["Absences"],"summary":"Uma ausência","description":"Âmbito: `absences:read`.","security":[{"bearerAuth":["absences:read"]}],"x-selfcare-scope":"absences:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Absence"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateAbsence","tags":["Absences"],"summary":"Corrigir um pedido pendente","description":"Só enquanto ninguém decidiu nada. Valida tudo de novo e recomeça a cadeia de aprovação. Aceita If-Match.\n\nÂmbito: `absences:write`.","security":[{"bearerAuth":["absences:write"]}],"x-selfcare-scope":"absences:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"absenceTypeCode":{"type":"string","minLength":1,"maxLength":60,"example":"FERIAS"},"startDate":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-02"},"endDate":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-06"},"startHalfDay":{"type":"boolean","description":"Meio-dia no primeiro dia."},"endHalfDay":{"type":"boolean","description":"Meio-dia no último dia."},"reason":{"type":"string","maxLength":2000},"forceBlocked":{"type":"boolean","description":"Dono e RH: marcar férias por cima de um período bloqueado (fica registado)."}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Absence"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/absences/{id}/approve":{"post":{"operationId":"approveAbsence","tags":["Absences"],"summary":"Aprovar uma ausência","description":"A regra da app: o aprovador decide a sua linha (ALL ou ANY); RH e dono por cima, nunca as próprias (excepto o dono).\n\nÂmbito: `absences:decide`.","security":[{"bearerAuth":["absences:decide"]}],"x-selfcare-scope":"absences:decide","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"comment":{"type":"string","maxLength":1000}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Absence"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/absences/{id}/reject":{"post":{"operationId":"rejectAbsence","tags":["Absences"],"summary":"Rejeitar uma ausência","description":"A mesma regra de aprovar.\n\nÂmbito: `absences:decide`.","security":[{"bearerAuth":["absences:decide"]}],"x-selfcare-scope":"absences:decide","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"comment":{"type":"string","maxLength":1000}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Absence"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/absences/{id}/cancel":{"post":{"operationId":"cancelAbsence","tags":["Absences"],"summary":"Cancelar uma ausência","description":"Um pedido pendente cancela-se logo. Uma ausência aprovada cancela-se logo ou fica com o cancelamento à espera de aprovação (PENDING_CANCELLATION), como na app.\n\nÂmbito: `absences:write`.","security":[{"bearerAuth":["absences:write"]}],"x-selfcare-scope":"absences:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Absence"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/vacation-balance":{"get":{"operationId":"getVacationBalance","tags":["Absences"],"summary":"Saldo de férias de um colaborador","description":"Para quem vê as ausências da pessoa na app.\n\nÂmbito: `absences:read`.","security":[{"bearerAuth":["absences:read"]}],"x-selfcare-scope":"absences:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":2000,"maximum":2100},"required":false,"name":"year","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/VacationBalance"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/approvals":{"get":{"operationId":"listApprovals","tags":["Approvals"],"summary":"A caixa de Aprovações do utilizador","description":"O que o utilizador tem para decidir, como na app. Despesas, deslocações e documentos só aparecem se a credencial tiver `expenses:read`, `trips:read` e `documents:read`.\n\nÂmbito: `absences:read`.","security":[{"bearerAuth":["absences:read"]}],"x-selfcare-scope":"absences:read","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalItem"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/me/devices":{"get":{"operationId":"listMyDevices","tags":["Me"],"summary":"Os meus dispositivos","description":"Os telefones de quem pede registados para notificações push, nesta empresa. O token de push nunca volta.\n\nÂmbito: `me:read`.","security":[{"bearerAuth":["me:read"]}],"x-selfcare-scope":"me:read","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MobileDevice"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"registerMyDevice","tags":["Me"],"summary":"Registar um dispositivo para push","description":"Só com um token OAuth: o dispositivo fica preso a essa sessão, e terminar a sessão (revogar o refresh token) ou revogar a app desliga-o. Chame-o em cada arranque da app: o mesmo token de push actualiza o registo. O token guarda-se cifrado; sem cifra configurada, 503. Um token de push que passe para outra pessoa deixa de receber os avisos da anterior.\n\nÂmbito: `me:read`.","security":[{"bearerAuth":["me:read"]}],"x-selfcare-scope":"me:read","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"platform":{"type":"string","enum":["ios","android"]},"pushToken":{"type":"string","minLength":8,"maxLength":4096,"description":"O token do APNs (iOS) ou do FCM (Android). Guarda-se cifrado e nunca volta numa resposta."},"locale":{"type":["string","null"],"maxLength":35,"example":"pt-PT"},"appVersion":{"type":["string","null"],"maxLength":40,"example":"1.0.0 (42)"}},"required":["platform","pushToken"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MobileDevice"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Serviço indisponível (por exemplo, sem a chave de cifra configurada)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/me/devices/{id}":{"delete":{"operationId":"deleteMyDevice","tags":["Me"],"summary":"Apagar um dispositivo","description":"Deixa de receber push. O dispositivo de outra pessoa é 404.\n\nÂmbito: `me:read`.","security":[{"bearerAuth":["me:read"]}],"x-selfcare-scope":"me:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MobileDeviceDeleted"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/me/summary":{"get":{"operationId":"getMySummary","tags":["Me"],"summary":"Resumo para o ecrã inicial","description":"Saldo de férias, próximas ausências, pedidos à espera da minha decisão, documentos para ler, IBAN por confirmar e avisos por ler, numa só chamada. Cada bloco segue o âmbito do endpoint que o lê por inteiro e vem null sem ele.\n\nÂmbito: `me:read`.","security":[{"bearerAuth":["me:read"]}],"x-selfcare-scope":"me:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeSummary"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses":{"get":{"operationId":"listExpenses","tags":["Expenses"],"summary":"Despesas que o utilizador vê na app","description":"As do próprio (incluindo rascunhos); as da equipa para quem lidera; as da empresa para dono, RH e contabilista. Lista vazia com o módulo desligado.\n\nÂmbito: `expenses:read`.","security":[{"bearerAuth":["expenses:read"]}],"x-selfcare-scope":"expenses:read","parameters":[{"schema":{"type":"string","description":"Valores separados por vírgulas.","example":"APPROVED,PAID"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"employeeId","in":"query"},{"schema":{"type":"string","format":"date","example":"2026-10-01"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","format":"date","example":"2026-10-01"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","format":"date-time","example":"2026-10-01T00:00:00Z"},"required":false,"name":"updatedSince","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Expense"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createExpense","tags":["Expenses"],"summary":"Criar uma despesa (rascunho)","description":"Do próprio, ou em nome de alguém por quem gere as despesas. Depois juntam-se os recibos e submete-se.\n\nÂmbito: `expenses:write`.","security":[{"bearerAuth":["expenses:write"]}],"x-selfcare-scope":"expenses:write","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"employeeId":{"type":"string","format":"uuid","description":"Em nome de outra pessoa: só quem gere as despesas."},"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-10-15"},"description":{"type":"string","maxLength":200},"category":{"type":"string","enum":["MEALS","TRANSPORT","FUEL_TOLLS","ACCOMMODATION","TECHNOLOGY","OFFICE","TRAINING","REPRESENTATION","OTHER"]}},"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses/{id}":{"get":{"operationId":"getExpense","tags":["Expenses"],"summary":"Uma despesa","description":"Âmbito: `expenses:read`.","security":[{"bearerAuth":["expenses:read"]}],"x-selfcare-scope":"expenses:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateExpense","tags":["Expenses"],"summary":"Editar uma despesa","description":"Rascunhos e rejeitadas. Aceita If-Match.\n\nÂmbito: `expenses:write`.","security":[{"bearerAuth":["expenses:write"]}],"x-selfcare-scope":"expenses:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-10-15"},"description":{"type":"string","maxLength":200},"category":{"type":"string","enum":["MEALS","TRANSPORT","FUEL_TOLLS","ACCOMMODATION","TECHNOLOGY","OFFICE","TRAINING","REPRESENTATION","OTHER"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses/{id}/attachments/{attachmentId}/content":{"get":{"operationId":"getExpenseAttachmentContent","tags":["Expenses"],"summary":"Descarregar um anexo de despesa","description":"Devolve um URL pré-assinado válido durante 5 minutos, nunca um redireccionamento.\n\nÂmbito: `expenses:read`.","security":[{"bearerAuth":["expenses:read"]}],"x-selfcare-scope":"expenses:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"attachmentId","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FileLink"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expense-categories":{"get":{"operationId":"listExpenseCategories","tags":["Expenses"],"summary":"Categorias de despesa","description":"O nome vem na língua do `Accept-Language`.\n\nÂmbito: `expenses:read`.","security":[{"bearerAuth":["expenses:read"]}],"x-selfcare-scope":"expenses:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ExpenseCategory"}},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/business-trips":{"get":{"operationId":"listBusinessTrips","tags":["Business trips"],"summary":"Deslocações (ajudas de custo) que o utilizador vê na app","description":"Lista vazia com o módulo desligado.\n\nÂmbito: `trips:read`.","security":[{"bearerAuth":["trips:read"]}],"x-selfcare-scope":"trips:read","parameters":[{"schema":{"type":"string","description":"Valores separados por vírgulas.","example":"APPROVED"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"employeeId","in":"query"},{"schema":{"type":"string","format":"date","example":"2026-10-01"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","format":"date","example":"2026-10-01"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","format":"date-time","example":"2026-10-01T00:00:00Z"},"required":false,"name":"updatedSince","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BusinessTrip"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createBusinessTrip","tags":["Business trips"],"summary":"Registar uma deslocação","description":"Do próprio. Registar é submeter; o valor sai da política da empresa ou à mão.\n\nÂmbito: `trips:write`.","security":[{"bearerAuth":["trips:write"]}],"x-selfcare-scope":"trips:write","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"destination":{"type":"string","minLength":2,"maxLength":200},"purpose":{"type":"string","minLength":3,"maxLength":500},"departureAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$","description":"Hora local de Portugal, sem fuso.","example":"2026-10-05T09:00"},"returnAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$","example":"2026-10-06T18:30"},"abroad":{"type":"boolean"},"distanceConfirmed":{"type":"boolean","enum":[true],"description":"Confirma a distância mínima da lei (20 km sem pernoita, 50 km com)."},"manualAmountCents":{"type":"integer","exclusiveMinimum":0,"maximum":1000000,"description":"Valor à mão, em cêntimos; sem ele, o cálculo da política."}},"required":["destination","purpose","departureAt","returnAt","abroad","distanceConfirmed"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BusinessTrip"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/business-trips/{id}":{"get":{"operationId":"getBusinessTrip","tags":["Business trips"],"summary":"Uma deslocação","description":"Âmbito: `trips:read`.","security":[{"bearerAuth":["trips:read"]}],"x-selfcare-scope":"trips:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BusinessTrip"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateBusinessTrip","tags":["Business trips"],"summary":"Corrigir uma deslocação","description":"Ainda por decidir, ou rejeitada (volta a ser submetida). Aceita If-Match.\n\nÂmbito: `trips:write`.","security":[{"bearerAuth":["trips:write"]}],"x-selfcare-scope":"trips:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"destination":{"type":"string","minLength":2,"maxLength":200},"purpose":{"type":"string","minLength":3,"maxLength":500},"departureAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$","description":"Hora local de Portugal, sem fuso.","example":"2026-10-05T09:00"},"returnAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$","example":"2026-10-06T18:30"},"abroad":{"type":"boolean"},"distanceConfirmed":{"type":"boolean","enum":[true],"description":"Confirma a distância mínima da lei (20 km sem pernoita, 50 km com)."},"manualAmountCents":{"type":"integer","exclusiveMinimum":0,"maximum":1000000,"description":"Valor à mão, em cêntimos; sem ele, o cálculo da política."}},"required":["destination","purpose","departureAt","returnAt","abroad","distanceConfirmed"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BusinessTrip"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/document-types":{"get":{"operationId":"listDocumentTypes","tags":["Documents"],"summary":"Tipos de documento","description":"Sem os tipos de saúde nem os disciplinares.\n\nÂmbito: `documents:read`.","security":[{"bearerAuth":["documents:read"]}],"x-selfcare-scope":"documents:read","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentType"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/documents":{"get":{"operationId":"listDocuments","tags":["Documents"],"summary":"Documentos que o utilizador vê na app","description":"Cada documento passa pela mesma regra de acesso da app. Os de saúde e os disciplinares nunca aparecem.\n\nÂmbito: `documents:read`.","security":[{"bearerAuth":["documents:read"]}],"x-selfcare-scope":"documents:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"employeeId","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"spaceId","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":60,"example":"PAYSLIP"},"required":false,"name":"typeKey","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$","example":"2026-09"},"required":false,"name":"period","in":"query"},{"schema":{"type":"string","format":"date","example":"2026-10-01"},"required":false,"name":"expiresBefore","in":"query"},{"schema":{"type":"string","format":"date-time","example":"2026-10-01T00:00:00Z"},"required":false,"name":"updatedSince","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createDocument","tags":["Documents"],"summary":"Criar um documento","description":"Confirma o upload com o bilhete, confere o sha256, o tamanho e o tipo real. Um recibo de vencimento da mesma pessoa e mês fica como versão nova.\n\nÂmbito: `documents:write`.","security":[{"bearerAuth":["documents:write"]}],"x-selfcare-scope":"documents:write","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"string","minLength":10},"title":{"type":"string","maxLength":200},"expiresAt":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"visibility":{"type":"string","enum":["PRIVATE","TEAM","SHARED","COMPANY"]},"requestAck":{"type":"boolean"}},"required":["ticket"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/documents/{id}":{"get":{"operationId":"getDocument","tags":["Documents"],"summary":"Um documento","description":"Âmbito: `documents:read`.","security":[{"bearerAuth":["documents:read"]}],"x-selfcare-scope":"documents:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateDocument","tags":["Documents"],"summary":"Editar um documento","description":"Título ou validade, quando a app o deixa. Aceita If-Match.\n\nÂmbito: `documents:write`.","security":[{"bearerAuth":["documents:write"]}],"x-selfcare-scope":"documents:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"expiresAt":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteDocument","tags":["Documents"],"summary":"Apagar um documento","description":"Quando a app o deixa. Aceita If-Match.\n\nÂmbito: `documents:write`.","security":[{"bearerAuth":["documents:write"]}],"x-selfcare-scope":"documents:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deleted"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/documents/{id}/versions":{"get":{"operationId":"listDocumentVersions","tags":["Documents"],"summary":"Versões de um documento","description":"Âmbito: `documents:read`.","security":[{"bearerAuth":["documents:read"]}],"x-selfcare-scope":"documents:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentVersion"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createDocumentVersion","tags":["Documents"],"summary":"Carregar uma versão nova","description":"Âmbito: `documents:write`.","security":[{"bearerAuth":["documents:write"]}],"x-selfcare-scope":"documents:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"string","minLength":10},"expiresAt":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["ticket"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/documents/{id}/versions/{versionId}/content":{"get":{"operationId":"getDocumentVersionContent","tags":["Documents"],"summary":"Descarregar uma versão","description":"Devolve um URL pré-assinado válido durante 5 minutos e regista o acesso (origem API).\n\nÂmbito: `documents:read`.","security":[{"bearerAuth":["documents:read"]}],"x-selfcare-scope":"documents:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"versionId","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FileLink"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/document-requirements":{"get":{"operationId":"listDocumentRequirements","tags":["Documents"],"summary":"Documentos obrigatórios da empresa","description":"Sem os de saúde nem os disciplinares.\n\nÂmbito: `documents:read`.","security":[{"bearerAuth":["documents:read"]}],"x-selfcare-scope":"documents:read","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentRequirement"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/document-checklist":{"get":{"operationId":"getDocumentChecklist","tags":["Documents"],"summary":"Estado dos documentos obrigatórios de um colaborador","description":"Para o próprio e para quem gere documentos (dono, RH, contabilista). Sem itens de saúde.\n\nÂmbito: `documents:read`.","security":[{"bearerAuth":["documents:read"]}],"x-selfcare-scope":"documents:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentChecklistItem"}},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses/{id}/attachments/upload-url":{"post":{"operationId":"createExpenseAttachmentUpload","tags":["Expenses"],"summary":"Pedir o URL para um recibo","description":"Devolve um URL de PUT (15 minutos) e um bilhete (30 minutos). PDF, JPEG, PNG ou WebP, até 10 MB, como na app.\n\nÂmbito: `expenses:write`.","security":[{"bearerAuth":["expenses:write"]}],"x-selfcare-scope":"expenses:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","minLength":1,"maxLength":200,"example":"image/jpeg"},"sizeBytes":{"type":"integer","minimum":1},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$","description":"sha256 dos bytes, em hexadecimal; confere-se ao confirmar."}},"required":["fileName","contentType","sizeBytes","sha256"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UploadUrl"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses/{id}/attachments":{"post":{"operationId":"addExpenseAttachment","tags":["Expenses"],"summary":"Juntar um recibo","description":"Depois do PUT. Confere o sha256 declarado e o tipo real pelos bytes.\n\nÂmbito: `expenses:write`.","security":[{"bearerAuth":["expenses:write"]}],"x-selfcare-scope":"expenses:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"string","minLength":10},"amountCents":{"type":"integer","minimum":0,"maximum":1000000}},"required":["ticket","amountCents"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses/{id}/attachments/{attachmentId}":{"patch":{"operationId":"updateExpenseAttachment","tags":["Expenses"],"summary":"Corrigir o valor de um recibo","description":"Âmbito: `expenses:write`.","security":[{"bearerAuth":["expenses:write"]}],"x-selfcare-scope":"expenses:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"attachmentId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amountCents":{"type":"integer","minimum":0,"maximum":1000000}},"required":["amountCents"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteExpenseAttachment","tags":["Expenses"],"summary":"Tirar um recibo","description":"Âmbito: `expenses:write`.","security":[{"bearerAuth":["expenses:write"]}],"x-selfcare-scope":"expenses:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"attachmentId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses/{id}/submit":{"post":{"operationId":"submitExpense","tags":["Expenses"],"summary":"Submeter para reembolso","description":"As mesmas verificações da app e o mesmo aviso a quem decide.\n\nÂmbito: `expenses:write`.","security":[{"bearerAuth":["expenses:write"]}],"x-selfcare-scope":"expenses:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses/{id}/cancel":{"post":{"operationId":"cancelExpense","tags":["Expenses"],"summary":"Cancelar uma despesa","description":"Enquanto não está paga nem num lote de pagamento.\n\nÂmbito: `expenses:write`.","security":[{"bearerAuth":["expenses:write"]}],"x-selfcare-scope":"expenses:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses/{id}/approve":{"post":{"operationId":"approveExpense","tags":["Expenses"],"summary":"Aprovar uma despesa","description":"RH, dono, contabilista e líderes dos membros; as próprias, só o dono.\n\nÂmbito: `expenses:decide`.","security":[{"bearerAuth":["expenses:decide"]}],"x-selfcare-scope":"expenses:decide","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/expenses/{id}/reject":{"post":{"operationId":"rejectExpense","tags":["Expenses"],"summary":"Rejeitar uma despesa","description":"Com a nota obrigatória, que o colaborador vê.\n\nÂmbito: `expenses:decide`.","security":[{"bearerAuth":["expenses:decide"]}],"x-selfcare-scope":"expenses:decide","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","minLength":3,"maxLength":1000}},"required":["note"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Expense"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/business-trips/{id}/cancel":{"post":{"operationId":"cancelBusinessTrip","tags":["Business trips"],"summary":"Cancelar uma deslocação","description":"Âmbito: `trips:write`.","security":[{"bearerAuth":["trips:write"]}],"x-selfcare-scope":"trips:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BusinessTrip"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/business-trips/{id}/approve":{"post":{"operationId":"approveBusinessTrip","tags":["Business trips"],"summary":"Aprovar uma deslocação","description":"Âmbito: `trips:decide`.","security":[{"bearerAuth":["trips:decide"]}],"x-selfcare-scope":"trips:decide","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BusinessTrip"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/business-trips/{id}/reject":{"post":{"operationId":"rejectBusinessTrip","tags":["Business trips"],"summary":"Rejeitar uma deslocação","description":"Com a nota obrigatória.\n\nÂmbito: `trips:decide`.","security":[{"bearerAuth":["trips:decide"]}],"x-selfcare-scope":"trips:decide","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","minLength":3,"maxLength":1000}},"required":["note"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BusinessTrip"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/uploads":{"post":{"operationId":"createUpload","tags":["Documents"],"summary":"Pedir o URL para um documento","description":"Documento novo, versão nova ou recibo de vencimento (só quem gere documentos). Tipos de saúde e disciplinares são recusados.\n\nÂmbito: `documents:write`.","security":[{"bearerAuth":["documents:write"]}],"x-selfcare-scope":"documents:write","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["document"]},"typeKey":{"type":"string","minLength":1,"maxLength":60,"example":"CONTRACT"},"employeeId":{"type":"string","format":"uuid","description":"Pasta da pessoa."},"spaceId":{"type":"string","format":"uuid","description":"Ou um espaço (equipa, empresa)."},"folderId":{"type":"string","format":"uuid"}},"required":["kind","typeKey"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["version"]},"documentId":{"type":"string","format":"uuid"}},"required":["kind","documentId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["payslip"]},"employeeId":{"type":"string","format":"uuid"},"period":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$","example":"2026-09"}},"required":["kind","employeeId","period"],"additionalProperties":false}]},"fileName":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","minLength":1,"maxLength":200,"example":"image/jpeg"},"sizeBytes":{"type":"integer","minimum":1},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$","description":"sha256 dos bytes, em hexadecimal; confere-se ao confirmar."}},"required":["target","fileName","contentType","sizeBytes","sha256"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UploadUrl"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/documents/{id}/acknowledge":{"post":{"operationId":"acknowledgeDocument","tags":["Documents"],"summary":"Confirmar a leitura","description":"Da versão atual, quando foi pedida.\n\nÂmbito: `documents:write`.","security":[{"bearerAuth":["documents:write"]}],"x-selfcare-scope":"documents:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees":{"get":{"operationId":"listEmployees","tags":["Employees"],"summary":"Colaboradores (diretório)","description":"Procurar por `nif` é só para quem vê dados pessoais.\n\nÂmbito: `employees:read`.","security":[{"bearerAuth":["employees:read"]}],"x-selfcare-scope":"employees:read","parameters":[{"schema":{"type":"string","minLength":2,"maxLength":100,"description":"Texto a procurar no nome, nome preferido, email de trabalho e número de colaborador (e no email pessoal, para quem vê dados pessoais)."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Valores separados por vírgulas.","example":"ACTIVE,ON_LEAVE"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"teamId","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":50},"required":false,"name":"employeeNumber","in":"query"},{"schema":{"type":"string","pattern":"^\\d{9}$"},"required":false,"name":"nif","in":"query"},{"schema":{"type":"string","format":"date-time","example":"2026-10-01T00:00:00Z"},"required":false,"name":"updatedSince","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Employee"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createEmployee","tags":["Employees"],"summary":"Criar um colaborador","description":"A mesma acção e a mesma validação do ecrã Novo colaborador (dono, RH ou gestor). Cria o contrato inicial com a data de entrada e, com convite, envia-o por email. O salário não se define aqui: usa POST /employees/{id}/compensation.\n\nÂmbito: `employees:write`.","security":[{"bearerAuth":["employees:write"]}],"x-selfcare-scope":"employees:write","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"employeeNumber":{"type":"string","minLength":1,"maxLength":20,"description":"Sem ele, o próximo número livre (EMP-0001, EMP-0002...)."},"fullName":{"type":"string","minLength":1,"maxLength":200},"preferredName":{"type":["string","null"],"maxLength":100},"personalEmail":{"type":["string","null"],"format":"email"},"workEmail":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":30},"kind":{"type":"string","enum":["INTERNAL","EXTERNAL"]},"accessRole":{"type":"string","enum":["EMPLOYEE","MANAGER","HR_ADMIN","ACCOUNTANT"],"description":"Perfil de acesso da conta. Acima de EMPLOYEE, só o dono e o RH o podem dar."},"contractType":{"type":"string","enum":["PERMANENT","FIXED_TERM","UNCERTAIN_TERM","INTERNSHIP","SERVICE_PROVIDER"]},"startDate":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"jobTitle":{"type":["string","null"],"maxLength":120},"teamIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50},"workLocation":{"type":["string","null"],"enum":["ON_SITE","HYBRID","REMOTE"]},"external":{"type":"object","properties":{"rateType":{"type":"string","enum":["HOURLY","DAILY","MONTHLY"]},"rateAmountCents":{"type":"integer","minimum":1,"maximum":100000000},"unitsPerMonth":{"type":["number","null"],"minimum":0,"maximum":400},"vacationPaid":{"type":["boolean","null"]},"absencesPaid":{"type":["boolean","null"]},"monthsPaidPerYear":{"type":["integer","null"],"minimum":1,"maximum":14}},"required":["rateType","rateAmountCents"],"additionalProperties":false,"description":"Tarifa de um prestador de serviços. É remuneração: pede também o âmbito compensation:write e só dono e RH."},"sendInvite":{"type":"boolean","description":"Envia o convite para o email pessoal; o email profissional passa a ser o de entrada na app."}},"required":["fullName","startDate"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Employee"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}":{"get":{"operationId":"getEmployee","tags":["Employees"],"summary":"Um colaborador","description":"Âmbito: `employees:read`.","security":[{"bearerAuth":["employees:read"]}],"x-selfcare-scope":"employees:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Employee"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateEmployee","tags":["Employees"],"summary":"Editar a ficha de um colaborador","description":"Muda só os campos enviados, pelas regras da ficha na app. Quem não pode escrever nada na pessoa recebe 404. If-Match opcional (412 se a ficha mudou).\n\nÂmbito: `employees:write`.","security":[{"bearerAuth":["employees:write"]}],"x-selfcare-scope":"employees:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fullName":{"type":"string","minLength":1,"maxLength":200},"preferredName":{"type":["string","null"],"maxLength":100},"personalEmail":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":30},"gender":{"type":["string","null"],"enum":["FEMALE","MALE","OTHER"]},"dateOfBirth":{"type":["string","null"],"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"nationality":{"type":["string","null"],"maxLength":60},"nif":{"type":["string","null"],"pattern":"^\\d{9}$"},"niss":{"type":["string","null"],"pattern":"^\\d{11}$"},"citizenCardNumber":{"type":["string","null"],"maxLength":30},"citizenCardExpiry":{"type":["string","null"],"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"address":{"type":"object","properties":{"street":{"type":["string","null"],"maxLength":200},"city":{"type":["string","null"],"maxLength":100},"postalCode":{"type":["string","null"],"maxLength":20},"country":{"type":["string","null"],"maxLength":60}},"additionalProperties":false},"emergencyContact":{"type":"object","properties":{"name":{"type":["string","null"],"maxLength":100},"relation":{"type":["string","null"],"maxLength":60},"phone":{"type":["string","null"],"maxLength":30}},"additionalProperties":false},"jobTitle":{"type":["string","null"],"maxLength":120},"workEmail":{"type":["string","null"],"format":"email"},"workPhone":{"type":["string","null"],"maxLength":30},"externalCode":{"type":["string","null"],"maxLength":40},"locationId":{"type":["string","null"],"format":"uuid"},"teamIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50}},"additionalProperties":false,"description":"Só os campos enviados mudam. Dados pessoais: dono, RH ou o próprio. Profissionais: dono, RH, contabilista ou um líder da pessoa. O IBAN muda-se em PUT /employees/{id}/bank-details."}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Employee"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/contracts":{"get":{"operationId":"listContracts","tags":["Employees"],"summary":"Histórico de contratos de um colaborador","description":"Âmbito sensível, marcado à parte. Para dono, RH, contabilista e o próprio.\n\nÂmbito: `contracts:read` (sensível, marcado à parte).","security":[{"bearerAuth":["contracts:read"]}],"x-selfcare-scope":"contracts:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Contract"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createContract","tags":["Employees"],"summary":"Registar uma alteração de contrato","description":"Âmbito contracts:write, só dono e RH. Motivo obrigatório e Idempotency-Key obrigatória. A entrada vigente fecha na véspera da data de efeito, que tem de ser posterior. Fica no registo de auditoria com o antes e o depois, e o colaborador é avisado.\n\nÂmbito: `contracts:write` (sensível, marcado à parte).","security":[{"bearerAuth":["contracts:write"]}],"x-selfcare-scope":"contracts:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Obrigatória nesta escrita (428 sem ela). Durante 24 horas, repetir com a mesma chave e o mesmo corpo devolve a mesma resposta; com outro corpo, 422."},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"effectiveFrom":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"reason":{"type":"string","enum":["HIRING","RENEWAL","CONVERSION_TO_PERMANENT","CONVERSION_FROM_SERVICE_PROVIDER","CHANGE_OF_HOURS","OTHER"]},"contractType":{"type":"string","enum":["PERMANENT","FIXED_TERM","UNCERTAIN_TERM","INTERNSHIP","SERVICE_PROVIDER"]},"startDate":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"endDate":{"type":["string","null"],"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"probationEndDate":{"type":["string","null"],"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"weeklyHours":{"type":"number","minimum":1,"maximum":60},"vacationDaysPerYear":{"type":"integer","minimum":1,"maximum":50},"ccts":{"type":["string","null"],"maxLength":200},"notes":{"type":["string","null"],"maxLength":2000},"justification":{"type":"string","minLength":3,"maxLength":500,"description":"Motivo da alteração, obrigatório. Fica no registo de auditoria com os valores antes e depois.","example":"Revisão salarial anual aprovada pela administração"}},"required":["effectiveFrom","reason","contractType","startDate","weeklyHours","justification"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contract"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"428":{"description":"Falta o If-Match ou a Idempotency-Key, obrigatórios nesta escrita","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/compensation":{"get":{"operationId":"listCompensation","tags":["Employees"],"summary":"Histórico de remuneração de um colaborador","description":"Âmbito sensível, marcado à parte. Para dono, RH, contabilista e o próprio. Não é processamento salarial.\n\nÂmbito: `compensation:read` (sensível, marcado à parte).","security":[{"bearerAuth":["compensation:read"]}],"x-selfcare-scope":"compensation:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Compensation"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createCompensation","tags":["Employees"],"summary":"Registar uma alteração de remuneração","description":"Âmbito compensation:write, só dono e RH. Motivo obrigatório e Idempotency-Key obrigatória. O subsídio de alimentação é sempre o da empresa. Fica no registo de auditoria com o antes e o depois; o colaborador é avisado na app e por email, sem valores.\n\nÂmbito: `compensation:write` (sensível, marcado à parte).","security":[{"bearerAuth":["compensation:write"]}],"x-selfcare-scope":"compensation:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Obrigatória nesta escrita (428 sem ela). Durante 24 horas, repetir com a mesma chave e o mesmo corpo devolve a mesma resposta; com outro corpo, 422."},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"effectiveFrom":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"reason":{"type":"string","enum":["HIRING","RAISE","PROMOTION","ADJUSTMENT","ROLE_CHANGE","BENEFITS_REVIEW"]},"baseSalaryMonthlyCents":{"type":"integer","minimum":0,"maximum":100000000},"salaryPaidMonths":{"anyOf":[{"type":"number","enum":[12]},{"type":"number","enum":[13]},{"type":"number","enum":[14]}]},"seniorityBonusCents":{"type":"integer","minimum":0,"maximum":100000000},"coverflexMonthlyCents":{"type":["integer","null"],"minimum":0,"maximum":100000000},"expenseAllowanceCents":{"type":["integer","null"],"minimum":0,"maximum":100000000},"workingTimeExemption":{"type":"object","properties":{"enabled":{"type":"boolean"},"modality":{"type":["string","null"],"enum":["NOT_SUBJECT_TO_PNT_LIMITS","EXTENDED_DAILY_OR_WEEKLY","PNT_OBSERVED"]},"compensationMode":{"type":["string","null"],"enum":["PERCENT_OF_BASE","HOURS_PER_DAY","HOURS_PER_WEEK","FIXED_MONTHLY"]},"compensationValue":{"type":["number","null"],"minimum":0,"maximum":100000,"description":"Percentagem do vencimento base, horas ou euros por mês, conforme o modo de cálculo."},"agreementDate":{"type":["string","null"],"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"}},"required":["enabled"],"additionalProperties":false,"description":"Isenção de horário de trabalho (CT arts. 218.º e 219.º)."},"notes":{"type":["string","null"],"maxLength":2000},"justification":{"type":"string","minLength":3,"maxLength":500,"description":"Motivo da alteração, obrigatório. Fica no registo de auditoria com os valores antes e depois.","example":"Revisão salarial anual aprovada pela administração"}},"required":["effectiveFrom","reason","baseSalaryMonthlyCents","salaryPaidMonths","justification"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Compensation"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"428":{"description":"Falta o If-Match ou a Idempotency-Key, obrigatórios nesta escrita","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/bank-details/pending":{"get":{"operationId":"getPendingBankDetails","tags":["Employees"],"summary":"Mudança de IBAN à espera de confirmação","description":"Para quem vê os dados pessoais da pessoa (dono, RH, contabilista e o próprio). A mudança só entra em vigor quando o colaborador a confirma na app. `data` é null quando não há nenhuma pendente.\n\nÂmbito: `employees:read`.","security":[{"bearerAuth":["employees:read"]}],"x-selfcare-scope":"employees:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"anyOf":[{"$ref":"#/components/schemas/PendingBankDetailsChange"},{"type":"null"}]},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"cancelPendingBankDetails","tags":["Employees"],"summary":"Cancelar a mudança de IBAN pendente","description":"O próprio, o dono ou o RH. O IBAN da ficha não muda. Sem pedido pendente, 404.\n\nÂmbito: `bank-details:write` (sensível, marcado à parte).","security":[{"bearerAuth":["bank-details:write"]}],"x-selfcare-scope":"bank-details:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PendingBankDetailsChange"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/me":{"get":{"operationId":"getMe","tags":["Me"],"summary":"Quem é a credencial","description":"Utilizador, empresa (a da credencial), papel, ficha, equipas que lidera e âmbitos.\n\nÂmbito: `me:read`.","security":[{"bearerAuth":["me:read"]}],"x-selfcare-scope":"me:read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Me"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/teams":{"get":{"operationId":"listTeams","tags":["Teams"],"summary":"Equipas","description":"Âmbito: `teams:read`.","security":[{"bearerAuth":["teams:read"]}],"x-selfcare-scope":"teams:read","parameters":[{"schema":{"type":"string","format":"date-time","example":"2026-10-01T00:00:00Z"},"required":false,"name":"updatedSince","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Team"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createTeam","tags":["Teams"],"summary":"Criar uma equipa","description":"Dono, RH ou gestor. Uma equipa tem sempre líder, que não tem de ser membro; o líder aprova as ausências de quem está na equipa.\n\nÂmbito: `teams:write`.","security":[{"bearerAuth":["teams:write"]}],"x-selfcare-scope":"teams:write","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":["string","null"],"maxLength":500},"leaderId":{"type":"string","format":"uuid"},"color":{"type":"string","enum":["slate","blue","green","amber","rose","violet","teal","orange"]}},"required":["name","leaderId"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Team"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/teams/{id}":{"get":{"operationId":"getTeam","tags":["Teams"],"summary":"Uma equipa","description":"Âmbito: `teams:read`.","security":[{"bearerAuth":["teams:read"]}],"x-selfcare-scope":"teams:read","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Team"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateTeam","tags":["Teams"],"summary":"Editar uma equipa","description":"Nome, descrição, cor ou líder. Mudar o líder muda as cadeias de aprovação. If-Match opcional.\n\nÂmbito: `teams:write`.","security":[{"bearerAuth":["teams:write"]}],"x-selfcare-scope":"teams:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":["string","null"],"maxLength":500},"leaderId":{"type":"string","format":"uuid"},"color":{"type":"string","enum":["slate","blue","green","amber","rose","violet","teal","orange"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Team"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteTeam","tags":["Teams"],"summary":"Apagar uma equipa","description":"Como na app: com documentos no espaço da equipa, 409. As pessoas ficam, só deixam de pertencer à equipa.\n\nÂmbito: `teams:write`.","security":[{"bearerAuth":["teams:write"]}],"x-selfcare-scope":"teams:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TeamDeleted"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/archive":{"post":{"operationId":"archiveEmployee","tags":["Employees"],"summary":"Arquivar um colaborador","description":"Dono e RH. Tira a pessoa das listas e dos seletores sem cessar o contrato, como na app. Um colaborador cessado ou já arquivado dá 409.\n\nÂmbito: `employees:write`.","security":[{"bearerAuth":["employees:write"]}],"x-selfcare-scope":"employees:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Employee"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/contracts/{contractId}":{"patch":{"operationId":"updateContract","tags":["Employees"],"summary":"Corrigir uma entrada de contrato","description":"Âmbito contracts:write, só dono e RH. If-Match e motivo obrigatórios. Como na app, só se corrige enquanto não há recibos emitidos (ou num prestador); depois disso regista-se uma entrada nova.\n\nÂmbito: `contracts:write` (sensível, marcado à parte).","security":[{"bearerAuth":["contracts:write"]}],"x-selfcare-scope":"contracts:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"contractId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"Obrigatório nesta escrita (428 sem ele): o ETag que leste no GET. Se o recurso mudou entretanto, 412. O `*` não serve."},"required":true,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"effectiveFrom":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"reason":{"type":"string","enum":["HIRING","RENEWAL","CONVERSION_TO_PERMANENT","CONVERSION_FROM_SERVICE_PROVIDER","CHANGE_OF_HOURS","OTHER"]},"contractType":{"type":"string","enum":["PERMANENT","FIXED_TERM","UNCERTAIN_TERM","INTERNSHIP","SERVICE_PROVIDER"]},"startDate":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"endDate":{"type":["string","null"],"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"probationEndDate":{"type":["string","null"],"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"weeklyHours":{"type":"number","minimum":1,"maximum":60},"vacationDaysPerYear":{"type":"integer","minimum":1,"maximum":50},"ccts":{"type":["string","null"],"maxLength":200},"notes":{"type":["string","null"],"maxLength":2000},"justification":{"type":"string","minLength":3,"maxLength":500,"description":"Motivo da alteração, obrigatório. Fica no registo de auditoria com os valores antes e depois.","example":"Revisão salarial anual aprovada pela administração"}},"required":["justification"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contract"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"428":{"description":"Falta o If-Match ou a Idempotency-Key, obrigatórios nesta escrita","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/compensation/{entryId}":{"patch":{"operationId":"updateCompensation","tags":["Employees"],"summary":"Corrigir uma entrada de remuneração","description":"Âmbito compensation:write, só dono e RH. If-Match e motivo obrigatórios. Muda só os campos enviados; o colaborador é avisado.\n\nÂmbito: `compensation:write` (sensível, marcado à parte).","security":[{"bearerAuth":["compensation:write"]}],"x-selfcare-scope":"compensation:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"entryId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"Obrigatório nesta escrita (428 sem ele): o ETag que leste no GET. Se o recurso mudou entretanto, 412. O `*` não serve."},"required":true,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"effectiveFrom":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"},"reason":{"type":"string","enum":["HIRING","RAISE","PROMOTION","ADJUSTMENT","ROLE_CHANGE","BENEFITS_REVIEW"]},"baseSalaryMonthlyCents":{"type":"integer","minimum":0,"maximum":100000000},"salaryPaidMonths":{"anyOf":[{"type":"number","enum":[12]},{"type":"number","enum":[13]},{"type":"number","enum":[14]}]},"seniorityBonusCents":{"type":"integer","minimum":0,"maximum":100000000},"coverflexMonthlyCents":{"type":["integer","null"],"minimum":0,"maximum":100000000},"expenseAllowanceCents":{"type":["integer","null"],"minimum":0,"maximum":100000000},"workingTimeExemption":{"type":"object","properties":{"enabled":{"type":"boolean"},"modality":{"type":["string","null"],"enum":["NOT_SUBJECT_TO_PNT_LIMITS","EXTENDED_DAILY_OR_WEEKLY","PNT_OBSERVED"]},"compensationMode":{"type":["string","null"],"enum":["PERCENT_OF_BASE","HOURS_PER_DAY","HOURS_PER_WEEK","FIXED_MONTHLY"]},"compensationValue":{"type":["number","null"],"minimum":0,"maximum":100000,"description":"Percentagem do vencimento base, horas ou euros por mês, conforme o modo de cálculo."},"agreementDate":{"type":["string","null"],"format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-11-01"}},"required":["enabled"],"additionalProperties":false,"description":"Isenção de horário de trabalho (CT arts. 218.º e 219.º)."},"external":{"type":"object","properties":{"rateType":{"type":"string","enum":["HOURLY","DAILY","MONTHLY"]},"rateAmountCents":{"type":"integer","minimum":1,"maximum":100000000},"unitsPerMonth":{"type":["number","null"],"minimum":0,"maximum":400},"vacationPaid":{"type":["boolean","null"]},"absencesPaid":{"type":["boolean","null"]},"monthsPaidPerYear":{"type":["integer","null"],"minimum":1,"maximum":14}},"required":["rateType","rateAmountCents"],"additionalProperties":false,"description":"Tarifa de um prestador de serviços. É remuneração: pede também o âmbito compensation:write e só dono e RH."},"notes":{"type":["string","null"],"maxLength":2000},"justification":{"type":"string","minLength":3,"maxLength":500,"description":"Motivo da alteração, obrigatório. Fica no registo de auditoria com os valores antes e depois.","example":"Revisão salarial anual aprovada pela administração"}},"required":["justification"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Compensation"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"428":{"description":"Falta o If-Match ou a Idempotency-Key, obrigatórios nesta escrita","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/bank-details":{"put":{"operationId":"putBankDetails","tags":["Employees"],"summary":"Registar ou pedir a mudança do IBAN","description":"Pode o próprio, o dono ou o RH. Sem IBAN na ficha (onboarding), o primeiro grava logo (`APPLIED`). A mudança de um IBAN existente nunca muda a ficha: cria um pedido pendente, cifrado, que só tem efeito quando o colaborador o confirma na app com um código (`PENDING_CONFIRMATION`); substitui um pedido anterior por confirmar. Para uma mudança: sem conta na app, 409; sem a cifra configurada, 503. A resposta mostra só os últimos 4 dígitos.\n\nÂmbito: `bank-details:write` (sensível, marcado à parte).","security":[{"bearerAuth":["bank-details:write"]}],"x-selfcare-scope":"bank-details:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"iban":{"type":"string","minLength":15,"maxLength":40,"description":"IBAN português (PT50...). Se a pessoa ainda não tem IBAN, grava logo; se já tem, a mudança fica pendente até o colaborador a confirmar na app.","example":"PT50000201231234567890154"},"swiftBic":{"type":["string","null"],"maxLength":11}},"required":["iban"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BankDetailsUpdate"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Serviço indisponível (por exemplo, sem a chave de cifra configurada)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/teams/{id}/members":{"post":{"operationId":"addTeamMember","tags":["Teams"],"summary":"Juntar uma pessoa a uma equipa","description":"Uma pessoa pode estar em várias equipas. Se já for membro, fica igual. Devolve a equipa.\n\nÂmbito: `teams:write`.","security":[{"bearerAuth":["teams:write"]}],"x-selfcare-scope":"teams:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"employeeId":{"type":"string","format":"uuid"}},"required":["employeeId"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Team"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/teams/{id}/members/{employeeId}":{"delete":{"operationId":"removeTeamMember","tags":["Teams"],"summary":"Tirar uma pessoa de uma equipa","description":"Quem não é membro dá 404. Devolve a equipa.\n\nÂmbito: `teams:write`.","security":[{"bearerAuth":["teams:write"]}],"x-selfcare-scope":"teams:write","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"employeeId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Team"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook-endpoints":{"get":{"operationId":"listWebhookEndpoints","tags":["Webhooks"],"summary":"Listar os meus endpoints de webhooks","description":"Só os de quem pede, nesta empresa. O segredo nunca sai aqui.\n\nÂmbito: `webhooks:manage`.","security":[{"bearerAuth":["webhooks:manage"]}],"x-selfcare-scope":"webhooks:manage","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createWebhookEndpoint","tags":["Webhooks"],"summary":"Criar um endpoint de webhooks","description":"Cada entrega é um POST JSON assinado com HMAC-SHA256: Selfcare-Signature: t=<segundos>,v1=<hex de HMAC(segredo, `${t}.${corpo}`)>. Recusa assinaturas com mais de 5 minutos e deduplica pelo id do evento (entrega pelo menos uma vez, sem ordem garantida). Até 8 tentativas em cerca de 24 horas. O evento só leva ids, estado, datas e a empresa; o resto lê-se pela API. O segredo só aparece nesta resposta. Sem cifra configurada, 503.\n\nÂmbito: `webhooks:manage`.","security":[{"bearerAuth":["webhooks:manage"]}],"x-selfcare-scope":"webhooks:manage","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"format":"uri","description":"Só https, porta 443, endereço público (sem redes privadas, loopback nem metadados). Os redireccionamentos não se seguem."},"events":{"type":"array","items":{"type":"string","enum":["absence.created","absence.updated","absence.approved","absence.rejected","absence.cancellation_requested","absence.cancelled","expense.submitted","expense.approved","expense.rejected","expense.paid","expense.cancelled","business_trip.submitted","business_trip.approved","business_trip.rejected","business_trip.cancelled","document.created","document.version_created","document.deleted","document.acknowledged","document.expiring","document.expired","document.review_requested","document.reviewed","employee.created","employee.updated","employee.status_changed","employee.contract_changed","employee.compensation_changed","employee.bank_details_change_requested","employee.bank_details_changed","employee.bank_details_change_rejected","team.created","team.updated","team.deleted","team.member_added","team.member_removed"]},"minItems":1,"maxItems":37,"description":"Os tipos de evento a receber. O webhook.test chega sempre que se pede um teste."},"description":{"type":["string","null"],"maxLength":200}},"required":["url","events"],"additionalProperties":false}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpointWithSecret"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Serviço indisponível (por exemplo, sem a chave de cifra configurada)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook-endpoints/{id}":{"get":{"operationId":"getWebhookEndpoint","tags":["Webhooks"],"summary":"Ver um endpoint de webhooks","description":"Âmbito: `webhooks:manage`.","security":[{"bearerAuth":["webhooks:manage"]}],"x-selfcare-scope":"webhooks:manage","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpoint"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateWebhookEndpoint","tags":["Webhooks"],"summary":"Alterar um endpoint de webhooks","description":"URL, eventos, descrição, ou ligar e desligar. If-Match opcional.\n\nÂmbito: `webhooks:manage`.","security":[{"bearerAuth":["webhooks:manage"]}],"x-selfcare-scope":"webhooks:manage","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2048,"format":"uri","description":"Só https, porta 443, endereço público (sem redes privadas, loopback nem metadados). Os redireccionamentos não se seguem."},"events":{"type":"array","items":{"type":"string","enum":["absence.created","absence.updated","absence.approved","absence.rejected","absence.cancellation_requested","absence.cancelled","expense.submitted","expense.approved","expense.rejected","expense.paid","expense.cancelled","business_trip.submitted","business_trip.approved","business_trip.rejected","business_trip.cancelled","document.created","document.version_created","document.deleted","document.acknowledged","document.expiring","document.expired","document.review_requested","document.reviewed","employee.created","employee.updated","employee.status_changed","employee.contract_changed","employee.compensation_changed","employee.bank_details_change_requested","employee.bank_details_changed","employee.bank_details_change_rejected","team.created","team.updated","team.deleted","team.member_added","team.member_removed"]},"minItems":1,"maxItems":37,"description":"Os tipos de evento a receber. O webhook.test chega sempre que se pede um teste."},"description":{"type":["string","null"],"maxLength":200},"enabled":{"type":"boolean","description":"false desliga; true volta a ligar e recomeça a contagem das falhas."}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpoint"},"error":{"type":"null"}},"required":["data","error"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteWebhookEndpoint","tags":["Webhooks"],"summary":"Apagar um endpoint de webhooks","description":"Apaga também o registo de entregas dele.\n\nÂmbito: `webhooks:manage`.","security":[{"bearerAuth":["webhooks:manage"]}],"x-selfcare-scope":"webhooks:manage","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"},{"schema":{"type":"string","description":"O ETag lido; se o recurso mudou entretanto, 412."},"required":false,"name":"If-Match","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpointDeleted"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"O recurso mudou (If-Match)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook-endpoints/{id}/rotate-secret":{"post":{"operationId":"rotateWebhookSecret","tags":["Webhooks"],"summary":"Rodar o segredo","description":"Devolve o segredo novo, uma vez. Durante 24 horas cada entrega leva duas assinaturas v1 (a nova e a anterior), para trocares sem perder nada.\n\nÂmbito: `webhooks:manage`.","security":[{"bearerAuth":["webhooks:manage"]}],"x-selfcare-scope":"webhooks:manage","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpointWithSecret"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Serviço indisponível (por exemplo, sem a chave de cifra configurada)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook-endpoints/{id}/test":{"post":{"operationId":"testWebhookEndpoint","tags":["Webhooks"],"summary":"Enviar um evento de teste","description":"Manda um webhook.test só a este endpoint (tem de estar ligado; senão 409) e devolve a entrega.\n\nÂmbito: `webhooks:manage`.","security":[{"bearerAuth":["webhooks:manage"]}],"x-selfcare-scope":"webhooks:manage","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookDelivery"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook-endpoints/{id}/deliveries":{"get":{"operationId":"listWebhookDeliveries","tags":["Webhooks"],"summary":"Registo de entregas","description":"Os últimos 30 dias: estado, tentativas, código e primeiros 2 KB da resposta, duração.\n\nÂmbito: `webhooks:manage`.","security":[{"bearerAuth":["webhooks:manage"]}],"x-selfcare-scope":"webhooks:manage","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200,"description":"Itens por página. Por omissão 50, máximo 200."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"O `meta.nextCursor` da página anterior, com os mesmos filtros."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"error":{"type":"null"},"meta":{"type":"object","properties":{"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["nextCursor","hasMore"]}},"required":["data","error","meta"]}}}},"400":{"description":"Pedido mal formado ou cursor inválido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook-deliveries/{id}/redeliver":{"post":{"operationId":"redeliverWebhookDelivery","tags":["Webhooks"],"summary":"Reenviar uma entrega","description":"Cria uma entrega nova do mesmo evento (o mesmo id: deduplica). A visibilidade volta a ser verificada.\n\nÂmbito: `webhooks:manage`.","security":[{"bearerAuth":["webhooks:manage"]}],"x-selfcare-scope":"webhooks:manage","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Até 255 caracteres. Repetir com o mesmo corpo devolve a mesma resposta durante 24 horas."},"required":false,"name":"Idempotency-Key","in":"header"}],"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookDelivery"},"error":{"type":"null"}},"required":["data","error"]}}}},"401":{"description":"Sem credencial válida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Conta da empresa bloqueada por falta de pagamento","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Sem âmbito, sem permissão ou API bloqueada na empresa","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe ou o utilizador não o pode ver","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Estado que não permite a operação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Campos inválidos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos (ver Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro inesperado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{}}