# consent-info ```yaml openapi: 3.0.3 info: title: Consent Info description: | The Consent Info API allows API Consumers to easily validate whether they have the necessary permissions to process User's personal data for a specific Purpose before using other CAMARA APIs. It provides a simple `true`/`false` response and, when applicable, a URL to direct the User to manage their Consent. # Introduction This API facilitates compliance with privacy regulations and promotes transparency with Users by providing a standardized way to check whether, for example, the User has given their Consent or opted out of data processing. Key inputs include the specific scope(s) of access being requested (i.e. the CAMARA API(s) operations to which the data processing refers), the Purpose for data processing, and a User identifier (either explicitly provided or derived from a three-legged access token). The API responds with the validity status of the data processing, and, when applicable, can provide a capture URL for the API Consumer to manage it. # Relevant terms and definitions * **Consent**: An explicit opt-in action that the User takes to allow processing of personal data. Consent grants the API Consumer access to a set of scopes related to the User for a specific Purpose. * **Purpose**: The reason for which personal data will be processed by an API Consumer. CAMARA defines a standard set of Purposes which can be used by API Consumers to specify the reason for their intended personal data processing. CAMARA uses the [W3C Data Privacy Vocabulary](https://w3c.github.io/dpv/2.0/dpv/) (DPV) to represent these purposes e.g. `dpv:FraudPreventionAndDetection` or `dpv:RequestedServiceProvision`. * **Scope**: A string representing the specific access rights or actions an API Consumer requests from the User for their data (e.g., "location-verification:verify"). A request can contain multiple scopes. # API Functionality This API enables the API Consumer to determine whether their data processing is permitted for a given User, scope(s) and Purpose. Specifically, the API: * **Provides the data processing validity status**: The API returns `statusValidForProcessing`, a boolean flag that indicates whether the requested data processing is currently permitted (`true`) or not (`false`). * **Provides an explanation if invalid**: If data processing is not permitted, the response includes a `statusReason` field to explain why. * **Offers a Capture URL (if requested)**: If the status is not valid because user action is required, and the API Consumer sets `requestCaptureUrl` to `true`, the API will return a `captureUrl` field that can be presented to the User. This URL directs them to the API Provider's secure Consent capture channel, where they can provide or renew their Consent. * **Supports Callback URL**: The API Consumer can optionally provide a `callbackUrl` when requesting a Consent capture URL. This allows the API Provider to redirect the User back to the API Consumer's specified URL once the Consent capture process is completed, along with the outcome of the process. Importantly, this API does NOT delegate Consent capture to the API Consumer but rather empowers the API Consumer to present the API Provider's Consent capture URL at the most opportune time and place. The actual Consent capture occurs within the API Provider's secure environment, ensuring the User's authentication with the API Provider. # Authorization and authentication The "Camara Security and Interoperability Profile" provides details of how an API consumer requests an access token. Please refer to Identity and Consent Management (https://github.com/camaraproject/IdentityAndConsentManagement/) for the released version of the profile. The specific authorization flows to be used will be agreed upon during the onboarding process, happening between the API consumer and the API provider, taking into account the declared Purpose for accessing the API, whilst also being subject to the prevailing legal framework dictated by local legislation. In cases where personal data is processed by the API and users can exercise their rights through mechanisms such as opt-in and/or opt-out, the use of three-legged access tokens is mandatory. This ensures that the API remains in compliance with privacy regulations, upholding the principles of transparency and user-centric privacy-by-design. # Identifying the phone number from the access token This API requires the API consumer to identify a phone number as the subject of the API as follows: - When the API is invoked using a two-legged access token, the subject will be identified from the optional `phoneNumber` field, which therefore MUST be provided. - When a three-legged access token is used however, this optional identifier MUST NOT be provided, as the subject will be uniquely identified from the access token. This approach simplifies API usage for API consumers using a three-legged access token to invoke the API by relying on the information that is associated with the access token and was identified during the authentication process. ## Error handling: - If the subject cannot be identified from the access token and the optional `phoneNumber` field is not included in the request, then the server will return an error with the `422 MISSING_IDENTIFIER` error code. - If the subject can be identified from the access token and the optional `phoneNumber` field is also included in the request, then the server will return an error with the `422 UNNECESSARY_IDENTIFIER` error code. This will be the case even if the same phone number is identified by these two methods, as the server is unable to make this comparison. # Additional CAMARA error responses The list of error codes in this API specification is not exhaustive. Therefore the API specification may not document some non-mandatory error statuses as indicated in `CAMARA API Design Guide`. Please refer to the `CAMARA_common.yaml` of the Commonalities Release associated to this API version for a complete list of error responses. The applicable Commonalities Release can be identified in the `API Readiness Checklist` document associated to this API version. As a specific rule, error `501 - NOT_IMPLEMENTED` can be only a possible error response if it is explicitly documented in the API. # Further info and support (FAQs will be added in a later version of the documentation) license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html version: wip x-camara-commonalities: 0.6 externalDocs: description: Product documentation at CAMARA url: https://github.com/camaraproject/ConsentInfo servers: - url: "{apiRoot}/consent-info/vwip" variables: apiRoot: default: http://localhost:9091 description: API root, defined by the service provider, e.g. `api.example.com` or `api.example.com/somepath` tags: - name: Retrieve Status description: Create a request to retrieve the validity status of the data processing paths: /retrieve: post: summary: Create a request to retrieve the validity status of the data processing description: | Create a request to retrieve the validity status of the API Consumer data processing for a given User, scope(s) and Purpose. The API Consumer is identified by the `client_id` parameter deduced from the access token. operationId: retrieveStatus security: - openId: - consent-info:retrieve tags: - Retrieve Status parameters: - $ref: "#/components/parameters/x-correlator" requestBody: required: true description: Retrieve status request content: application/json: schema: $ref: "#/components/schemas/RetrieveStatusRequestBody" examples: ONE_SCOPE_ONE_API: summary: One scope description: | Request with one scope corresponding to one API value: phoneNumber: "+123456789" scopes: - "location-verification:verify" purpose: "dpv:FraudPreventionAndDetection" requestCaptureUrl: true MULTIPLE_SCOPES_ONE_API: summary: Multiple scopes for one API description: | Request with multiple scopes corresponding to one API value: phoneNumber: "+123456789" scopes: - "quality-on-demand:sessions:create" - "quality-on-demand:sessions:read" - "quality-on-demand:sessions:update" - "quality-on-demand:sessions:delete" - "quality-on-demand:sessions:retrieve-by-device" purpose: "dpv:RequestedServiceProvision" requestCaptureUrl: true MULTIPLE_SCOPES_MULTIPLE_APIS: summary: Multiple scopes for multiple APIs description: | Request with multiple scopes corresponding to multiple APIs value: phoneNumber: "+123456789" scopes: - "location-verification:verify" - "device-roaming-status:read" purpose: "dpv:FraudPreventionAndDetection" requestCaptureUrl: true ONE_SCOPE_CALLBACK_URL: summary: One scope with callback URL description: | Request with one scope corresponding to one API including a callback URL value: phoneNumber: "+123456789" scopes: - "location-verification:verify" purpose: "dpv:FraudPreventionAndDetection" requestCaptureUrl: true callbackUrl: "https://consumer.example.com/consent/callback" responses: "200": description: OK headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: $ref: "#/components/schemas/RetrieveStatusResponseBody" examples: READY_FOR_PROCESSING: summary: Ready for processing description: | Data processing is allowed for the requested scope(s) and Purpose. value: statusInfo: - scopes: - "number-verification:verify" purpose: "dpv:FraudPreventionAndDetection" statusValidForProcessing: true CONSENT_REQUIRED: summary: Consent is required description: | Consent is required for the requested scope(s) and Purpose value: statusInfo: - scopes: - "location-verification:verify" purpose: "dpv:FraudPreventionAndDetection" statusValidForProcessing: false statusReason: REQUESTED CONSENT_REQUIRED_CAPTURE_URL: summary: Consent is required and capture URL is provided description: | Consent is required for the requested scope(s) and Purpose but it is expired. The API Provider provides a Consent capture URL. value: statusInfo: - scopes: - "location-verification:verify" purpose: "dpv:FraudPreventionAndDetection" statusValidForProcessing: false statusReason: EXPIRED expirationDate: "2023-07-03T14:27:08.312+02:00" captureUrl: "https://example.org/consent-capture-url" CONSENT_DENIED: summary: Consent is denied description: | Consent is denied for the requested scope(s) and Purpose. value: statusInfo: - scopes: - "location-verification:verify" purpose: "dpv:FraudPreventionAndDetection" statusValidForProcessing: false statusReason: DENIED DATA_PROCESSING_OPT_OUT: summary: Data processing opt-out description: | The User has opted out of the data processing for the requested scope(s) and Purpose. value: statusInfo: - scopes: - "number-verification:verify" purpose: "dpv:FraudPreventionAndDetection" statusValidForProcessing: false statusReason: OBJECTED MULTIPLE_SCOPES_ONE_API: summary: Multiple scopes for one API description: | Request with multiple scopes corresponding to one API. value: statusInfo: - scopes: - "quality-on-demand:sessions:create" - "quality-on-demand:sessions:read" - "quality-on-demand:sessions:update" - "quality-on-demand:sessions:delete" - "quality-on-demand:sessions:retrieve-by-device" purpose: "dpv:RequestedServiceProvision" statusValidForProcessing: true MULTIPLE_SCOPES_MULTIPLE_APIS: summary: Multiple scopes for multiple APIs description: | Request with multiple scopes corresponding to multiple APIs. value: statusInfo: - scopes: - "location-verification:verify" purpose: "dpv:FraudPreventionAndDetection" statusValidForProcessing: false statusReason: PENDING - scopes: - "device-roaming-status:read" purpose: "dpv:FraudPreventionAndDetection" statusValidForProcessing: false statusReason: PENDING captureUrl: "https://example.org/consent-capture-url" MULTIPLES_SCOPES_ONE_API_DIFFERENT_STATUS: summary: Multiple scopes for one API with different status description: | Request with multiple scopes corresponding to one API. Different status for each scope. value: statusInfo: - scopes: - "sim-swap:check" purpose: "dpv:FraudPreventionAndDetection" statusValidForProcessing: true - scopes: - "sim-swap:retrieve-date" purpose: "dpv:FraudPreventionAndDetection" statusValidForProcessing: false statusReason: OBJECTED "400": $ref: "#/components/responses/Generic400" "401": $ref: "#/components/responses/Generic401" "403": $ref: "#/components/responses/retrieveStatus403" "404": $ref: "#/components/responses/Generic404" "422": $ref: "#/components/responses/Generic422" components: headers: x-correlator: description: Correlation id for the different services schema: $ref: "#/components/schemas/XCorrelator" parameters: x-correlator: name: x-correlator in: header description: Correlation id for the different services schema: $ref: "#/components/schemas/XCorrelator" schemas: XCorrelator: description: Value for the x-correlator type: string pattern: ^[a-zA-Z0-9-_:;.\/<>{}]{0,256}$ example: "b4333c46-49c0-4f62-80d7-f0ef930f1c46" PhoneNumber: type: string description: A public identifier addressing a telephone subscription. In mobile networks it corresponds to the MSISDN (Mobile Station International Subscriber Directory Number). In order to be globally unique it has to be formatted in international format, according to E.164 standard, prefixed with '+'. pattern: '^\+[1-9][0-9]{4,14}$' example: "+123456789" RetrieveStatusRequestBody: type: object description: | The request body for the retrieve status request. It contains the requested scope(s), the Purpose for which the API Consumer intends to process the User's personal data, a flag indicating whether the API Consumer requests a Consent capture URL and optionally the phone number of the User. The phone number is required when the API is invoked using a two-legged access token, but MUST NOT be provided when a three-legged access token is used, as the subject will be uniquely identified from the access token. required: - scopes - purpose - requestCaptureUrl properties: phoneNumber: $ref: "#/components/schemas/PhoneNumber" scopes: $ref: "#/components/schemas/Scopes" purpose: $ref: "#/components/schemas/Purpose" requestCaptureUrl: type: boolean description: | A boolean flag indicating whether the API Consumer requests API Provider to return a Consent capture URL. * `true` - If set to `true` the API will include a `captureUrl` in the response body if applicable. * `false` - The API will omit the Consent capture URL from the response. example: true callbackUrl: type: string format: uri description: | Optional URL to which the User shall be redirected by the API Provider once the Consent Capture process has reached a final state (e.g., The User has given their consent). This parameter is only applicable when the API Consumer requests a Consent capture URL by setting `requestCaptureUrl` to `true`. The `callbackUrl` parameter enables API Consumers to seamlessly regain control of the user experience once the Consent Capture journey is completed. **Functional behaviour** When the `callbackUrl` is provided in the request, the API Provider MUST redirect the User to this URL upon completion of the Consent Capture journey. The redirection MUST include a query parameter named `capture_result` that indicates the outcome of the Consent Capture process. The possible values for `capture_result` are: - `granted`: The User has successfully provided Consent for the specified scope(s) and Purpose. - `partial_grant`: The User has provided Consent for only a subset of the originally requested scopes and Purpose. When a `partial_grant` is returned, the API Provider MUST ensure that subsequent API requests reflect the precise subset of scopes actually authorized. - `denied`: The User has explicitly denied the Consent for the specified scope(s) and Purpose. - `error`: The Consent Capture flow terminated abnormally due to an internal error, network issue, or unexpected failure. - `timeout`: The User did not complete the Consent Capture flow within the defined timeout period. The API Consumer MAY include a `state` query parameter when initiating the Consent Capture journey (i.e., when opening the Consent Capture URL) to correlate the process with an existing session or transaction context. If the state parameter is provided, the API Provider MUST preserve its value and append it unchanged to the callback URL when redirecting the User at the end of the journey. e.g. `https://consumer.example.com/consent/callback?capture_result=granted&state=xyz123` **Security considerations** - The `callbackUrl` MUST use the `https` scheme to ensure transport security. Exceptions MAY be allowed for loopback addresses (`http://127.0.0.1`, `http://[::1]`, or `http://localhost`) or for custom application schemes (e.g., `myapp://consent/callback`) when used as secure deep links for native applications. - The `callbackUrl` SHOULD be validated by the API Provider to prevent open redirect or injection attacks. Validation SHOULD ensure that the domain or scheme is either pre-registered or demonstrably under the control of the API Consumer. - The API Provider MUST NOT include any personal data, access tokens, or identifiers in the callback URL. The `capture_result` parameter MUST be appended, as MUST the `state` parameter if it has been received previously. - The API Consumer SHOULD validate the origin of incoming callbacks and confirm that the received parameters correspond to an expected session or flow (e.g., by verifying the `state` value to prevent CSRF attacks). example: "https://consumer.example.com/consent/callback" Scopes: type: array minItems: 1 items: type: string description: | List of requested scopes. The scope is a string that represents the access rights that the API Consumer is requesting from the User. example: - "location-verification:verify" Purpose: type: string pattern: '^dpv:[a-zA-Z0-9]+$' description: | The reason for which personal data will be processed by the API Consumer. CAMARA defines a standard set of Purposes which can be used by API Consumers to specify the reason for their intended personal data processing. CAMARA uses the [W3C Data Privacy Vocabulary](https://w3c.github.io/dpv/2.0/dpv/) (DPV) to represent these purposes e.g. `dpv:FraudPreventionAndDetection` or `dpv:RequestedServiceProvision`. example: "dpv:FraudPreventionAndDetection" RetrieveStatusResponseBody: type: object required: - statusInfo properties: statusInfo: $ref: "#/components/schemas/statusInfo" captureUrl: type: string format: url description: | URL where the User can provide the necessary Consent. This field is only present in the API response if the API Consumer requests it and if the following conditions are met: - `statusInfo[*].statusValidForProcessing` is `false`, and - `statusInfo[*].statusReason` is `PENDING`, `REQUESTED` or `EXPIRED`. Please note that this field is only applicable when the User Consent is required to enable valid data processing. A unique URL is provided to authorise all items in the statusInfo list that require user action. example: "https://example.org/consent-capture-url" statusInfo: type: array description: | Provides information about the validity status of the requested data processing for the specified scope(s) and Purpose. It contains details of whether the processing of the data is currently valid and, if not, the reason why. The expiration date of the validity may be also provided if applicable. More than one array item may be required for the requested scope(s) and Purpose, e.g. when the requested scopes relate to multiple APIs. items: $ref: "#/components/schemas/statusInfoObject" minItems: 1 statusInfoObject: type: object required: - scopes - purpose - statusValidForProcessing properties: scopes: $ref: "#/components/schemas/Scopes" purpose: $ref: "#/components/schemas/Purpose" statusValidForProcessing: type: boolean description: | Boolean flag that shows the validity status of the requested data processing for the specified scope(s) and Purpose. * `true` - indicates that the current status is valid and permits the requested data processing. * `false` - indicates that the requested data processing is not permitted. The reason for this is provided in the `statusReason` field. statusReason: type: string enum: - PENDING - REQUESTED - DENIED - EXPIRED - OBJECTED description: | This field must be present if `statusValidForProcessing` is `false`. It indicates the reason why the requested data processing is not permitted for the specified scope(s) and Purpose. It provides API Consumers with additional context on the current validity status, helping them to understand its applicability and the next steps they may need to take. It is particularly useful for determining whether the API Consumer should prompt the User to take action, such as providing Consent or renewing an existing Consent. Possible values are: - `PENDING`: The requested data processing has not yet been established or fully validated under the applicable privacy regulations. For example, the User has not yet provided Consent when it is required. - `REQUESTED`: The permission for the requested data processing has been submitted but has not yet been granted or confirmed. This is common when the API Consumer has initiated a request for Consent capture, but the User has not yet completed the process. For example, this occurs when a notice prompting the User to provide Consent has been displayed, but they have not yet made a decision. - `DENIED`: The User has explicitly refused their permission for the requested data processing. For example, when the User refuses to grant Consent for the data processing, or when they previously granted Consent but later withdrew it. - `OBJECTED`: The user has opted out of the requested data processing, despite a previous explicit opt-in not being required. This is common when the User has exercised their right to object to data processing under the applicable privacy regulations. - `EXPIRED`: When applicable, the validity of the data processing has ceased due to the passage of time or a pre-defined condition. This is common for time-limited Consents. expirationDate: type: string format: date-time description: | The date and time at which the validity of the data processing is set to expire or has expired. It applies mainly to time-limited Consents, or other cases where a specific duration of validity is defined for the data processing. This field is only applicable: - if `statusValidForProcessing` is `true` (indicating a future expiration), or - if `statusValidForProcessing` is `false` and `statusReason` is `EXPIRED` (indicating the past expiration date). It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone. Recommended format is yyyy-MM-dd'T'HH:mm:ss.SSSZ (i.e. which allows 2023-07-03T14:27:08.312+02:00 or 2023-07-03T12:27:08.312Z). example: "2023-07-03T14:27:08.312+02:00" ErrorInfo: type: object required: - status - code - message properties: status: type: integer description: HTTP response status code code: type: string description: A human-readable code to describe the error message: type: string description: A human-readable description of what the event represents responses: Generic400: description: Bad Request headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: allOf: - $ref: "#/components/schemas/ErrorInfo" - type: object properties: status: enum: - 400 code: enum: - INVALID_ARGUMENT examples: GENERIC_400_INVALID_ARGUMENT: description: Invalid Argument. Generic Syntax Exception value: status: 400 code: INVALID_ARGUMENT message: Client specified an invalid argument, request body or query param. Generic401: description: Unauthorized headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: allOf: - $ref: "#/components/schemas/ErrorInfo" - type: object properties: status: enum: - 401 code: enum: - UNAUTHENTICATED examples: GENERIC_401_UNAUTHENTICATED: description: Request cannot be authenticated value: status: 401 code: UNAUTHENTICATED message: Request not authenticated due to missing, invalid, or expired credentials. A new authentication is required. retrieveStatus403: description: Forbidden headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: allOf: - $ref: "#/components/schemas/ErrorInfo" - type: object properties: status: enum: - 403 code: enum: - PERMISSION_DENIED - CONSENT_INFO.NOT_ALLOWED_SCOPES_PURPOSE - CONSENT_INFO.CAPTURE_FREQUENCY_EXCEEDED - CONSENT_INFO.INVALID_CALLBACK_URL examples: GENERIC_403_PERMISSION_DENIED: description: Permission denied. OAuth2 token access does not have the required scope or when the user fails operational security value: status: 403 code: PERMISSION_DENIED message: Client does not have sufficient permissions to perform this action. NOT_ALLOWED_SCOPES_PURPOSE: description: The requested scope(s) and Purpose combination is not allowed for the API Consumer, e.g. the API Consumer has not onboarded the appropriate API(s) with the API Provider for the declared Purpose. value: status: 403 code: CONSENT_INFO.NOT_ALLOWED_SCOPES_PURPOSE message: The requested scope(s) and Purpose combination is not allowed for this API Consumer. CAPTURE_FREQUENCY_EXCEEDED: description: The frequency of consent capture requests has been exceeded. value: status: 403 code: CONSENT_INFO.CAPTURE_FREQUENCY_EXCEEDED message: The frequency of consent capture requests has been exceeded. Please try again later. INVALID_CALLBACK_URL: description: The provided callback URL is invalid. value: status: 403 code: CONSENT_INFO.INVALID_CALLBACK_URL message: The provided callback URL is invalid. Generic404: description: Not found headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: allOf: - $ref: "#/components/schemas/ErrorInfo" - type: object properties: status: enum: - 404 code: enum: - NOT_FOUND - IDENTIFIER_NOT_FOUND examples: GENERIC_404_NOT_FOUND: description: Resource is not found value: status: 404 code: NOT_FOUND message: The specified resource is not found. GENERIC_404_IDENTIFIER_NOT_FOUND: description: Some identifier cannot be matched to a device value: status: 404 code: IDENTIFIER_NOT_FOUND message: Phone number not found. Generic422: description: Unprocessable Content headers: x-correlator: $ref: "#/components/headers/x-correlator" content: application/json: schema: allOf: - $ref: "#/components/schemas/ErrorInfo" - type: object properties: status: enum: - 422 code: enum: - SERVICE_NOT_APPLICABLE - MISSING_IDENTIFIER - UNNECESSARY_IDENTIFIER examples: GENERIC_422_SERVICE_NOT_APPLICABLE: description: Service not applicable for the provided identifier value: status: 422 code: SERVICE_NOT_APPLICABLE message: The service is not available for the provided phone number. GENERIC_422_MISSING_IDENTIFIER: description: An identifier is not included in the request and the device or phone number identification cannot be derived from the 3-legged access token value: status: 422 code: MISSING_IDENTIFIER message: The phone number cannot be identified. GENERIC_422_UNNECESSARY_IDENTIFIER: description: An explicit identifier is provided when a device or phone number has already been identified from the access token value: status: 422 code: UNNECESSARY_IDENTIFIER message: The phone number is already identified by the access token. securitySchemes: openId: type: openIdConnect openIdConnectUrl: https://example.org/.well-known/openid-configuration ```