Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

283
Vistas
How do I set the origin in the DeepL API on javascript?

What else should I try?

I'm currently sending a request to the DeepL API in axios, but I'm getting a 403 response due to a CORS issue.

And tried to set the option using querystring as shown here, but it didn't work. https://github.com/funkyremi/deepl/blob/master/index.ts Also, using the library at the URL above returns 403.

Furthermore, there is no origin setting in the account settings of DeepL.

I tried using 'Content-Type': 'application/x-www-form-urlencoded' for axios headers: {}, and I also tried setting options for params: { } and not using querystring, but they didn't work.

import axios from 'axios'
import querystring from 'querystring';

export const translateDeepL = async() => {
  const options = {
      "auth_key": process.env.DEEPL_AUTH_KEY,
      "text": 'everyday is birthday.',
      "target_lang": 'JA',
  };
  const url = "https://api-free.deepl.com/v2/translate";
  const data = await axios.post(url, querystring.stringify(options)).then(r => r);
  console.log(data);
}
VM3451:1 POST https://api-free.deepl.com/v2/translate 403

the request use https with ngrok did't work also.

I also tried the GET method for "https://api-free.deepl.com/v2/usage" but got the same result.

It is definitely api-free.deepl.com since I am using the free plan.

By the way, the above code is executed as a component in React.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You might be being blocked because of sending a request from http (your localhost) to https, try using the proxy axios config, like

const response = await axios
.get("https://api-free.deepl.com/v2/translate", {
  params: {
    auth_key: x,
    text: y,
    target_lang: z
  },
  proxy: {
    host: "localhost",
    port: 8080
  }
});

return response; };

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda