# Create overdraft product
Create a new overdraft product.
The overdraft API enables a bank to set an overdraft limit for an account when the balance is insufficient. For details, refer to [How overdraft works](doc:how-overdraft-works).
This endpoint generates an [Overdraft product created](https://developers.pismo.io/events/docs/overdraft-product-creation-1) event.
# OpenAPI definition
```json
{
"openapi": "3.0.0",
"info": {
"title": "Banking - Overdraft",
"version": "1.0.0",
"description": "This API manages overdraft functionality, allowing account holders to perform debit transactions even with an insufficient balance. Additionally, it enables the configuration of grace periods and interest rates for overdrafts.",
"contact": {
"name": "API Support",
"url": "https://developers.pismo.io/support/"
},
"license": {
"name": "Copyright Pismo"
}
},
"servers": [
{
"url": "https://sandbox.pismolabs.io/overdraft",
"description": "Sandbox API server for testing"
}
],
"security": [
{
"BearerAuth": []
}
],
"tags": [
{
"name": "Product",
"description": "Endpoints that manage overdraft products"
}
],
"components": {
"schemas": {
"CreateProductRequest": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Overdraft product name. This name is defined by the client.",
"example": "Overdraft Limit 1000"
},
"interest_plan_id": {
"type": "string",
"format": "uuid",
"description": "Interest plan ID generated during the plan's creation. Created via the [Create interest plan](https://developers.pismo.io/pismo-docs/reference/post-v1-interest-plan-1) endpoint.",
"example": "b935acaf-886c-4817-8f7c-c2cc3ce4d509"
},
"processing_code": {
"$ref": "#/components/schemas/ProcessingCode"
},
"grace_period": {
"type": "integer",
"description": "Grace period during which you can restore the balance without incurring any interest charges. The unit is measured in days.",
"example": 10
}
},
"required": [
"name",
"interest_plan_id",
"processing_code"
]
},
"ErrorResponse": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "Error code",
"example": "EOVD0001"
},
"message": {
"type": "string",
"description": "Error message",
"example": "Error"
},
"details": {
"type": "string",
"description": "Details about the error",
"example": "Error details"
}
}
},
"ProcessingCode": {
"type": "object",
"properties": {
"interest_processing_code": {
"type": "string",
"description": "Processing code for interest calculation",
"example": "123456"
}
},
"required": [
"interest_processing_code"
]
},
"Product": {
"type": "object",
"properties": {
"product_id": {
"type": "string",
"format": "uuid",
"description": "Product ID generated for an overdraft product. Once this ID is created, you must link it to your account ID."
},
"name": {
"type": "string",
"description": "Produt name",
"example": "Overdraft Limit 1000"
},
"interest_plan_id": {
"type": "string",
"format": "uuid",
"description": "Interest plan ID generated during the plan's creation. Created via the [Create interest plan](https://developers.pismo.io/pismo-docs/reference/post-v1-interest-plan-1) endpoint."
},
"grace_period": {
"type": "integer",
"description": "Grace period during which you can restore the balance without incurring any interest charges. The unit is measured in days."
},
"processing_code": {
"$ref": "#/components/schemas/ProcessingCode"
},
"status": {
"type": "string",
"format": "enum",
"description": "Overdraft product status.
\n* `CREATED`: When you successfully created an overdraft product.\n* `ACTIVE`: When you attach your overdraft product to an account or a program ID. Once it's attached, the product becomes `ACTIVE`.\n",
"enum": [
"CREATED",
"ACTIVE"
]
},
"created_at_datetime": {
"type": "string",
"format": "date-time",
"description": "Product created datetime. Format: `YYYY-MM-DDThh:mm:ss.sss`.\n"
}
}
}
},
"securitySchemes": {
"BearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
},
"responses": {
"201CreateOverdraftProductResponse": {
"description": "Product created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Product"
},
"examples": {
"Product created successfully": {
"$ref": "#/components/examples/200201ProductCreatedSuccessfulExample"
}
}
}
}
},
"400CreateOverdraftProductErrorResponse": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"Validation error": {
"$ref": "#/components/examples/EOVD0008"
},
"Unmarshal error": {
"$ref": "#/components/examples/EOVD0012"
},
"Interest plan API 4xx error": {
"$ref": "#/components/examples/EOVD0020"
},
"Unicode escape sequence error": {
"$ref": "#/components/examples/EOVD0076"
}
}
}
}
},
"404CreateOverdraftProductErrorResponse": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"Interest plan not found": {
"$ref": "#/components/examples/EOVD0021"
}
}
}
}
},
"422CreateOverdraftProductErrorResponse": {
"description": "Unprocessable entity",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"Payments API 4xx error": {
"$ref": "#/components/examples/EOVD0027"
}
}
}
}
},
"500CreateOverdraftProductErrorResponse": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"Internal error": {
"$ref": "#/components/examples/EOVD0007"
},
"Interest plan API request error": {
"$ref": "#/components/examples/EOVD0015"
},
"Interest plan API request timeout": {
"$ref": "#/components/examples/EOVD0016"
},
"Interest plan API unmarshal response error": {
"$ref": "#/components/examples/EOVD0017"
},
"Interest plan API unmapped response code error": {
"$ref": "#/components/examples/EOVD0018"
},
"Interest plan API 5xx error": {
"$ref": "#/components/examples/EOVD0019"
},
"Payments API request error": {
"$ref": "#/components/examples/EOVD0022"
},
"Payments API request timeout": {
"$ref": "#/components/examples/EOVD0023"
},
"Payments API unmarshal response error": {
"$ref": "#/components/examples/EOVD0024"
},
"Payments API 5xx error": {
"$ref": "#/components/examples/EOVD0025"
},
"Payments API unmapped response code error": {
"$ref": "#/components/examples/EOVD0026"
},
"Save product error": {
"$ref": "#/components/examples/EOVD0028"
},
"Send event error": {
"$ref": "#/components/examples/EOVD0029"
}
}
}
}
}
},
"examples": {
"200201ProductCreatedSuccessfulExample": {
"summary": "Product created successful",
"value": {
"product_id": "2c336e9d-d04f-4fd0-8f6e-25808f48d70c",
"name": "Overdraft limit 1000",
"interest_plan_id": "b935acaf-886c-4817-8f7c-c2cc3ce4d509",
"grace_period": 10,
"processing_code": {
"interest_processing_code": "123456"
},
"status": "CREATED",
"created_at_datetime": "2024-01-23T13:26:25"
}
},
"EOVD0008": {
"summary": "Validation error",
"value": {
"code": "EOVD0008",
"message": "Validation error"
}
},
"EOVD0012": {
"summary": "Unmarshal error",
"value": {
"code": "EOVD0012",
"message": "Unmarshal error"
}
},
"EOVD0020": {
"summary": "Interest plan API 4xx error",
"value": {
"code": "EOVD0020",
"message": "Interest Plan API - Request returned error 4xx"
}
},
"EOVD0076": {
"summary": "Unicode escape sequence error",
"value": {
"code": "EOVD0076",
"message": "Request contains Unicode escape sequences, which are not allowed. Remove all Unicode escape sequences from the request."
}
},
"EOVD0021": {
"summary": "Interest plan not found",
"value": {
"code": "EOVD0021",
"message": "Interest plan API - Interest plan not found"
}
},
"EOVD0027": {
"summary": "Payments API 4xx error",
"value": {
"code": "EOVD0027",
"message": "Payments API - Request returned error 4xx"
}
},
"EOVD0007": {
"summary": "Internal error",
"value": {
"code": "EOVD0007",
"message": "Internal error"
}
},
"EOVD0015": {
"summary": "Interest plan API request error",
"value": {
"code": "EOVD0015",
"message": "Interest plan API - Request error"
}
},
"EOVD0016": {
"summary": "Interest plan API request timeout",
"value": {
"code": "EOVD0016",
"message": "Interest plan API - Request timeout"
}
},
"EOVD0017": {
"summary": "Interest plan API unmarshal response",
"value": {
"code": "EOVD0017",
"message": "Interest plan API - Failed to unmarshal response body"
}
},
"EOVD0018": {
"summary": "Interest plan API unmapped response code",
"value": {
"code": "EOVD0018",
"message": "Interest plan API - Returned an unmapped response code"
}
},
"EOVD0019": {
"summary": "Interest plan API 5xx error",
"value": {
"code": "EOVD0019",
"message": "Interest plan API - Request returned error 5xx"
}
},
"EOVD0022": {
"summary": "Payments API request error",
"value": {
"code": "EOVD0022",
"message": "Payments API - Request error"
}
},
"EOVD0023": {
"summary": "Payments API request timeout",
"value": {
"code": "EOVD0023",
"message": "Payments API - Request timeout"
}
},
"EOVD0024": {
"summary": "Payments API unmarshal response",
"value": {
"code": "EOVD0024",
"message": "Payments API - Failed to unmarshal response body"
}
},
"EOVD0025": {
"summary": "Payments API 5xx error",
"value": {
"code": "EOVD0025",
"message": "Payments API - Request returned error 5xx"
}
},
"EOVD0026": {
"summary": "Payments API unmapped response code",
"value": {
"code": "EOVD0026",
"message": "Payments API - Returned an unmapped response code"
}
},
"EOVD0028": {
"summary": "Save product error",
"value": {
"code": "EOVD0028",
"message": "Failed to save product"
}
},
"EOVD0029": {
"summary": "Send event error",
"value": {
"code": "EOVD0029",
"message": "Error on sending event to topic"
}
}
}
},
"paths": {
"/v1/overdraft": {
"post": {
"tags": [
"Product"
],
"summary": "Create overdraft product",
"description": "Create a new overdraft product.
\nThe overdraft API enables a bank to set an overdraft limit for an account when the balance is insufficient. For details, refer to [How overdraft works](https://developers.pismo.io/pismo-docs/docs/how-overdraft-works).
\nThis endpoint generates an [Overdraft product created](https://developers.pismo.io/events/docs/overdraft-product-creation-1) event.\n",
"operationId": "post-overdraft-product",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateProductRequest"
}
}
}
},
"responses": {
"201": {
"$ref": "#/components/responses/201CreateOverdraftProductResponse"
},
"400": {
"$ref": "#/components/responses/400CreateOverdraftProductErrorResponse"
},
"404": {
"$ref": "#/components/responses/404CreateOverdraftProductErrorResponse"
},
"422": {
"$ref": "#/components/responses/422CreateOverdraftProductErrorResponse"
},
"500": {
"$ref": "#/components/responses/500CreateOverdraftProductErrorResponse"
}
}
}
}
}
}
```