> ## Documentation Index
> Fetch the complete documentation index at: https://docs.menuia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Imagem/PDF para Texto

## Descricao

Este endpoint permite converter arquivos de imagem ou PDF para texto. O arquivo pode ser enviado como URL ou como base64, e a API retornara o texto extraido.

### Parametros

<ParamField body="authkey" type="string" required>
  Chave de autenticacao da API.
</ParamField>

<ParamField body="file" type="string" required>
  O arquivo a ser processado, que pode ser enviado como URL ou em formato base64.
</ParamField>

<ParamField body="format" type="string" required>
  O formato do arquivo, que pode ser "image", "pdf", "JPG", "PNG", etc.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://textscan.menuia.com/api/media \
    -H "Content-Type: application/json" \
    -d '{
      "authkey": "SUA_AUTHKEY_AQUI",
      "file": "https://exemplo.com/documento.pdf",
      "format": "pdf"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://textscan.menuia.com/api/media', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      authkey: 'SUA_AUTHKEY_AQUI',
      file: 'https://exemplo.com/documento.pdf',
      format: 'pdf'
    })
  });
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://textscan.menuia.com/api/media',
      json={
          'authkey': 'SUA_AUTHKEY_AQUI',
          'file': 'https://exemplo.com/documento.pdf',
          'format': 'pdf'
      }
  )
  ```

  ```php PHP theme={null}
  $response = Http::post('https://textscan.menuia.com/api/media', [
      'authkey' => 'SUA_AUTHKEY_AQUI',
      'file' => 'https://exemplo.com/documento.pdf',
      'format' => 'pdf'
  ]);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Sucesso theme={null}
  {
    "status": 200,
    "message": "Arquivo processado com sucesso.",
    "text": "Conteudo extraido do arquivo PDF ou imagem aparece aqui..."
  }
  ```

  ```json 401 - Erro de autenticacao theme={null}
  {
    "status": 401,
    "message": "Authkey invalida ou expirada."
  }
  ```

  ```json 400 - Erro de validacao theme={null}
  {
    "status": 400,
    "message": "Formato de arquivo nao suportado."
  }
  ```

  ```json 422 - Erro de processamento theme={null}
  {
    "status": 422,
    "message": "Nao foi possivel extrair texto do arquivo."
  }
  ```
</ResponseExample>
