# Update phone Update phone number. This event generates a [Phone updated](https://developers.pismo.io/events/docs/audit-phone-change-1) event. # OpenAPI definition ```json { "openapi": "3.1.0", "info": { "title": "Core platform - Accounts", "version": "1.0.0", "description": "API used to manage accounts domain", "contact": { "name": "API Support", "url": "https://developers.pismo.io/support/" }, "license": { "name": "Copyright Pismo" } }, "servers": [ { "url": "https://sandbox.pismolabs.io", "description": "API server for testing" } ], "tags": [ { "name": "Phones", "description": "Endpoints to manage phones" } ], "components": { "parameters": { "AccountIdPath": { "name": "accountId", "in": "path", "description": "Account ID", "required": true, "schema": { "type": "integer", "format": "int64", "minimum": 1, "example": 123 } }, "PhoneIdPath": { "name": "phoneId", "in": "path", "required": true, "description": "Phone ID", "schema": { "type": "integer", "format": "int64", "example": 456, "minimum": 1 } } }, "schemas": { "AreaCode2": { "type": "integer", "format": "int32", "description": "Phone number area code", "example": 11 }, "BadRequestError": { "type": "object", "title": "BadRequestError", "description": "Bad request error", "properties": { "message": { "type": "string", "description": "Message describing the error" }, "field": { "type": "string", "description": "Text identifying the ill-formatted field" } }, "required": [ "message", "field" ] }, "PhoneActive": { "type": "boolean", "description": "Is phone active? Default is `true`.", "example": false }, "PhoneCountryCode2": { "type": "integer", "description": "Phone number country code", "minimum": 0, "maximum": 99999, "example": 38, "default": 55 }, "PhoneExtension": { "type": "string", "description": "Optional phone number extension", "maxLength": 10, "example": "ext. 9" }, "PhoneID": { "type": "integer", "format": "int64", "description": "Phone ID", "example": 8714 }, "PhoneNumber": { "type": "string", "description": "Phone number", "maxLength": 15, "example": "11912345678" }, "PhoneType": { "type": "string", "description": "Phone number type", "enum": [ "RESIDENTIAL", "COMMERCIAL", "MOBILE" ], "example": "MOBILE" }, "PhoneUpdateRequest": { "type": "object", "description": "Phone number", "properties": { "area_code": { "$ref": "#/components/schemas/AreaCode2" }, "number": { "$ref": "#/components/schemas/PhoneNumber" }, "type": { "$ref": "#/components/schemas/PhoneType" }, "extension": { "$ref": "#/components/schemas/PhoneExtension" }, "active": { "$ref": "#/components/schemas/PhoneActive" }, "country_code": { "$ref": "#/components/schemas/PhoneCountryCode2" } } }, "SimpleError": { "title": "SimpleError", "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string", "description": "Error message" } } } }, "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } } }, "security": [ { "BearerAuth": [] } ], "x-readme": { "explorer-enabled": true, "proxy-enabled": true, "samples-enabled": true }, "paths": { "/accounts/v1/accounts/{accountId}/phones/{phoneId}": { "patch": { "operationId": "patch-accounts-v1-accounts-accountId-phones-phoneId", "summary": "Update phone", "description": "Update phone number.\n\nThis event generates a [Phone updated](https://developers.pismo.io/events/docs/audit-phone-change-1) event.\n", "tags": [ "Phones" ], "parameters": [ { "$ref": "#/components/parameters/AccountIdPath" }, { "$ref": "#/components/parameters/PhoneIdPath" } ], "requestBody": { "description": "Phone entity", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PhoneUpdateRequest" }, "examples": { "Inactivate phone": { "value": { "active": false } } } } } }, "responses": { "200": { "description": "Phone was successfully updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "$ref": "#/components/schemas/PhoneID" } }, "required": [ "id" ] } } } }, "400": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BadRequestError" } } } }, "422": { "description": "Precondition failed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SimpleError" }, "examples": { "Inactive phone": { "value": { "message": "Can't update an inactive phone number" } } } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SimpleError" }, "examples": { "Internal server error": { "value": { "message": "Error updating phone number" } } } } } } } } } } } ```