|
| 1 | +openapi: 3.0.3 |
| 2 | +info: |
| 3 | + title: Device Location Verification |
| 4 | + description: Service Enabling Network Function API for location verification |
| 5 | + termsOfService: http://swagger.io/terms/ |
| 6 | + contact: |
| 7 | + name: Telefónica Open Gateway DevRel |
| 8 | + url: https://opengateway.telefonica.com/en/developer-hub |
| 9 | + |
| 10 | + license: |
| 11 | + name: Apache 2.0 |
| 12 | + url: https://www.apache.org/licenses/LICENSE-2.0.html |
| 13 | + version: "0.2" |
| 14 | +externalDocs: |
| 15 | + description: Product documentation at Camara |
| 16 | + url: https://github.com/camaraproject/ |
| 17 | +servers: |
| 18 | + - url: "{host}/location-verification/v0" |
| 19 | + variables: |
| 20 | + host: |
| 21 | + default: sandbox.opengateway.telefonica.com/apigateway |
| 22 | + description: API gateway URL |
| 23 | +paths: |
| 24 | + /verify: |
| 25 | + post: |
| 26 | + tags: |
| 27 | + - Verify a device location |
| 28 | + summary: Verify location v0.2 |
| 29 | + security: |
| 30 | + - three_legged: |
| 31 | + - location-verification:verify |
| 32 | + description: | |
| 33 | + Verifies the location of a device with a given coordinates and accuracy |
| 34 | +
|
| 35 | + Check the [Authorization guide](/docs/authorization) on how to get an OAuth2 token, with the following scope: |
| 36 | +
|
| 37 | + `dpv:FraudPreventionAndDetection#location-verification:verify` |
| 38 | +
|
| 39 | + Create an app on our [Sandbox](/docs/sandbox) to get credentials and [retrieve tokens](/reference/authorize) so you can perform API calls to our operators' production environments, or use the following convenience token to test in mock mode: |
| 40 | + |
| 41 | + `mock_sandbox_access_token` |
| 42 | + |
| 43 | + You can explore our [Device Location Verification sample code](/docs/samplecode_devicelocation) for additional guidance on using this API. |
| 44 | + operationId: verifyLocation |
| 45 | + requestBody: |
| 46 | + content: |
| 47 | + application/json: |
| 48 | + schema: |
| 49 | + $ref: '#/components/schemas/VerifyLocationRequest' |
| 50 | + required: true |
| 51 | + responses: |
| 52 | + '200': |
| 53 | + description: Location verification successful |
| 54 | + content: |
| 55 | + application/json: |
| 56 | + schema: |
| 57 | + $ref: '#/components/schemas/VerifyLocationResponse' |
| 58 | + '400': |
| 59 | + $ref: '#/components/responses/Generic400' |
| 60 | + '401': |
| 61 | + $ref: '#/components/responses/Generic401' |
| 62 | + '403': |
| 63 | + $ref: '#/components/responses/Generic403' |
| 64 | + '404': |
| 65 | + $ref: '#/components/responses/Generic404' |
| 66 | + '500': |
| 67 | + $ref: '#/components/responses/Generic500' |
| 68 | + '503': |
| 69 | + $ref: '#/components/responses/Generic503' |
| 70 | +components: |
| 71 | + securitySchemes: |
| 72 | + three_legged: |
| 73 | + type: oauth2 |
| 74 | + flows: |
| 75 | + authorizationCode: |
| 76 | + authorizationUrl: https://{host}/authorize |
| 77 | + tokenUrl: https://{host}/token |
| 78 | + scopes: |
| 79 | + location-verification:verify: Read device location |
| 80 | + schemas: |
| 81 | + VerifyLocationRequest: |
| 82 | + type: object |
| 83 | + properties: |
| 84 | + device: |
| 85 | + $ref: "#/components/schemas/Device" |
| 86 | + area: |
| 87 | + $ref: "#/components/schemas/Area" |
| 88 | + maxAge: |
| 89 | + $ref: "#/components/schemas/MaxAge" |
| 90 | + required: |
| 91 | + - device |
| 92 | + - area |
| 93 | + |
| 94 | + VerifyLocationResponse: |
| 95 | + type: object |
| 96 | + required: |
| 97 | + - verificationResult |
| 98 | + properties: |
| 99 | + lastLocationTime: |
| 100 | + $ref: "#/components/schemas/LastLocationTime" |
| 101 | + verificationResult: |
| 102 | + $ref: "#/components/schemas/VerificationResult" |
| 103 | + matchRate: |
| 104 | + $ref: "#/components/schemas/MatchRate" |
| 105 | + |
| 106 | + Device: |
| 107 | + description: | |
| 108 | + End-user equipment able to connect to a mobile network. Examples of devices include smartphones or IoT sensors/actuators. |
| 109 | +
|
| 110 | + The developer can choose to provide the below specified device identifiers: |
| 111 | +
|
| 112 | + * `ipv4Address` |
| 113 | + * `ipv6Address` |
| 114 | + * `phoneNumber` |
| 115 | + * `networkAccessIdentifier` |
| 116 | +
|
| 117 | + NOTE: the MNO might support only a subset of these options. The API invoker can provide multiple identifiers to be compatible across different MNOs. In this case the identifiers MUST belong to the same device. |
| 118 | + type: object |
| 119 | + properties: |
| 120 | + phoneNumber: |
| 121 | + $ref: "#/components/schemas/PhoneNumber" |
| 122 | + networkAccessIdentifier: |
| 123 | + $ref: "#/components/schemas/NetworkAccessIdentifier" |
| 124 | + ipv4Address: |
| 125 | + $ref: "#/components/schemas/DeviceIpv4Addr" |
| 126 | + ipv6Address: |
| 127 | + $ref: "#/components/schemas/DeviceIpv6Address" |
| 128 | + minProperties: 1 |
| 129 | + |
| 130 | + PhoneNumber: |
| 131 | + 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, optionally prefixed with '+'. |
| 132 | + type: string |
| 133 | + pattern: '^\+?[0-9]{5,15}$' |
| 134 | + example: "123456789" |
| 135 | + |
| 136 | + NetworkAccessIdentifier: |
| 137 | + description: A public identifier addressing a subscription in a mobile network. In 3GPP terminology, it corresponds to the GPSI formatted with the External Identifier ({Local Identifier}@{Domain Identifier}). Unlike the telephone number, the network access identifier is not subjected to portability ruling in force, and is individually managed by each operator. |
| 138 | + type: string |
| 139 | + |
| 140 | + |
| 141 | + DeviceIpv4Addr: |
| 142 | + type: object |
| 143 | + description: | |
| 144 | + The device should be identified by either the public (observed) IP address and port as seen by the application server, or the private (local) and any public (observed) IP addresses in use by the device (this information can be obtained by various means, for example from some DNS servers). |
| 145 | +
|
| 146 | + If the allocated and observed IP addresses are the same (i.e. NAT is not in use) then the same address should be specified for both publicAddress and privateAddress. |
| 147 | +
|
| 148 | + If NAT64 is in use, the device should be identified by its publicAddress and publicPort, or separately by its allocated IPv6 address (field ipv6Address of the Device object) |
| 149 | +
|
| 150 | + In all cases, publicAddress must be specified, along with at least one of either privateAddress or publicPort, dependent upon which is known. In general, mobile devices cannot be identified by their public IPv4 address alone. |
| 151 | + properties: |
| 152 | + publicAddress: |
| 153 | + $ref: "#/components/schemas/SingleIpv4Addr" |
| 154 | + privateAddress: |
| 155 | + $ref: "#/components/schemas/SingleIpv4Addr" |
| 156 | + publicPort: |
| 157 | + $ref: "#/components/schemas/Port" |
| 158 | + anyOf: |
| 159 | + - required: [publicAddress, privateAddress] |
| 160 | + - required: [publicAddress, publicPort] |
| 161 | + example: |
| 162 | + publicAddress: "84.125.93.10" |
| 163 | + publicPort: 59765 |
| 164 | + |
| 165 | + SingleIpv4Addr: |
| 166 | + description: A single IPv4 address with no subnet mask |
| 167 | + type: string |
| 168 | + format: ipv4 |
| 169 | + example: "84.125.93.10" |
| 170 | + |
| 171 | + Port: |
| 172 | + description: TCP or UDP port number |
| 173 | + type: integer |
| 174 | + minimum: 0 |
| 175 | + maximum: 65535 |
| 176 | + |
| 177 | + DeviceIpv6Address: |
| 178 | + description: | |
| 179 | + The device should be identified by the observed IPv6 address, or by any single IPv6 address from within the subnet allocated to the device (e.g. adding ::0 to the /64 prefix). |
| 180 | + type: string |
| 181 | + format: ipv6 |
| 182 | + example: 2001:db8:85a3:8d3:1319:8a2e:370:7344 |
| 183 | + |
| 184 | + MaxAge: |
| 185 | + description: The maximum age (in seconds) of the available location, which is accepted for the verification. |
| 186 | + type: integer |
| 187 | + minimum: 60 |
| 188 | + example: 120 |
| 189 | + |
| 190 | + Area: |
| 191 | + type: object |
| 192 | + properties: |
| 193 | + areaType: |
| 194 | + $ref: "#/components/schemas/AreaType" |
| 195 | + required: |
| 196 | + - areaType |
| 197 | + discriminator: |
| 198 | + propertyName: areaType |
| 199 | + mapping: |
| 200 | + CIRCLE: "#/components/schemas/Circle" |
| 201 | + |
| 202 | + AreaType: |
| 203 | + type: string |
| 204 | + description: | |
| 205 | + Type of this area. |
| 206 | + CIRCLE - The area is defined as a circle. |
| 207 | + enum: |
| 208 | + - CIRCLE |
| 209 | + |
| 210 | + Circle: |
| 211 | + description: Circular area |
| 212 | + allOf: |
| 213 | + - $ref: "#/components/schemas/Area" |
| 214 | + - type: object |
| 215 | + properties: |
| 216 | + center: |
| 217 | + $ref: "#/components/schemas/Point" |
| 218 | + radius: |
| 219 | + type: integer |
| 220 | + description: Expected accuracy for the verification in meters, from location (radius) |
| 221 | + minimum: 2000 |
| 222 | + maximum: 200000 |
| 223 | + required: |
| 224 | + - center |
| 225 | + - radius |
| 226 | + example: |
| 227 | + areaType: CIRCLE |
| 228 | + center: |
| 229 | + latitude: 50.735851 |
| 230 | + longitude: 7.10066 |
| 231 | + radius: 50000 |
| 232 | + Point: |
| 233 | + type: object |
| 234 | + description: Coordinates (latitude, longitude) defining a location in a map |
| 235 | + required: |
| 236 | + - latitude |
| 237 | + - longitude |
| 238 | + properties: |
| 239 | + latitude: |
| 240 | + $ref: "#/components/schemas/Latitude" |
| 241 | + longitude: |
| 242 | + $ref: "#/components/schemas/Longitude" |
| 243 | + example: |
| 244 | + latitude: 50.735851 |
| 245 | + longitude: 7.10066 |
| 246 | + Latitude: |
| 247 | + description: Latitude component of a location |
| 248 | + type: number |
| 249 | + format: double |
| 250 | + minimum: -90 |
| 251 | + maximum: 90 |
| 252 | + example: 50.735851 |
| 253 | + Longitude: |
| 254 | + description: Longitude component of location |
| 255 | + type: number |
| 256 | + format: double |
| 257 | + minimum: -180 |
| 258 | + maximum: 180 |
| 259 | + example: 7.10066 |
| 260 | + |
| 261 | + Ipv6Addr: |
| 262 | + type: string |
| 263 | + format: ipv6 |
| 264 | + allOf: |
| 265 | + - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))?$' |
| 266 | + - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\/.+)?$' |
| 267 | + example: '2001:db8:85a3:8d3:1319:8a2e:370:7344' |
| 268 | + description: | |
| 269 | + IPv6 address, following IETF 5952 format, may be specified in form <address/mask> as: |
| 270 | + - address - The /128 subnet is optional for single addresses: |
| 271 | + - 2001:db8:85a3:8d3:1319:8a2e:370:7344 |
| 272 | + - 2001:db8:85a3:8d3:1319:8a2e:370:7344/128 |
| 273 | + - address/mask - an IP v6 number with a mask: |
| 274 | + - 2001:db8:85a3:8d3::0/64 |
| 275 | + - 2001:db8:85a3:8d3::/64 |
| 276 | +
|
| 277 | + VerificationResult: |
| 278 | + description: | |
| 279 | + Result of a verification request: |
| 280 | + - `TRUE`: when the network locates the device within the requested area, |
| 281 | + - `FALSE`: when the requested area does not match the area where the network locates the device, |
| 282 | + - `UNKNOWN`: when the network cannot locate the device, |
| 283 | + - `PARTIAL`: when the requested area partially match the area where the network locates the device. A `match_rate` could be included in the response. |
| 284 | + type: string |
| 285 | + enum: |
| 286 | + - "TRUE" |
| 287 | + - "FALSE" |
| 288 | + - "UNKNOWN" |
| 289 | + - "PARTIAL" |
| 290 | + |
| 291 | + MatchRate: |
| 292 | + description: Estimation of the match rate between the area in the request (R), and area where the network locates the device (N), calculated as the percent value of the intersection of both areas divided by the network area, that is (R ∩ N) / N * 100. Included only if VerificationResult is PARTIAL. |
| 293 | + type: integer |
| 294 | + minimum: 1 |
| 295 | + maximum: 99 |
| 296 | + |
| 297 | + LastLocationTime: |
| 298 | + description: Timestamp of the last location information. It must follow RFC 3339 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) |
| 299 | + example: "2023-09-07T10:40:52Z" |
| 300 | + format: date-time |
| 301 | + type: string |
| 302 | + |
| 303 | + ErrorInfo: |
| 304 | + type: object |
| 305 | + required: |
| 306 | + - code |
| 307 | + - message |
| 308 | + properties: |
| 309 | + code: |
| 310 | + type: string |
| 311 | + description: Code given to this error |
| 312 | + message: |
| 313 | + type: string |
| 314 | + description: Detailed error description |
| 315 | + |
| 316 | + responses: |
| 317 | + Generic400: |
| 318 | + description: Invalid input |
| 319 | + content: |
| 320 | + application/json: |
| 321 | + schema: |
| 322 | + $ref: '#/components/schemas/ErrorInfo' |
| 323 | + example: |
| 324 | + code: INVALID_INPUT |
| 325 | + message: 'Invalid input' |
| 326 | + Generic401: |
| 327 | + description: Unauthorized |
| 328 | + content: |
| 329 | + application/json: |
| 330 | + schema: |
| 331 | + $ref: '#/components/schemas/ErrorInfo' |
| 332 | + example: |
| 333 | + code: UNAUTHORIZED |
| 334 | + message: 'Authorization failed: ...' |
| 335 | + Generic403: |
| 336 | + description: Forbidden |
| 337 | + content: |
| 338 | + application/json: |
| 339 | + schema: |
| 340 | + $ref: '#/components/schemas/ErrorInfo' |
| 341 | + example: |
| 342 | + code: FORBIDDEN |
| 343 | + message: 'Operation not allowed: ...' |
| 344 | + Generic404: |
| 345 | + description: Not found |
| 346 | + content: |
| 347 | + application/json: |
| 348 | + schema: |
| 349 | + $ref: '#/components/schemas/ErrorInfo' |
| 350 | + example: |
| 351 | + code: NOT_FOUND |
| 352 | + message: 'The specified resource is not found' |
| 353 | + Generic500: |
| 354 | + description: Internal server error |
| 355 | + content: |
| 356 | + application/json: |
| 357 | + schema: |
| 358 | + $ref: '#/components/schemas/ErrorInfo' |
| 359 | + example: |
| 360 | + code: INTERNAL_SERVER_ERROR |
| 361 | + message: 'Internal server error' |
| 362 | + Generic503: |
| 363 | + description: Service unavailable |
| 364 | + content: |
| 365 | + application/json: |
| 366 | + schema: |
| 367 | + $ref: '#/components/schemas/ErrorInfo' |
| 368 | + example: |
| 369 | + code: SERVICE_UNAVAILABLE |
| 370 | + message: 'Service unavailable' |
0 commit comments