{
   "openapi": "3.0.3",
   "info": {
      "title": "Vonage SIM Swap API",
      "x-metaTitle": "Vonage SIM Swap v.0 API Reference | Vonage API Documentation",
      "x-metaDescription": "Find quick answers to questions about the Vonage SIM Swap API in this reference guide. Learn more in Vonage's API documentation.",
      "description": "[SIM Swap API](https://developer.vonage.com/sim-swap/overview) provides the ability to obtain information on any recent SIM pairing change related to a mobile account.\n",
      "termsOfService": "https://www.vonage.com/legal/communications-apis/terms-of-use/",
      "contact": {
         "name": "Vonage Developer Relations",
         "email": "devrel@vonage.com",
         "url": "https://developer.vonage.com/"
      },
      "license": {
         "name": "Apache 2.0",
         "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
      },
      "version": "0.4.0",
      "x-label": "Beta"
   },
   "externalDocs": {
      "description": "Product documentation at Camara",
      "url": "https://github.com/camaraproject/"
   },
   "servers": [
      {
         "url": "https://api-eu.vonage.com/camara/sim-swap/v040/"
      }
   ],
   "paths": {
      "/check": {
         "post": {
            "operationId": "checkSimSwap",
            "summary": "Check SIM swap",
            "security": [
               {
                  "three_legged_check": [
                     "check-sim-swap"
                  ]
               }
            ],
            "tags": [
               "Check SIM swap"
            ],
            "description": "Check if SIM swap has been performed during a past period",
            "requestBody": {
               "description": "Create a check SIM swap request for a MSISDN identifier.\n",
               "content": {
                  "application/json": {
                     "schema": {
                        "$ref": "#/components/schemas/CreateCheckSimSwap"
                     }
                  }
               },
               "required": true
            },
            "responses": {
               "200": {
                  "description": "Returns if the SIM card associated with a phone number has changed within a specified time",
                  "content": {
                     "application/json": {
                        "schema": {
                           "$ref": "#/components/schemas/CheckSimSwapInfo"
                        }
                     }
                  }
               },
               "400": {
                  "$ref": "#/components/responses/Generic400"
               },
               "401": {
                  "$ref": "#/components/responses/Generic401"
               },
               "403": {
                  "$ref": "#/components/responses/Generic403"
               },
               "404": {
                  "$ref": "#/components/responses/Generic404"
               },
               "409": {
                  "$ref": "#/components/responses/Generic409"
               },
               "502": {
                  "$ref": "#/components/responses/Generic502"
               }
            }
         }
      },
      "/retrieve-date": {
         "post": {
            "operationId": "retrieveSimSwapDate",
            "summary": "Retrieve SIM swap date",
            "security": [
               {
                  "three_legged_retrieve": [
                     "retrieve-sim-swap-date"
                  ]
               }
            ],
            "tags": [
               "Retrieve SIM swap date"
            ],
            "description": "Get timestamp of last link between the phone number and a SIM card.",
            "requestBody": {
               "description": "Create a SIM swap date request for a MSISDN identifier.\n",
               "content": {
                  "application/json": {
                     "schema": {
                        "$ref": "#/components/schemas/CreateSimSwapDate"
                     }
                  }
               },
               "required": true
            },
            "responses": {
               "200": {
                  "description": "Contains information about SIM swap change",
                  "content": {
                     "application/json": {
                        "schema": {
                           "$ref": "#/components/schemas/SimSwapInfo"
                        }
                     }
                  }
               },
               "400": {
                  "$ref": "#/components/responses/Generic400"
               },
               "401": {
                  "$ref": "#/components/responses/Generic401"
               },
               "403": {
                  "$ref": "#/components/responses/Generic403"
               },
               "404": {
                  "$ref": "#/components/responses/Generic404"
               },
               "409": {
                  "$ref": "#/components/responses/Generic409"
               },
               "502": {
                  "$ref": "#/components/responses/Generic502"
               }
            }
         }
      }
   },
   "components": {
      "securitySchemes": {
         "three_legged_retrieve": {
            "type": "oauth2",
            "description": "For detailed information on authentication with the SIM Swap API, please refer to our [authentication guide](/getting-started-network/guides/server-authentication?source=sim-swap).\n",
            "flows": {
               "authorizationCode": {
                  "scopes": {
                     "openid dpv:FraudPreventionAndDetection#retrieve-sim-swap-date": "Retrieve SIM Swap date"
                  }
               }
            }
         },
         "three_legged_check": {
            "type": "oauth2",
            "description": "For detailed information on authentication with the SIM Swap API, please refer to our [authentication guide](/getting-started-network/guides/server-authentication?source=sim-swap).\n",
            "flows": {
               "authorizationCode": {
                  "scopes": {
                     "openid dpv:FraudPreventionAndDetection#check-sim-swap": "Check SIM swap"
                  }
               }
            }
         }
      },
      "schemas": {
         "SimSwapInfo": {
            "type": "object",
            "properties": {
               "latestSimChange": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Timestamp of latest SIM swap performed."
               }
            }
         },
         "CheckSimSwapInfo": {
            "type": "object",
            "properties": {
               "swapped": {
                  "type": "boolean",
                  "description": "Indicates whether the SIM card has been swapped during the period within the provided age."
               }
            }
         },
         "PhoneNumber": {
            "type": "string",
            "pattern": "^\\+?[0-9]{5,15}$",
            "example": "+346661113334",
            "description": "Subscriber number in E.164 format starting with country code and optionally prefixed with '+'."
         },
         "ErrorInfo": {
            "type": "object",
            "required": [
               "status",
               "code",
               "message"
            ],
            "properties": {
               "status": {
                  "type": "integer",
                  "description": "HTTP response status code"
               },
               "code": {
                  "type": "string",
                  "description": "Code given to this error"
               },
               "message": {
                  "type": "string",
                  "description": "Detailed error description"
               }
            }
         },
         "CreateCheckSimSwap": {
            "type": "object",
            "required": [
               "phoneNumber"
            ],
            "properties": {
               "phoneNumber": {
                  "$ref": "#/components/schemas/PhoneNumber"
               },
               "maxAge": {
                  "type": "integer",
                  "example": 240,
                  "description": "Period in hours to be checked for SIM swap (optional).\n",
                  "format": "int32",
                  "minimum": 1,
                  "maximum": 2400,
                  "default": 240
               }
            }
         },
         "CreateSimSwapDate": {
            "type": "object",
            "required": [
               "phoneNumber"
            ],
            "properties": {
               "phoneNumber": {
                  "$ref": "#/components/schemas/PhoneNumber"
               }
            }
         }
      },
      "responses": {
         "Generic400": {
            "description": "Problem with the client request",
            "content": {
               "application/json": {
                  "schema": {
                     "$ref": "#/components/schemas/ErrorInfo"
                  },
                  "example": {
                     "status": 400,
                     "code": "INVALID_ARGUMENT",
                     "message": "Client specified an invalid argument, request body or query param"
                  }
               }
            }
         },
         "Generic401": {
            "description": "Authentication problem with the client request",
            "content": {
               "application/json": {
                  "schema": {
                     "$ref": "#/components/schemas/ErrorInfo"
                  },
                  "example": {
                     "status": 401,
                     "code": "UNAUTHENTICATED",
                     "message": "Request not authenticated due to missing, invalid, or expired credentials"
                  }
               }
            }
         },
         "Generic403": {
            "description": "Client does not have sufficient permission",
            "content": {
               "application/json": {
                  "schema": {
                     "$ref": "#/components/schemas/ErrorInfo"
                  },
                  "example": {
                     "status": 403,
                     "code": "PERMISSION_DENIED",
                     "message": "Client does not have sufficient permissions to perform this action"
                  }
               }
            }
         },
         "Generic404": {
            "description": "Resource Not Found",
            "content": {
               "application/json": {
                  "schema": {
                     "$ref": "#/components/schemas/ErrorInfo"
                  },
                  "example": {
                     "status": 404,
                     "code": "SIM_SWAP.UNKNOWN_PHONE_NUMBER",
                     "message": "SIM Swap can't be checked because the phone number is unknown."
                  }
               }
            }
         },
         "Generic409": {
            "description": "Conflict",
            "content": {
               "application/json": {
                  "schema": {
                     "$ref": "#/components/schemas/ErrorInfo"
                  },
                  "example": {
                     "status": 409,
                     "code": "CONFLICT",
                     "message": "Another request is created for the same MSISDN"
                  }
               }
            }
         },
         "Generic502": {
            "description": "Bad Gateway",
            "content": {
               "application/json": {
                  "schema": {
                     "$ref": "#/components/schemas/ErrorInfo"
                  },
                  "example": {
                     "status": 502,
                     "code": "INTERNAL",
                     "message": "Bad Gateway"
                  }
               }
            }
         }
      }
   }
}