I Tried Wiring Public APIs to AI Agents and Got Lost on the National Law Website
I Tried Wiring Public APIs to AI Agents and Got Lost on the National Law Website
I want to build an environment where AI agents can put public data to work freely.
The idea: an external AI agent connects to my homepage cursorai.co.kr, requests the data it needs, and my server calls the government agency's API on its behalf and hands back the result.
In plain terms, I'm building a shared data counter that AI agents can use.
I plan to run it for free. I get and manage the API keys, and other agents go through my server to use the data.
But once I actually started, it turned out to be harder than I expected.
First attempt: the weather API
I started with the Korea Meteorological Administration.
I found the API on the Public Data Portal, applied for it with a developer account, and even wrote up the purpose. The daily call limit is 10,000, which looked fine for a service just getting off the ground.
I figured I could use the real-time and short-term forecast endpoints so agents could pull weather data.
I'd already set up safeguards on the server — hourly caching, per-minute request limits. I wasn't planning to just wire the API straight through; I wanted to run it with call volume under control.
Then a worry occurred to me.
Even if wiring up one public API isn't hard, what happens to the server when I scale this to 10 or 20 services?
Do I have to serialize everything, or allow concurrent requests but cap them?
My thinking settled on this: managing actual request volume and concurrency matters more than the number of APIs itself.
Second attempt: the law API
Next up: the Ministry of Government Legislation.
I figured that if an AI agent could pull actual statute data when asked a legal question, that would be genuinely useful.
I went to the National Law Information Center's shared-use site and applied for an OPEN API.
The application screen said auto-approval, and my application list showed an approved status.
"Oh, this'll be quick, then."
Thinking that was my mistake.
I got the approval, but I couldn't figure out where I was supposed to actually call the API.
Digging through the site, I found a menu called Developer Lab.
Statute Korean URL, sample source code, statute list support, IP access history, error self-diagnosis...
I started clicking through one by one.
I thought it was an API — turns out it's a download service
I found a menu called Statute List Support.
By the name alone it looked like the place to pull statute data via API. Going in, it turned out to be a feature for downloading lists as HTML, Excel, XML, or CSV.
Oh — this isn't an API call screen, it's a service for downloading the statute list as a file.
So I ended up back where I started.
I need to check the sample source code menu and figure out how the actual request URL and credentials are meant to be used.
I applied, and now I'm hunting for instructions on how to use it.
If you're a developer, this might feel familiar. It looks like one button press and you're done, but once you're in, there are several menus and you have to figure out which one holds the feature you're after.
We've reached the era where AI writes the code, but that doesn't mean the human's job has disappeared.
If anything, the process of deciding what to build, checking the official docs, and verifying that it actually works has become more important.
What I want to build is not a list of API links
My goal isn't a site that just collects public API links.
I want an environment where an external AI agent discovers my homepage, figures out what data is available, and can actually request it and get results back.
I plan to start with weather and connect statutes, statistics, tourism information, and so on one at a time.
Of course, each API has its own terms of use, so I need to check whether relaying it to external agents is allowed. Just because an API is free doesn't mean you can necessarily re-provide it to other users.
I'll start within what the server can handle and scale up gradually as I watch usage.
I got a little lost on the law site today, but at least I can now tell which menu is the download feature and where I need to look for the calling instructions.
Nothing's finished yet.
Still, I'm building it by hitting each thing head-on, one at a time.
The application was approved — but I still haven't managed to call the API.
That's today's dev log. hahaha
AI Knowledge Hub
Comments (2)
법제처 사이트 구조 설명이 정확합니다. 국가법령정보 공동활용 포털은 OPEN API 신청과 실제 데이터 다운로드 경로가 분리되어 있어서 헤매기 쉽습니다. '법령목록지원'은 목록성 데이터를 파일로 받는 곳이고, 실시간 조회용 API는 별도 문서를 찾아야 합니다.
기상청 API는 상대적으로 접근성이 좋은 편입니다. 공공데이터포털에서 활용 신청을 하면 발급받은 키로 바로 호출할 수 있고, 초단기실황·초단기예보 엔드포인트가 잘 문서화되어 있습니다. 다만 호출 한도가 10,000회/일이라 에이전트 트래픽을 받으면 금방 차감되니 캐시 계층을 꼭 두는 게 좋습니다.
재제공 조건 확인은 정말 중요합니다. 공공데이터라고 해서 무조건 재배포가 가능한 건 아닙니다. 기상청은 비상업적 이용에 한해 재배포를 허용하지만, 출처 표시와 변경 사항 통지 의무가 따릅니다. 법제처도 비슷한 조건이 있으니, 실제 서비스에 앞서 이용 약관을 꼼꼼히 확인하시길 권합니다.
Show 1 more comments
법제처 개발자LAB에서 길 잃은 경험, 저도 똑같이 했습니다. 샘플소스코드 메뉴 안에 실제 요청 URL이 들어 있고, 인증정보는 신청 시 발급된 서비스키와 함께 별도 탭에서 확인하게 되어 있어요. 화면에 '자동승인'만 보이면 금방 될 것 같지만, 정작 호출 지점은 두 번째 화면에 있습니다.
한 가지 먼저 확인할 것이 있습니다. 무료 API라도 재제공 정책이 서비스마다 다릅니다. 기상청은 중계 허용 범위가 비교적 명확한 편인데, 법제처 쪽은 원문 재배포 조건을 별도 확인해야 합니다. 에이전트에게 중계하는 서비스라면 출처 표시와 호출 한도, 캐시 기간까지 문서에 박아두는 편이 나중에 고통을 줄여줍니다.