API

RESTful API를 통해 우리 서비스를 사용할 수 있습니다.

요청 형식

요청은 POST 메서드를 사용하여 JSON 형식으로 https://www.imagetotext.com/api/ocr 엔드포인트로 전송해야 합니다. 아래에서 요청 매개변수 목록을 확인할 수 있습니다.

이름
api_key 당신의 API 키. 로그인 후 프로필 페이지에서 확인할 수 있습니다.
api_secret 당신의 API 비밀. 로그인 후 프로필 페이지에서 확인할 수 있습니다.
image Base64로 인코딩된 이미지

응답 형식

응답에는 상태 코드 200과 함께 일반 텍스트 형식의 인식 결과가 포함됩니다.

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 6
Vary: Accept-Encoding
Date: Wed, 23 Oct 2024 18:32:09 GMT
Connection: close

Hello

또는 오류가 발생한 경우 상태 코드 40*의 오류 메시지가 포함됩니다.

HTTP/1.1 404 Not Found
Content-Type: text/html; charset=utf-8
Content-Length: 13
Vary: Accept-Encoding
Date: Wed, 23 Oct 2024 18:29:55 GMT
Connection: close

No text found

예시

Curl 예시

curl -X "POST" "https://www.imagetotext.com/api/ocr" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "api_key": "API_KEY",
    "api_secret": "API_SECRET",
    "image": "iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfUlEQVR4nO2Yz0sqURTHlYxSMzBcuJaWLiRFhMRAXYi5kUAQBGnTMlAEfyAUiNBGSHAh6EJBEDXEtQqFqJvCTf9CMNs2lUj5fdyBJ/iUpy6Gd994P3DBO5c5dzifcc6ZkYBBFZJ/fQGMeZgQymBCKIMJoQwmhDKYEMpgQv5nIdVqFcVicekax3G4u7vD6+vr2vGGwyHu7+9n82w2i8FggG1mIyF2ux16vX7p2vPzMyQSCcrl8trx0uk0jo6OZnONRoNUKoVthgnZNiHkEXR7e4ubmxv0er2NhPz8/KBer+P6+hrJZBLdbhdiR1Ah4XAYUqkUVqsVFosFMpkMwWCQT/QqIZPJBC6XC3K5HG63Gx6PB3t7ewgEAvj+/oZY2VjIwcEBnE7nwjCbzXNCWq0WP280GrPzyR1OjtVqtZVCMpkML5AU/t88PT3xgguFAsTKxkJIAq+urhaG1+udE+Lz+WAymRZiGAwGXF5erhRyenrK/yv+xGg0Lj0uFgR7ZJHEK5VK6HS6uaFQKHB+fr5SiFarRSKRWNjn4uJiqWixIJiQk5MTvnZ0Op2F8fLyspaQWCy2sI/D4ZgJFSOCCfH7/Tg+Pp4VcAL5HYlE0Gw2Vwqx2Ww4Ozub2+Pz8xMqlQrxeBxiRTAhpICTAkza3fF4zCeTJHJ3dxej0WilkFKpxMfL5XJ8x0VihEIh7O/v4+3tDWJF0LY3n8/zdYRIIB3T4eEhKpXKbP1vQqbTKaLRKHZ2dvh2l4hQq9V4eHiAmBH84+L7+zseHx/5F8SPj4+Nz+c4Du12G/1+H19fXxA77GsvZTAhlMGEUAYTQhlMCGUwIZTBhFAGE0IZTAjo4heZTxFod+qzwwAAAABJRU5ErkJggg=="
  }'

Axios를 사용한 JavaScript 예시

