QR 코드 발급 API
QR 코드 발급 API는 옥토모 대표번호 1666-3538로 보낼 문자 본문을 담은 QR 코드를 PNG data URL로 발급합니다. 사용자가 휴대폰으로 스캔하면 본문이 채워진 문자 앱이 열립니다.
POST
https://api.octoverse.kr/octomo/v1/public/message/qr-code문자 본문을 담은 QR 코드를 발급합니다. 사용자가 휴대폰으로 스캔하면 옥토모 대표번호(1666-3538)로 보내는 문자 앱이 본문이 채워진 채 열립니다.
요청
| 메서드 | URL | 인증 방식 |
|---|---|---|
| POST | https://api.octoverse.kr/octomo/v1/public/message/qr-code | API Key |
| 이름 | 값 | 필수 여부 |
|---|---|---|
| Authorization | Octomo {API_KEY} | 필수 |
| Content-Type | application/json | 필수 |
| Accept | application/json | 필수 |
| 이름 | 타입 | 설명 | 필수 여부 | 기본값 |
|---|---|---|---|---|
| text | string | QR에 담을 문자 본문 (예: 3538) | 필수 | 없음 |
| errorCorrectionLevel | string | 오류 정정 수준 L(7%) / M(15%) / Q(25%) / H(30%). 값이 높을수록 손상에 강하지만 패턴이 빽빽해집니다 | 선택 | M |
| margin | integer | 테두리 여백(모듈 칸 수) 0~20 | 선택 | 2 |
| width | integer | QR 이미지 가로 px 100~1000 | 선택 | 200 |
text만 보내면 나머지는 기본값(M / 2 / 200)으로 동작합니다. 허용 범위를 벗어난 값은 400을 반환합니다.
응답
| 이름 | 타입 | 설명 |
|---|---|---|
| qrCode | string | QR 코드 PNG 이미지를 담은 data URL. <img src={qrCode}>로 바로 표시 가능 |
JSON
{
"qrCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...(생략)..."
}에러 코드
요청이 실패하면 해당 HTTP 상태 코드와 함께 아래 형태의 JSON이 반환됩니다. error 필드는 상황에 따라 생략될 수 있습니다.
JSON
{
"statusCode": 401,
"message": "Invalid API Key",
"error": "Unauthorized"
}| HTTP 상태 | 발생 원인 | message 예시 |
|---|---|---|
| 400Bad Request | 요청 본문 검증 실패 — text가 비어 있거나, errorCorrectionLevel(L·M·Q·H)·margin(0~20)·width(100~1000)가 허용 범위를 벗어나거나, 허용되지 않은 필드가 포함된 경우 | errorCorrectionLevel must be one of the following values: L, M, Q, H |
| 401Unauthorized | Authorization 헤더가 없거나 형식(Octomo {API_KEY})이 올바르지 않거나, 잘못되었거나 폐기된 API Key인 경우 | Invalid API Key |
| 403Forbidden | 애플리케이션이 활성(ACTIVE) 상태가 아닌 경우 (구독 중단·정지 등) | 이 애플리케이션은 일시 중단되었습니다. 구독 상태를 확인하세요. |
| 404Not Found | API Key에 해당하는 사용자 또는 애플리케이션을 찾을 수 없는 경우 | 존재하지 않는 유저입니다. |
| 429Too Many Requests | 요청 속도 제한(10초당 100회)을 초과했거나, 플랜별 월 API 호출 한도를 초과한 경우 | 월 API 호출 한도를 초과했습니다. |
| 500Internal Server Error | 서버 내부 오류 또는 일시적인 장애가 발생한 경우 (요청을 다시 시도하거나 지속되면 문의) | Internal server error |
샘플 코드
Node.js
Node.js
import fetch from "node-fetch";
const url = "https://api.octoverse.kr/octomo/v1/public/message/qr-code";
const API_KEY = process.env.OCTOMO_API_KEY;
async function createSmsQrCode(text) {
const res = await fetch(url, {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": `Octomo ${API_KEY}`,
},
body: JSON.stringify({ text }), // 옵션: errorCorrectionLevel, margin, width
});
const data = await res.json();
// data.qrCode → "data:image/png;base64,..." (그대로 <img src>에 사용)
console.log(data.qrCode);
}
createSmsQrCode("3538");Java
Java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class OctomoQrExample {
public static void main(String[] args) throws IOException, InterruptedException {
String url = "https://api.octoverse.kr/octomo/v1/public/message/qr-code";
String apiKey = System.getenv("OCTOMO_API_KEY");
String jsonBody = "{\"text\":\"3538\"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Octomo " + apiKey)
.POST(HttpRequest.BodyPublishers.ofString(jsonBody))
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("HTTP " + response.statusCode());
System.out.println(response.body()); // { "qrCode": "data:image/png;base64,..." }
}
}Python
Python
import os
import requests
url = "https://api.octoverse.kr/octomo/v1/public/message/qr-code"
api_key = os.environ.get("OCTOMO_API_KEY")
res = requests.post(
url,
headers={
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": f"Octomo {api_key}",
},
json={"text": "3538"}, # 옵션: errorCorrectionLevel, margin, width
)
print(res.status_code)
print(res.json()["qrCode"]) # "data:image/png;base64,..."cURL
cURL
curl -X POST \
'https://api.octoverse.kr/octomo/v1/public/message/qr-code' \
-H 'Accept: application/json' \
-H 'Authorization: Octomo {API_KEY}' \
-H 'Content-Type: application/json' \
-d '{ "text": "3538" }'API Key가 있다면 테스트 콘솔에서 직접 호출해 보세요 →