{
  "openapi": "3.1.0",
  "info": {
    "title": "Translation API",
    "version": "1.0.0",
    "description": "Translate text between about 100 languages with a model that runs on the platform, no third-party keys.\n\nTranslate text between about 100 languages with the M2M100 model running on the platform. Send a short string with GET or a longer body with POST, and let the API detect the source language or set it yourself. No third-party keys and nothing leaves the platform.",
    "contact": {
      "name": "Data and APIs",
      "url": "https://dataandapis.com/contact"
    },
    "termsOfService": "https://dataandapis.com/terms-of-service",
    "license": {
      "name": "Data and APIs Terms of Service",
      "url": "https://dataandapis.com/terms-of-service"
    },
    "x-logo": {
      "url": "https://dataandapis.com/images/translation.webp"
    }
  },
  "externalDocs": {
    "description": "Documentation, live tester and pricing",
    "url": "https://dataandapis.com/apis/translation"
  },
  "servers": [
    {
      "url": "https://api-translation.dataandapis.com"
    }
  ],
  "tags": [
    {
      "name": "Text Processing",
      "description": "Translation API belongs to the Text Processing category of the Data and APIs catalog."
    }
  ],
  "paths": {
    "/v1/translate": {
      "get": {
        "operationId": "translate",
        "summary": "Translate",
        "description": "Translate endpoint of the Translation API. Costs 25 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/translation/translate"
        },
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "en"
          },
          {
            "name": "text",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "Hello, how are you?"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "es"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "translated_text": "Hola, ¿cómo estás?",
                  "source_lang": "auto",
                  "target_lang": "es"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      },
      "post": {
        "operationId": "translatePost",
        "summary": "Translate (POST)",
        "description": "Translate (POST) endpoint of the Translation API. Costs 25 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/translation/translate-post"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "text": "Hello, how are you?",
                "to": "es",
                "from": "en"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "translated_text": "Hola, ¿cómo está usted?",
                  "source_lang": "en",
                  "target_lang": "es"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Create a free key at https://dataandapis.com/sign-up. 500 tokens a month on the Free plan; this API costs 25 tokens per call."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}