axios({
  'method': 'POST',
  'url': 'https://www.imagetotext.com/api/ocr',
  'headers': {
    'Content-Type': 'application/json; charset=utf-8',
  },
  'data': {
    'api_key': 'API_KEY',
    'api_secret': 'API_SECRET',
    'image': 'iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfUlEQVR4nO2Yz0sqURTHlYxSMzBcuJaWLiRFhMRAXYi5kUAQBGnTMlAEfyAUiNBGSHAh6EJBEDXEtQqFqJvCTf9CMNs2lUj5fdyBJ/iUpy6Gd994P3DBO5c5dzifcc6ZkYBBFZJ/fQGMeZgQymBCKIMJoQwmhDKYEMpgQv5nIdVqFcVicekax3G4u7vD6+vr2vGGwyHu7+9n82w2i8FggG1mIyF2ux16vX7p2vPzMyQSCcrl8trx0uk0jo6OZnONRoNUKoVthgnZNiHkEXR7e4ubmxv0er2NhPz8/KBer+P6+hrJZBLdbhdiR1Ah4XAYUqkUVqsVFosFMpkMwWCQT/QqIZPJBC6XC3K5HG63Gx6PB3t7ewgEAvj+/oZY2VjIwcEBnE7nwjCbzXNCWq0WP280GrPzyR1OjtVqtZVCMpkML5AU/t88PT3xgguFAsTKxkJIAq+urhaG1+udE+Lz+WAymRZiGAwGXF5erhRyenrK/yv+xGg0Lj0uFgR7ZJHEK5VK6HS6uaFQKHB+fr5SiFarRSKRWNjn4uJiqWixIJiQk5MTvnZ0Op2F8fLyspaQWCy2sI/D4ZgJFSOCCfH7/Tg+Pp4VcAL5HYlE0Gw2Vwqx2Ww4Ozub2+Pz8xMqlQrxeBxiRTAhpICTAkza3fF4zCeTJHJ3dxej0WilkFKpxMfL5XJ8x0VihEIh7O/v4+3tDWJF0LY3n8/zdYRIIB3T4eEhKpXKbP1vQqbTKaLRKHZ2dvh2l4hQq9V4eHiAmBH84+L7+zseHx/5F8SPj4+Nz+c4Du12G/1+H19fXxA77GsvZTAhlMGEUAYTQhlMCGUwIZTBhFAGE0IZTAjo4heZTxFod+qzwwAAAABJRU5ErkJggg=='
  }
});

PHP 예시

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;

$client = new Client();

$data = [
  'api_key' => 'API_KEY',
  'api_secret' => 'API_SECRET',
  'image' => 'iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfUlEQVR4nO2Yz0sqURTHlYxSMzBcuJaWLiRFhMRAXYi5kUAQBGnTMlAEfyAUiNBGSHAh6EJBEDXEtQqFqJvCTf9CMNs2lUj5fdyBJ/iUpy6Gd994P3DBO5c5dzifcc6ZkYBBFZJ/fQGMeZgQymBCKIMJoQwmhDKYEMpgQv5nIdVqFcVicekax3G4u7vD6+vr2vGGwyHu7+9n82w2i8FggG1mIyF2ux16vX7p2vPzMyQSCcrl8trx0uk0jo6OZnONRoNUKoVthgnZNiHkEXR7e4ubmxv0er2NhPz8/KBer+P6+hrJZBLdbhdiR1Ah4XAYUqkUVqsVFosFMpkMwWCQT/QqIZPJBC6XC3K5HG63Gx6PB3t7ewgEAvj+/oZY2VjIwcEBnE7nwjCbzXNCWq0WP280GrPzyR1OjtVqtZVCMpkML5AU/t88PT3xgguFAsTKxkJIAq+urhaG1+udE+Lz+WAymRZiGAwGXF5erhRyenrK/yv+xGg0Lj0uFgR7ZJHEK5VK6HS6uaFQKHB+fr5SiFarRSKRWNjn4uJiqWixIJiQk5MTvnZ0Op2F8fLyspaQWCy2sI/D4ZgJFSOCCfH7/Tg+Pp4VcAL5HYlE0Gw2Vwqx2Ww4Ozub2+Pz8xMqlQrxeBxiRTAhpICTAkza3fF4zCeTJHJ3dxej0WilkFKpxMfL5XJ8x0VihEIh7O/v4+3tDWJF0LY3n8/zdYRIIB3T4eEhKpXKbP1vQqbTKaLRKHZ2dvh2l4hQq9V4eHiAmBH84+L7+zseHx/5F8SPj4+Nz+c4Du12G/1+H19fXxA77GsvZTAhlMGEUAYTQhlMCGUwIZTBhFAGE0IZTAjo4heZTxFod+qzwwAAAABJRU5ErkJggg=='
];

$request = new Request('POST', 'https://www.imagetotext.com/api/ocr', [
  'Content-Type' => 'application/json; charset=utf-8',
], json_encode($data)
);

try {
  $response = $client->send($request);
  echo sprintf('Response HTTP: %d', $response->getStatusCode());
} catch (\Exception $e) {
  echo sprintf('Error: %s', $e->getMessage());
}