# Create status Create an account status on the platform. When a new account status is created, its initial `state` (see response) is `ACTIVE`. This endpoint generates an [Account status created](https://developers.pismo.io/events/docs/account-status-creation-1) event. Refer to the [Account status](doc:accounts-overview#account-status) guide section for more information. # 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": "Statuses and reasons", "description": "Endpoints to configure accounts, statuses, and reasons." } ], "components": { "schemas": { "AccountStatusDescription": { "type": "string", "description": "Account status description", "maxLength": 500, "example": "Full operational account" }, "AccountStatusID": { "type": "integer", "format": "int64", "description": "Account status ID", "example": 1234567890 }, "AccountStatusName2": { "type": "string", "description": "Account status name. Pre-defined account statuses include `DEBIT_ONLY`, `NORMAL`, `BLOCKED` and `CANCELLED`. You can create your own account statuses with the [Create status](https://developers.pismo.io/pismo-docs/reference/v4-post-account-status) endpoint. \n", "pattern": "^[A-Z_]+$", "maxLength": 200, "example": "NORMAL" }, "AllowedOperations": { "type": "string", "description": "Allowed operations for this status.\n\nPossible values:\n* `ALL_OPERATIONS`—Both credit and debit operations are allowed.\n* `CREDIT_ONLY`—Only credit operations allowed.\n* `DEBIT_ONLY`—Only debit operations allowed.\n* `NO_OPERATIONS`—Neither account credit nor debit operations allowed.\n", "enum": [ "ALL_OPERATIONS", "CREDIT_ONLY", "DEBIT_ONLY", "NO_OPERATIONS" ], "example": "ALL_OPERATIONS" }, "ExternalServiceCode": { "type": "string", "description": "Code returned from the external service" }, "IsFinalStatus": { "type": "boolean", "description": "Is this a final status? An account with a final status cannot have its status updated. Defaults to `false`.\n\n**Note:** Even if a status is final, it can still be [rolled back](https://developers.pismo.io/pismo-docs/reference/patch-v2-accounts-accountid-status-rollback).\n", "example": false }, "MessageDetailsResponse": { "type": "object", "description": "Object response for a user message", "properties": { "payload": { "type": "array", "description": "Details for the request payload errors", "items": { "$ref": "#/components/schemas/MessagePayloadResponse" } }, "parameters": { "type": "array", "description": "Details for the query parameter errors", "items": { "$ref": "#/components/schemas/MessageParameterResponse" } }, "external": { "type": "array", "description": "Details for the external service error", "items": { "$ref": "#/components/schemas/MessageExternalResponse" } } } }, "MessageExternalResponse": { "type": "object", "description": "Object response for detailing external errors for a user message", "properties": { "code": { "$ref": "#/components/schemas/ExternalServiceCode" }, "message": { "type": "string", "description": "Message description from the external service" } } }, "MessageParameterResponse": { "type": "object", "description": "Object response for detailing query parameters errors for a user message", "properties": { "field": { "$ref": "#/components/schemas/ValidationErrorField" }, "message": { "$ref": "#/components/schemas/ValidationErrorMessage" } } }, "MessagePayloadResponse": { "type": "object", "description": "Object response for detailing request payload errors for a user message", "properties": { "field": { "$ref": "#/components/schemas/ValidationErrorField" }, "message": { "$ref": "#/components/schemas/ValidationErrorMessage" } } }, "UserMessageCode": { "type": "string", "description": "Code that identifies the user message", "example": "EACC0000" }, "UserMessage": { "type": "string", "description": "User message", "example": "Timeout while executing the request" }, "MessageResponse": { "type": "object", "description": "Object response for user message", "properties": { "code": { "$ref": "#/components/schemas/UserMessageCode" }, "message": { "$ref": "#/components/schemas/UserMessage" }, "details": { "$ref": "#/components/schemas/MessageDetailsResponse" } } }, "StatusCreate": { "type": "object", "description": "Account status object", "required": [ "name", "allowed_operations" ], "properties": { "name": { "$ref": "#/components/schemas/AccountStatusName2" }, "allowed_operations": { "$ref": "#/components/schemas/AllowedOperations" }, "description": { "$ref": "#/components/schemas/AccountStatusDescription" }, "is_final": { "$ref": "#/components/schemas/IsFinalStatus" } } }, "StatusResponse": { "type": "object", "description": "Object response for account status", "properties": { "status_id": { "$ref": "#/components/schemas/AccountStatusID" }, "name": { "$ref": "#/components/schemas/AccountStatusName2" }, "description": { "$ref": "#/components/schemas/AccountStatusDescription" }, "state": { "$ref": "#/components/schemas/StatusState" }, "is_final": { "$ref": "#/components/schemas/IsFinalStatus" }, "allowed_operations": { "$ref": "#/components/schemas/AllowedOperations" } } }, "StatusState": { "type": "string", "description": "Status state", "enum": [ "ACTIVE", "INACTIVE" ], "example": "ACTIVE" }, "ValidationErrorField": { "type": "string", "description": "Non-valid field" }, "ValidationErrorMessage": { "type": "string", "description": "Validation error description" } }, "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } } }, "security": [ { "BearerAuth": [] } ], "x-readme": { "explorer-enabled": true, "proxy-enabled": true, "samples-enabled": true }, "paths": { "/accounts/v4/statuses": { "post": { "operationId": "v4-post-account-status", "summary": "Create status", "description": "Create an account status on the platform.\n\nWhen a new account status is created, its initial `state` (see response) is `ACTIVE`. \n\nThis endpoint generates an [Account status created](https://developers.pismo.io/events/docs/account-status-creation-1) event.\n\nRefer to the [Account status](https://developers.pismo.io/pismo-docs/docs/accounts-overview#account-status) guide section for more information.\n", "tags": [ "Statuses and reasons" ], "parameters": [], "requestBody": { "description": "Account status details", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StatusCreate" }, "examples": { "Required payload": { "value": { "name": "NORMAL", "allowed_operations": "ALL_OPERATIONS" } }, "Full payload": { "value": { "name": "NORMAL", "description": "Active account with all operations available.", "is_final": false, "allowed_operations": "ALL_OPERATIONS" } } } } } }, "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StatusResponse" }, "examples": { "Default response": { "value": { "status_id": 2, "group": "ALL_OPERATIONS", "name": "NORMAL", "description": "Active account with all operations available.", "state": "ACTIVE", "is_final": false } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageResponse" }, "examples": { "Invalid payload": { "value": { "code": "EACC0004", "message": "Failed during validation of request payload", "detail": { "payload": [ { "field": "group", "message": "Value should be one of: ALL_OPERATIONS, CREDIT_ONLY, DEBIT_ONLY, and NO_OPERATIONS" }, { "field": "name", "message": "Field is required" } ] } } } } } } }, "409": { "description": "Conflict", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageResponse" }, "examples": { "Duplicated name": { "value": { "code": "EACC0018", "message": "Account status already exists with key(s): 'NORMAL'" } } } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageResponse" }, "examples": { "Timeout execution": { "value": { "code": "EACC0000", "message": "Timeout while executing the request" } }, "Invalid payload": { "value": { "code": "EACC0003", "message": "Failed to parse request payload" } }, "Generic message": { "value": { "code": "EACC9999", "message": "Something went wrong, please try again later" } } } } } } } } } } } ```