Getting started overview

Lecto Translation provides a machine translation API designed for integrating translation capabilities into applications, websites, and documents. This guide details the essential steps for new users to begin using the Lecto Translation API, from account registration to making an initial API call. It focuses on practical, actionable steps to ensure a quick setup, assuming familiarity with the Lecto Translation service itself.

The core process involves:

  1. Creating a Lecto account.
  2. Obtaining API keys (also referred to as API credentials or access tokens).
  3. Formulating and executing a sample API request to translate text.

This process is designed to allow developers to quickly verify their setup and begin integrating the service into their projects. Lecto Translation offers a Lecto Free tier for initial testing and development, which includes limited usage capacity.

Quick Reference Steps

The following table provides a high-level overview of the getting started process:

Step What to Do Where
1. Sign Up Register for a new Lecto account. Lecto Homepage
2. Get API Key Locate and copy your unique API key from the dashboard. Lecto Developer Dashboard (post-signup)
3. Review Docs Understand the API structure, endpoints, and parameters. Lecto API Documentation
4. Make Request Construct and send your first translation API call. Your preferred development environment
5. Handle Response Parse the JSON response from the API. Your code

Create an account and get keys

Accessing the Lecto Translation API requires an active Lecto account and associated API keys. These keys authenticate your requests and link them to your usage plan, including the Lecto Free tier.

Account Registration

  1. Navigate to the Lecto homepage.
  2. Look for a "Sign Up" or "Get Started Free" button, typically found in the top navigation or prominent on the landing page.
  3. Complete the registration form, providing necessary details such as email address and password. You may be asked to verify your email address.

After successful registration, you will be directed to your Lecto dashboard or account management area.

Obtaining API Keys

The API key serves as your primary credential for authenticating with the Lecto Translation API. Treat your API key like a password and keep it secure to prevent unauthorized use of your account and quota.

  1. From your Lecto dashboard, locate a section related to "API Keys," "Developer Settings," or "Credentials." The exact naming may vary, but it's usually under a developer or integration-focused menu item.
  2. Generate a new API key if one is not automatically provided. Lecto typically issues a unique string of characters.
  3. Copy the API key immediately. Many services only display the key once upon generation for security reasons. If you lose it, you may need to generate a new key, invalidating the old one.
  4. Store your API key securely. Avoid hardcoding it directly into client-side code or public repositories. Consider using environment variables or a secure configuration management system for server-side applications.

For more detailed instructions on managing API keys, consult the Lecto API documentation on authentication.

Your first request

Once you have your API key, you can make your first translation request. This example uses a common command-line tool, cURL, to demonstrate the basic API interaction, though Lecto also supports various programming languages via its API documentation code examples.

API Endpoint and Parameters

The primary endpoint for text translation is typically a POST request. You will need to specify the text to be translated, the source language, and the target language.

  • Endpoint: https://api.lecto.com/v1/translate (verify this in the official documentation)
  • Method: POST
  • Headers:
    • Content-Type: application/json
    • Authorization: Bearer YOUR_API_KEY (replace YOUR_API_KEY with your actual key)
  • Body (JSON):
    {
      "text": "Hello, world!",
      "source_lang": "en",
      "target_lang": "es"
    }

Example cURL Request

curl -X POST \
  https://api.lecto.com/v1/translate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{ "text": "Hello, world!", "source_lang": "en", "target_lang": "es" }'

Replace YOUR_API_KEY with the actual API key you obtained from your Lecto dashboard.

Expected Response

A successful request will return a JSON object containing the translated text. An example response might look like this:

{
  "translation": "¡Hola, mundo!",
  "source_lang": "en",
  "target_lang": "es"
}

Review the Lecto Translation API reference for a complete list of possible response structures, including error codes.

Common next steps

After successfully completing your first translation request, consider these common next steps to further integrate and optimize your use of the Lecto Translation API:

  1. Explore SDKs: While the API is RESTful and accessible via HTTP, Lecto may offer official or community-contributed SDKs in languages like Python, Java, or Node.js. These SDKs often simplify API interaction by handling authentication, request formatting, and response parsing. Check the Lecto API Documentation for available SDKs.
  2. Implement Error Handling: Integrate robust error handling into your application to manage various API responses, such as rate limits, invalid parameters, or authentication failures. The API documentation details specific error codes and messages.
  3. Manage API Keys Securely: Move your API key out of direct code. For server-side applications, use environment variables. For client-side applications that need to interact with the API, consider proxying requests through your own backend to keep the API key server-side. Review general guidelines for API key security best practices.
  4. Understand Rate Limits and Quotas: Familiarize yourself with the Lecto pricing plans and any associated rate limits or character quotas. This helps prevent unexpected service disruptions or charges.
  5. Explore Advanced Features: Investigate additional API features, such as batch translation, custom glossaries, or domain-specific models, if available and relevant to your use case.
  6. Monitor Usage: Utilize the Lecto dashboard to monitor your API usage, track character consumption, and review billing information. This helps in managing costs and scalability.

Troubleshooting the first call

If your initial API call does not return the expected result, consider the following common issues and troubleshooting steps:

  • Invalid API Key:
    • Symptom: 401 Unauthorized or Authentication Failed error.
    • Resolution: Double-check that you have copied the API key correctly and included it in the Authorization: Bearer header. Ensure there are no leading or trailing spaces. Generate a new key if uncertain.
  • Incorrect Endpoint or Method:
    • Symptom: 404 Not Found or 405 Method Not Allowed error.
    • Resolution: Verify the API endpoint URL (e.g., https://api.lecto.com/v1/translate) and the HTTP method (POST) against the Lecto API documentation.
  • Malformed JSON Body:
    • Symptom: 400 Bad Request or Invalid JSON error.
    • Resolution: Ensure your JSON payload is syntactically correct, with proper quotation marks, commas, and curly braces. Use a JSON validator if necessary. Verify that parameter names (e.g., text, source_lang, target_lang) match those specified in the Lecto API reference.
  • Missing Content-Type Header:
    • Symptom: 415 Unsupported Media Type or similar.
    • Resolution: Confirm that the Content-Type: application/json header is included in your request, especially for POST requests with a JSON body.
  • Rate Limit Exceeded:
    • Symptom: 429 Too Many Requests error.
    • Resolution: If you are on the free tier or a high-volume plan, you might hit rate limits. Review your usage on the Lecto dashboard and check the pricing documentation for limits. Implement exponential backoff for retries if making frequent calls.
  • Incorrect Language Codes:
    • Symptom: 400 Bad Request or Unsupported Language error.
    • Resolution: Ensure that the source_lang and target_lang codes used (e.g., en, es) are valid and supported by Lecto Translation. Consult the Lecto language support documentation for a list of accepted codes.