|
| 1 | +openapi: 3.0.3 |
| 2 | +info: |
| 3 | + title: Number Recycling |
| 4 | + description: | |
| 5 | + The API can be used to check whether the subscriber of the phone number has changed. |
| 6 | + A common scenario is when Application service provider (ASP) wants to check whether there has been a change in the user associated with the phone number after the specified date. This allows the ASP to ensure that a phone number is correctly linked to an user and prevent the mis-delivery of SMS messages. |
| 7 | +
|
| 8 | + For example, below is a potential scenarios: |
| 9 | + * Scenario 1 |
| 10 | + * Pre-conditions |
| 11 | + * User A signed a contract with MNO A for the phone number '+123456789' on October 9, 2023, and is still using it. |
| 12 | + * User A also signed contracts with ASP A on December 22, 2023 for its services. |
| 13 | + * ASP A holds the contract date (2023-12-22) and the phone number (+123456789) for User A. |
| 14 | + * Currently, on November 2, 2024, ASP A wishes to send a SMS message to User A. |
| 15 | + * Potential operations |
| 16 | + * ASP A sends a request with specified date (2023-12-22) and phone number (+123456789) to the Number Recycling API. |
| 17 | + * The API response sets to 'false', indicating that there has not been a change in the user associated with the phone number. |
| 18 | + * Post-conditions |
| 19 | + * ASP A decides to send the SMS message to User A. |
| 20 | + * By following these steps, ASP A ensures that a phone number is linked to User A. |
| 21 | +
|
| 22 | + <img width="4000" alt="Number_Recycling_scenario_1" src="https://raw.githubusercontent.com/camaraproject/NumberRecycling/r1.1/documentation/API_documentation/assets/Number_Recycling_scenario_1.png"> |
| 23 | +
|
| 24 | + Note: |
| 25 | + * When API receives a request with specified date on which a user signed a contract with MNO, the API respond sets to 'false'(e.g., 2023-10-09 in the Scenario 1 of the figure above). |
| 26 | +
|
| 27 | + * Scenario 2 |
| 28 | + * Pre-conditions |
| 29 | + * User A signed a contract with MNO A for the phone number '+123456789' on October 9, 2023, and canceled it on February 25, 2024. Subsequently, User B signed a contract with MNO A for the same phone number on September 21, 2024, and is still using it. |
| 30 | + * User A also signed contracts with ASP A on December 22, 2023 for its services. |
| 31 | + * ASP A holds the contract date (2023-12-22) and the phone number (+123456789) for User A. |
| 32 | + * Currently, on November 2, 2024, ASP A wishes to send a SMS message to User A. |
| 33 | + * Potential operations |
| 34 | + * ASP A sends a request with specified date (2023-12-22) and phone number (+123456789) to the Number Recycling API. |
| 35 | + * The API response sets to 'true', indicating that there has been a change in the user associated with the phone number. |
| 36 | + * Post-conditions |
| 37 | + * ASP A decides to stop sending the SMS message to User A and contacts User A by mail. |
| 38 | + * By following these steps, ASP A ensures that a phone number is not linked to User A and prevents the mis-delivery of the SMS message. |
| 39 | +
|
| 40 | + <img width="4000" alt="Number_Recycling_scenario_2" src="https://raw.githubusercontent.com/camaraproject/NumberRecycling/r1.1/documentation/API_documentation/assets/Number_Recycling_scenario_2.png"> |
| 41 | +
|
| 42 | + Note: |
| 43 | + * When the API receives a request with specified date during which there is no contract with MNO for the phone number, the API respond sets to 'true'(e.g., the period between 2024-02-25 and 2024-09-20 in the Scenario 2 of the figure above). |
| 44 | +
|
| 45 | + # Authorization and authentication |
| 46 | +
|
| 47 | + 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. |
| 48 | +
|
| 49 | + 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. |
| 50 | +
|
| 51 | + 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. |
| 52 | +
|
| 53 | + # Identifying the phone number from the access token |
| 54 | +
|
| 55 | + This API requires the API consumer to identify a phone number as the subject of the API as follows: |
| 56 | + - 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. |
| 57 | + - 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. |
| 58 | +
|
| 59 | + 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. |
| 60 | +
|
| 61 | + ## Error handling: |
| 62 | +
|
| 63 | + - 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. |
| 64 | + - 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. |
| 65 | +
|
| 66 | + version: "0.1" |
| 67 | + termsOfService: http://example.com/terms/ |
| 68 | + contact: |
| 69 | + name: Telefónica Open Gateway DevRel |
| 70 | + url: https://opengateway.telefonica.com/en/developer-hub |
| 71 | + email: devrel@telefonica.com |
| 72 | + license: |
| 73 | + name: Apache 2.0 |
| 74 | + url: https://www.apache.org/licenses/LICENSE-2.0.html |
| 75 | + |
| 76 | +servers: |
| 77 | + - url: '{host}/number-recycling/v0' |
| 78 | + variables: |
| 79 | + host: |
| 80 | + default: sandbox.opengateway.telefonica.com/apigateway |
| 81 | + description: gateway URL |
| 82 | + |
| 83 | +paths: |
| 84 | + /check: |
| 85 | + post: |
| 86 | + summary: Check number recycling v0.1 |
| 87 | + security: |
| 88 | + - three_legged: |
| 89 | + - number-recycling:check |
| 90 | + tags: |
| 91 | + - Check for phone number subscriber change. |
| 92 | + description: Check whether the subscriber of the phone number has changed. |
| 93 | + operationId: checkNumberRecycling |
| 94 | + parameters: |
| 95 | + - $ref: '#/components/parameters/x-correlator' |
| 96 | + requestBody: |
| 97 | + description: | |
| 98 | + Check whether the subscriber of the phone number has changed. |
| 99 | + content: |
| 100 | + application/json: |
| 101 | + schema: |
| 102 | + $ref: '#/components/schemas/CreateCheckNumRecycling' |
| 103 | + required: true |
| 104 | + responses: |
| 105 | + '200': |
| 106 | + $ref: '#/components/responses/Generic200' |
| 107 | + '400': |
| 108 | + $ref: '#/components/responses/Generic400' |
| 109 | + '401': |
| 110 | + $ref: '#/components/responses/Generic401' |
| 111 | + '403': |
| 112 | + $ref: '#/components/responses/Generic403' |
| 113 | + '404': |
| 114 | + $ref: '#/components/responses/Generic404' |
| 115 | + '422': |
| 116 | + $ref: '#/components/responses/Generic422' |
| 117 | +components: |
| 118 | + securitySchemes: |
| 119 | + three_legged: |
| 120 | + type: oauth2 |
| 121 | + flows: |
| 122 | + authorizationCode: |
| 123 | + authorizationUrl: https://{host}/authorize |
| 124 | + tokenUrl: https://{host}/token |
| 125 | + scopes: |
| 126 | + number-recycling:check: checkNumberRecycling operation |
| 127 | + parameters: |
| 128 | + x-correlator: |
| 129 | + name: x-correlator |
| 130 | + in: header |
| 131 | + description: Correlation id for the different services |
| 132 | + schema: |
| 133 | + type: string |
| 134 | + pattern: "^[a-zA-Z0-9-]{0,55}$" |
| 135 | + example: "b4333c46-49c0-4f62-80d7-f0ef930f1c46" |
| 136 | + headers: |
| 137 | + x-correlator: |
| 138 | + description: Correlation id for the different services |
| 139 | + schema: |
| 140 | + type: string |
| 141 | + pattern: "^[a-zA-Z0-9-]{0,55}$" |
| 142 | + example: "b4333c46-49c0-4f62-80d7-f0ef930f1c46" |
| 143 | + schemas: |
| 144 | + CreateCheckNumRecycling: |
| 145 | + type: object |
| 146 | + required: |
| 147 | + - specifiedDate |
| 148 | + properties: |
| 149 | + phoneNumber: |
| 150 | + $ref: '#/components/schemas/PhoneNumber' |
| 151 | + specifiedDate: |
| 152 | + type: string |
| 153 | + format: date |
| 154 | + description: Specified date to check whether there has been a change in the subscriber associated with the specific phone number, in RFC 3339 calendar date format (YYYY-MM-DD). |
| 155 | + example: "2024-10-31" |
| 156 | + PhoneNumber: |
| 157 | + 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 '+'. |
| 158 | + type: string |
| 159 | + pattern: '^\+[1-9][0-9]{4,14}$' |
| 160 | + example: "+123456789" |
| 161 | + CheckNumRecyclingInfo: |
| 162 | + type: object |
| 163 | + required: |
| 164 | + - phoneNumberRecycled |
| 165 | + properties: |
| 166 | + phoneNumberRecycled: |
| 167 | + type: boolean |
| 168 | + description: | |
| 169 | + Set to true (Boolean, not string) when there has been a change in the subscriber associated with the specific phone number after “specifiedDate”. |
| 170 | + ErrorInfo: |
| 171 | + type: object |
| 172 | + required: |
| 173 | + - status |
| 174 | + - code |
| 175 | + - message |
| 176 | + properties: |
| 177 | + status: |
| 178 | + type: integer |
| 179 | + description: HTTP response status code |
| 180 | + code: |
| 181 | + type: string |
| 182 | + description: Code given to this error |
| 183 | + message: |
| 184 | + type: string |
| 185 | + description: A human readable description of what the event represent |
| 186 | + responses: |
| 187 | + Generic200: |
| 188 | + description: OK |
| 189 | + headers: |
| 190 | + x-correlator: |
| 191 | + $ref: '#/components/headers/x-correlator' |
| 192 | + content: |
| 193 | + application/json: |
| 194 | + schema: |
| 195 | + $ref: '#/components/schemas/CheckNumRecyclingInfo' |
| 196 | + |
| 197 | + Generic400: |
| 198 | + description: Problem with the client request |
| 199 | + headers: |
| 200 | + x-correlator: |
| 201 | + $ref: '#/components/headers/x-correlator' |
| 202 | + content: |
| 203 | + application/json: |
| 204 | + schema: |
| 205 | + allOf: |
| 206 | + - $ref: "#/components/schemas/ErrorInfo" |
| 207 | + - type: object |
| 208 | + properties: |
| 209 | + status: |
| 210 | + enum: |
| 211 | + - 400 |
| 212 | + code: |
| 213 | + enum: |
| 214 | + - INVALID_ARGUMENT |
| 215 | + - OUT_OF_RANGE |
| 216 | + examples: |
| 217 | + InvalidArgument: |
| 218 | + description: Invalid Argument. Generic Syntax Exception |
| 219 | + value: |
| 220 | + status: 400 |
| 221 | + code: INVALID_ARGUMENT |
| 222 | + message: Client specified an invalid argument, request body or query param. |
| 223 | + OutOfRange: |
| 224 | + description: Out of Range. Specific Syntax Exception used when a given field has a pre-defined range or a invalid filter criteria combination is requested |
| 225 | + value: |
| 226 | + status: 400 |
| 227 | + code: OUT_OF_RANGE |
| 228 | + message: Client specified an invalid range. |
| 229 | + |
| 230 | + Generic401: |
| 231 | + description: Authentication problem with the client request |
| 232 | + headers: |
| 233 | + x-correlator: |
| 234 | + $ref: '#/components/headers/x-correlator' |
| 235 | + content: |
| 236 | + application/json: |
| 237 | + schema: |
| 238 | + allOf: |
| 239 | + - $ref: "#/components/schemas/ErrorInfo" |
| 240 | + - type: object |
| 241 | + properties: |
| 242 | + status: |
| 243 | + enum: |
| 244 | + - 401 |
| 245 | + code: |
| 246 | + enum: |
| 247 | + - UNAUTHENTICATED |
| 248 | + - AUTHENTICATION_REQUIRED |
| 249 | + examples: |
| 250 | + Unauthenticated: |
| 251 | + description: Request cannot be authenticated |
| 252 | + value: |
| 253 | + status: 401 |
| 254 | + code: UNAUTHENTICATED |
| 255 | + message: Request not authenticated due to missing, invalid, or expired credentials. |
| 256 | + Authentication Required: |
| 257 | + description: New authentication is needed, authentication is no longer valid |
| 258 | + value: |
| 259 | + status: 401 |
| 260 | + code: AUTHENTICATION_REQUIRED |
| 261 | + message: New authentication is required. |
| 262 | + |
| 263 | + Generic403: |
| 264 | + description: Client does not have sufficient permission |
| 265 | + headers: |
| 266 | + x-correlator: |
| 267 | + $ref: '#/components/headers/x-correlator' |
| 268 | + content: |
| 269 | + application/json: |
| 270 | + schema: |
| 271 | + allOf: |
| 272 | + - $ref: "#/components/schemas/ErrorInfo" |
| 273 | + - type: object |
| 274 | + properties: |
| 275 | + status: |
| 276 | + enum: |
| 277 | + - 403 |
| 278 | + code: |
| 279 | + enum: |
| 280 | + - PERMISSION_DENIED |
| 281 | + examples: |
| 282 | + Permission Denied: |
| 283 | + description: Permission denied. OAuth2 token access not have the required scope or when the user fails operational security |
| 284 | + value: |
| 285 | + status: 403 |
| 286 | + code: PERMISSION_DENIED |
| 287 | + message: Client does not have sufficient permissions to perform this action |
| 288 | + |
| 289 | + Generic404: |
| 290 | + description: Resource Not Found |
| 291 | + headers: |
| 292 | + x-correlator: |
| 293 | + $ref: '#/components/headers/x-correlator' |
| 294 | + content: |
| 295 | + application/json: |
| 296 | + schema: |
| 297 | + allOf: |
| 298 | + - $ref: "#/components/schemas/ErrorInfo" |
| 299 | + - type: object |
| 300 | + properties: |
| 301 | + status: |
| 302 | + enum: |
| 303 | + - 404 |
| 304 | + code: |
| 305 | + enum: |
| 306 | + - IDENTIFIER_NOT_FOUND |
| 307 | + examples: |
| 308 | + Phone Number Used By Different Network Operator: |
| 309 | + description: Provided phone number is used by a different network operator |
| 310 | + value: |
| 311 | + status: 404 |
| 312 | + code: IDENTIFIER_NOT_FOUND |
| 313 | + message: Phone number not found. |
| 314 | + |
| 315 | + Generic422: |
| 316 | + description: Unprocessable Content |
| 317 | + headers: |
| 318 | + x-correlator: |
| 319 | + $ref: '#/components/headers/x-correlator' |
| 320 | + content: |
| 321 | + application/json: |
| 322 | + schema: |
| 323 | + allOf: |
| 324 | + - $ref: "#/components/schemas/ErrorInfo" |
| 325 | + - type: object |
| 326 | + properties: |
| 327 | + status: |
| 328 | + enum: |
| 329 | + - 422 |
| 330 | + code: |
| 331 | + enum: |
| 332 | + - SERVICE_NOT_APPLICABLE |
| 333 | + - MISSING_IDENTIFIER |
| 334 | + - UNNECESSARY_IDENTIFIER |
| 335 | + examples: |
| 336 | + Device Not Applicable: |
| 337 | + description: Service not applicable for the provided phone number |
| 338 | + value: |
| 339 | + status: 422 |
| 340 | + code: SERVICE_NOT_APPLICABLE |
| 341 | + message: The service is not available for the provided phone number |
| 342 | + Unnecessary Identifier: |
| 343 | + description: An explicit identifier is provided when a phone number has already been identified from the access token |
| 344 | + value: |
| 345 | + status: 422 |
| 346 | + code: UNNECESSARY_IDENTIFIER |
| 347 | + message: The phone number is already identified by the access token |
| 348 | + Missing Identifier: |
| 349 | + description: An identifier is not included in the request and the phone number identification cannot be derived from the 3-legged access token |
| 350 | + value: |
| 351 | + status: 422 |
| 352 | + code: MISSING_IDENTIFIER |
| 353 | + message: The phone number cannot be identified |
0 commit comments