Files
lincodex/api/core/routes/candidate_invitation_decline.yml
T

66 lines
4.2 KiB
YAML

post:
operationId: DeclineMyInvitation
summary: Decline an invitation with a structured reason.
description: |-
Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The candidate comes from the session.
Allowed in `delivered`, `viewed`, and the planned `counter`, before `response_deadline_at`. Moves the invitation to the terminal state `declined` with the reason and the optional comment; no consent and no access arise (PRD FR12). A timely decline counts as an answer for the responsiveness metrics, not as a consent or a hire. The reason is one of InvitationDeclineReason, including the neutral `other`; no reason requires a comment.
Visibility: the organization sees only the state `declined` and `responded_at`. It never sees the reason or the comment of an individual decline, because a reason such as `salary` would tell it that the hidden minimum is above the range. Reasons feed only aggregates with a minimum group size (planned); the comment is never shown to the organization, published, logged, or sent in a notification. The candidate reads both back in `decline`. A new invitation of the same organization to this candidate is possible only after the 30-day pause.
Repeats return the same result: a retry with the same Idempotency-Key replays the stored response, and a decline of an invitation that is already `declined` with the same reason and comment answers 200 with it even with a new key or an older `expected_version`. A terminal state, another reason or comment on a declined invitation, and a command at the deadline or later answer 409 state_conflict even with a stale `expected_version`; otherwise a stale `expected_version` answers 412 version_conflict.
Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for an employer), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the invitation (404 not_found, after any due expiry), the repeat on a declined invitation (200), a terminal state or a passed deadline (409 state_conflict, whatever the version), the version (412), then any other state that does not allow a decline (409 state_conflict). The schema rejects an unknown reason, an empty comment or one of only white space, a comment over 500 characters, and unknown fields. The general rate limit can answer 429 with Retry-After before any check. 404 and 409 state_conflict are stored under the key; 400, 412, and 429 are not.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- invitation
parameters:
- $ref: ../components/parameters.yml#/MyInvitationId
- $ref: ../components/parameters.yml#/IdempotencyKey
requestBody:
required: true
content:
application/json:
schema:
$ref: ../components/schemas.yml#/InvitationDeclineRequest
examples:
other_without_comment:
$ref: ../components/examples.yml#/InvitationDeclineOther
with_comment:
$ref: ../components/examples.yml#/InvitationDeclineWithComment
responses:
"200":
description: >-
The declined invitation with the candidate's own reason, or the same
invitation when this decline was already made.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/CandidateInvitation
examples:
declined:
$ref: ../components/examples.yml#/CandidateInvitationDeclined
"400":
$ref: ../components/responses.yml#/ValidationFailed
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
$ref: ../components/responses.yml#/CsrfCheckFailedOrForbidden
"404":
$ref: ../components/responses.yml#/NotFound
"409":
$ref: ../components/responses.yml#/InvitationCommandConflict
"412":
$ref: ../components/responses.yml#/InvitationVersionConflict
"422":
$ref: ../components/responses.yml#/UnprocessableContent
"429":
$ref: ../components/responses.yml#/TooManyRequests
default:
$ref: ../components/responses.yml#/Problem