---
title: "Historical contract: Generate Code"
description: "Historical Ordering.co API contract for POST /codes/generate (Generate Code), kept for reference. Use the current API reference for new integrations."
canonical: https://docs.ordering.co/api-reference/guides/history/generate-code/
---

# Historical contract: Generate Code

[]()

> **Historical API contract.** This page describes an earlier API contract. Methods, paths, and responses may differ from the current API.

## Historical meaning

Generate Code

This API endpoint is use to generate a code

## Current API

For new integrations, use the linked current API reference or guide.

[View the current API reference](https://docs.ordering.co/api-reference/#tag/codes/POST/codes/generate)

## Parameters

```json
[
  {
    "name": "api_version",
    "in": "path",
    "schema": {
      "type": "string",
      "default": "v400"
    },
    "required": true
  },
  {
    "name": "language",
    "in": "path",
    "schema": {
      "type": "string",
      "default": "en"
    },
    "required": true
  },
  {
    "name": "project",
    "in": "path",
    "schema": {
      "type": "string",
      "default": "<redacted-personal>"
    },
    "required": true
  }
]
```

## Request body

```json
{
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "required": [
          "type",
          "channel",
          "size"
        ],
        "properties": {
          "type": {
            "type": "integer",
            "format": "int32"
          },
          "channel": {
            "type": "integer",
            "format": "int32"
          },
          "size": {
            "type": "integer",
            "format": "int32"
          },
          "send_data": {
            "type": "string",
            "format": "json"
          },
          "email": {
            "type": "string"
          },
          "cellphone": {
            "type": "integer",
            "format": "int32"
          },
          "country_phone_code": {
            "type": "integer",
            "format": "int32"
          },
          "to": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

## Responses

```json
{
  "200": {
    "description": "200",
    "content": {
      "application/json": {
        "examples": {
          "Result": {
            "value": "{\n  \"error\": false,\n  \"result\": [\n    \"VERIFICATION_CODE_WAS_SENT_TO\"\n  ]\n}"
          }
        },
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "boolean",
              "example": false,
              "default": true
            },
            "result": {
              "type": "array",
              "items": {
                "type": "string",
                "example": "VERIFICATION_CODE_WAS_SENT_TO"
              }
            }
          }
        }
      }
    }
  },
  "400": {
    "description": "400",
    "content": {
      "application/json": {
        "examples": {
          "Result": {
            "value": "{\n  \"error\": true,\n  \"result\": [\n    \"Try get code in 19 seconds.\"\n  ]\n}"
          }
        },
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "boolean",
              "example": true,
              "default": true
            },
            "result": {
              "type": "array",
              "items": {
                "type": "string",
                "example": "Try get code in 19 seconds."
              }
            }
          }
        }
      }
    }
  }
}
```
