I Needed a Simple Link Preview API for a Chat App, So I Built One
Source: Dev.to
Lessons learned from building a minimal, predictable URL preview API
We’re building a platform that connects pet parents with pet care service providers. A real‑time, two‑way chat system between our users is one of the most active parts of the platform—thousands of messages are sent every day. When someone pastes a link, it should expand into a neat preview (title, description, image, favicon) just like Facebook Messenger or WhatsApp.
I assumed this would be straightforward—there are plenty of URL preview APIs out there, right? Turns out… not exactly.
What I Found When Researching URL Preview APIs
1. Hourly limits that didn’t match our usage
Chat traffic comes in waves. For our users (mostly in the western US) activity spikes from 10 AM–2 PM MST and drops after 6 PM. Several APIs priced usage by the hour or enforced burst limits that didn’t align with these patterns. Even if the theoretical monthly usage was reasonable, hitting a short‑term cap could break previews during busy periods.
2. Features we didn’t need
Many APIs offered screenshots, AI‑based parsing, very large JSON responses, etc. Those tools are impressive, but for the simple preview cards we needed they were heavier than necessary, and the pricing reflected that complexity.
3. Expensive to get started
The cheapest commercial plans I found started around $25 / month. The entry price was consistent, but the quota varied. For indie developers and small bootstrapped businesses, that extra recurring cost can be a barrier.
Why I Decided to Build My Own Solution
The motivation wasn’t “I can do it better” but rather “I need something simple, reliable, and affordable.” Existing services had hourly limits, unnecessary complexity, and pricing that didn’t fit our use case. What began as an internal tool eventually evolved into a small standalone service, now available at URLPreview.
Rules Followed
- Simplicity in the API – One endpoint, simple authentication, and a concise JSON response with only the fields needed for a standard link card.
- Simplicity in quotas – No hourly limits. A monthly quota that users can consume whenever they want; bursts are only temporarily restricted if they threaten stability.
- Granular pricing – Smaller users shouldn’t be forced into large tiers. URLPreview starts at $9 / month for 50 k requests, compared to $25 / month for similar quotas from other services.
- Reliable metadata extraction – Affordable doesn’t mean unreliable. Broken sites and edge cases are continuously monitored and fixed, often based on user feedback.
- Equal features across tiers – The only difference between plans is the number of requests. Features whose cost doesn’t scale with usage are available to everyone.
Features Intentionally Avoided
- Screenshots and extras – Not needed for most preview use cases and would require additional infrastructure and storage.
- AI‑based extraction – Non‑deterministic responses and the need for GPU‑backed infrastructure would raise costs significantly.
- Hourly limits – Penalize bursty traffic patterns typical of chat applications.
These features aren’t “bad”; they’re useful for specific scenarios. They were simply unnecessary for the majority of preview use cases I was targeting, and avoiding them helped keep pricing affordable.
Early Launch & User Response
A few days after casually mentioning the project in a Reddit comment, I got the first paying user—enough to validate the problem. Later launches on Product Hunt and Uneed generated dozens of sign‑ups. Most traffic now comes organically from Google with minimal marketing effort. The service comfortably covers operating costs and provides a return on the time invested.
How It Works
The API response is intentionally minimal:
GET https://api.urlpreview.com/v1/preview?url=youtube.com&key=YOUR_KEY
{
"access": "public",
"title": "YouTube",
"description": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.",
"image": "https://www.youtube.com/img/desktop/yt_1200.png",
"icon": "https://www.youtube.com/s/desktop/31c2c151/img/favicon.ico",
"url": "https://youtube.com"
}
This covers what most apps actually need for link cards.
Lessons Learned
- Simplicity wins – Most use cases don’t need screenshots or AI; keeping things minimal makes the API easier to maintain and more affordable.
- Predictable pricing matters – Burst limits frustrate developers; a flat monthly quota works better for real‑world usage.
- Free tiers help adoption – Allowing personal projects and testing without friction encourages experimentation and feedback.
- Focus on reliability – Even affordable services must be dependable; monitoring and alerting are worth the effort.
- Small gaps can become opportunities – Building a focused tool to solve a real pain can create value for others.
Why I’m Sharing This
Many developers eventually need link previews—for chat apps, dashboards, bookmarking tools, browser extensions, or automations. I wanted to share the lessons I learned while building a small, minimal URL preview API, in case others face similar challenges with existing services, pricing models, or API limitations. If you’ve tackled this problem differently, I’d love to hear your approach or any feedback on my implementation. Sharing experiences helps us all discover better solutions.