{
   "openapi": "3.0.0",
   "info": {
      "version": "1.0.0",
      "title": "Emergency Calling Provisioning API",
      "description": "The Emergency Calling Provisioning API lets you manage emergency calling configuration"
   },
   "servers": [
      {
         "url": "https://api.nexmo.com/v1/emergency"
      }
   ],
   "paths": {
      "/numbers/{number}": {
         "get": {
            "security": [
               {
                  "basicAuth": []
               }
            ],
            "tags": [
               "Numbers Emergency Configuration"
            ],
            "parameters": [
               {
                  "name": "number",
                  "required": true,
                  "in": "path",
                  "description": "Filter by number",
                  "schema": {
                     "type": "string",
                     "example": "15500900000"
                  }
               }
            ],
            "summary": "Get number emergency information",
            "description": "Get number emergency information",
            "operationId": "getEmergencyNumberInformation",
            "responses": {
               "200": {
                  "description": "OK",
                  "content": {
                     "application/json": {
                        "schema": {
                           "$ref": "#/components/schemas/NumberObject"
                        }
                     }
                  }
               },
               "401": {
                  "$ref": "#/components/responses/BadCredentialsError"
               },
               "404": {
                  "$ref": "#/components/responses/NotFoundError"
               }
            }
         },
         "patch": {
            "security": [
               {
                  "basicAuth": []
               }
            ],
            "tags": [
               "Numbers Emergency Configuration"
            ],
            "parameters": [
               {
                  "name": "number",
                  "required": true,
                  "in": "path",
                  "description": "Update emergency address of number",
                  "schema": {
                     "type": "string",
                     "example": "15500900000"
                  }
               }
            ],
            "summary": "Assign emergency address to number.",
            "description": "Assign emergency address to number. Use empty string as id to disassociate",
            "operationId": "patchEmergencyNumberAddress",
            "requestBody": {
               "description": "Assign Emergency Address to number",
               "content": {
                  "application/json": {
                     "schema": {
                        "oneOf": [
                           {
                              "$ref": "#/components/schemas/NumberObjectUpdate"
                           }
                        ]
                     }
                  }
               }
            },
            "responses": {
               "200": {
                  "description": "OK",
                  "content": {
                     "application/json": {
                        "schema": {
                           "$ref": "#/components/schemas/NumberObject"
                        }
                     }
                  }
               },
               "401": {
                  "$ref": "#/components/responses/BadCredentialsError"
               },
               "404": {
                  "$ref": "#/components/responses/NotFoundError"
               }
            }
         }
      }
   },
   "components": {
      "securitySchemes": {
         "basicAuth": {
            "type": "http",
            "scheme": "basic"
         }
      },
      "schemas": {
         "number": {
            "type": "string",
            "example": "15500900000",
            "description": "An available inbound virtual number."
         },
         "contact_name": {
            "title": "Contact Name",
            "type": "string",
            "example": "John Smith",
            "description": "Person of contact in case of emergency"
         },
         "id": {
            "title": "Address ID",
            "type": "string",
            "example": "c49f3586-9b3b-458b-89fc-3c8beb58865c",
            "description": "Vonage Address unique ID"
         },
         "address_name": {
            "title": "Address friendly name",
            "type": "string",
            "example": "myaddress",
            "minLength": 2,
            "maxLength": 32,
            "description": "A friendly name to identify the address"
         },
         "address_line1": {
            "title": "Address line 1",
            "type": "string",
            "example": "1 REGAL CT",
            "description": "First line of the full address"
         },
         "address_line2": {
            "title": "Address line 2",
            "type": "string",
            "example": "Merchant's House 205",
            "description": "Second line of the full address"
         },
         "city": {
            "title": "City",
            "type": "string",
            "example": "New York",
            "description": "The city where this address is located"
         },
         "region": {
            "title": "State or region",
            "type": "string",
            "example": "NJ",
            "description": "The state or region of the address"
         },
         "address_type": {
            "title": "Type of address",
            "type": "string",
            "enum": [
               "emergency"
            ],
            "example": "emergency",
            "description": "Type of address"
         },
         "address_location_type": {
            "title": "Address Location type",
            "type": "string",
            "enum": [
               "business",
               "residential"
            ],
            "example": "business",
            "default": "business",
            "description": "Addrss location type as a business or domestic"
         },
         "postal_code": {
            "title": "Postal Code / Zip Code",
            "type": "string",
            "example": "10002",
            "description": "The Postal Code of this address"
         },
         "country": {
            "title": "Country",
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "example": "US",
            "description": "The two character country code in ISO 3166-1 alpha-2 format"
         },
         "ProvisionedAddressObject": {
            "title": "Address",
            "type": "object",
            "properties": {
               "id": {
                  "$ref": "#/components/schemas/id"
               },
               "address_name": {
                  "$ref": "#/components/schemas/address_name"
               },
               "address_line1": {
                  "$ref": "#/components/schemas/address_line1"
               },
               "address_line2": {
                  "$ref": "#/components/schemas/address_line2"
               },
               "city": {
                  "$ref": "#/components/schemas/city"
               },
               "region": {
                  "$ref": "#/components/schemas/region"
               },
               "type": {
                  "$ref": "#/components/schemas/address_type"
               },
               "address_location_type": {
                  "$ref": "#/components/schemas/address_location_type"
               },
               "postal_code": {
                  "$ref": "#/components/schemas/postal_code"
               },
               "country": {
                  "$ref": "#/components/schemas/country"
               }
            }
         },
         "NumberObject": {
            "title": "Numbers with provisioned address",
            "type": "object",
            "required": [
               "number"
            ],
            "properties": {
               "number": {
                  "$ref": "#/components/schemas/number"
               },
               "contact_name": {
                  "$ref": "#/components/schemas/contact_name"
               },
               "address": {
                  "$ref": "#/components/schemas/ProvisionedAddressObject"
               }
            }
         },
         "instance": {
            "description": "Instance ID",
            "type": "string",
            "example": "797a8f199c45014ab7b08bfe9cc1c12c"
         },
         "NumberObjectUpdate": {
            "title": "Address to assign",
            "type": "object",
            "required": [
               "address"
            ],
            "properties": {
               "address": {
                  "type": "object",
                  "required": [
                     "id"
                  ],
                  "properties": {
                     "id": {
                        "$ref": "#/components/schemas/id"
                     }
                  }
               },
               "contact_name": {
                  "$ref": "#/components/schemas/contact_name"
               }
            }
         }
      },
      "responses": {
         "BadCredentialsError": {
            "description": "Credential is missing or invalid",
            "content": {
               "application/json": {
                  "schema": {
                     "properties": {
                        "type": {
                           "type": "string",
                           "example": "https://developer.vonage.com/api-errors#unauthorized"
                        },
                        "title": {
                           "type": "string",
                           "example": "Invalid credentials supplied"
                        },
                        "detail": {
                           "type": "string",
                           "example": "You did not provide correct credentials."
                        },
                        "instance": {
                           "$ref": "#/components/schemas/instance"
                        }
                     }
                  }
               }
            }
         },
         "NotFoundError": {
            "description": "Resource Not Found",
            "content": {
               "application/json": {
                  "schema": {
                     "properties": {
                        "type": {
                           "type": "string",
                           "example": "https://developer.vonage.com/api-errors#not-found"
                        },
                        "title": {
                           "type": "string",
                           "example": "Not Found"
                        },
                        "detail": {
                           "type": "string",
                           "example": "ID 'ABC123' does not exist, or you do not have access"
                        },
                        "instance": {
                           "$ref": "#/components/schemas/instance"
                        }
                     }
                  }
               }
            }
         }
      }
   }
}