# Create phone Create a new phone number for the specified account. This event generates a [Phone created](https://developers.pismo.io/events/docs/audit-phone-creation-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 } }, "XCustomerIdHeader": { "in": "header", "name": "x-customer-id", "schema": { "type": "integer", "format": "int64", "description": "Customer ID", "example": 50624 } } }, "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" }, "PhoneRequest": { "type": "object", "description": "Phone number", "required": [ "number", "type" ], "properties": { "number": { "$ref": "#/components/schemas/PhoneNumber" }, "type": { "$ref": "#/components/schemas/PhoneType" }, "active": { "$ref": "#/components/schemas/PhoneActive" }, "area_code": { "$ref": "#/components/schemas/AreaCode2" }, "country_code": { "$ref": "#/components/schemas/PhoneCountryCode2" }, "extension": { "$ref": "#/components/schemas/PhoneExtension" } } }, "PhoneType": { "type": "string", "description": "Phone number type", "enum": [ "RESIDENTIAL", "COMMERCIAL", "MOBILE" ], "example": "MOBILE" }, "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": { "post": { "operationId": "post-accounts-v1-accounts-accountId-phones", "summary": "Create phone", "description": "Create a new phone number for the specified account.\n\nThis event generates a [Phone created](https://developers.pismo.io/events/docs/audit-phone-creation-1) event.\n", "tags": [ "Phones" ], "parameters": [ { "$ref": "#/components/parameters/AccountIdPath" }, { "$ref": "#/components/parameters/XCustomerIdHeader" } ], "requestBody": { "description": "Phone entity", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PhoneRequest" }, "examples": { "Phone number": { "value": { "area_code": 11, "number": "91234-5678", "type": "MOBILE", "extension": "ext 123", "active": true } } } } } }, "responses": { "200": { "description": "The phone was successfully created", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "$ref": "#/components/schemas/PhoneID" } }, "required": [ "id" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BadRequestError" } } } }, "409": { "description": "Conflict", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SimpleError" }, "examples": { "Duplicated phone number": { "value": { "message": "Phone number already exists" } } } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SimpleError" }, "examples": { "Internal server error": { "value": { "message": "Error creating phone number" } } } } } } } } } } } ```