curl to code
Paste the curl command from any API documentation and get the same request in the language you are actually writing.
import requests
headers = {
'Authorization': 'Bearer $VIRLO_API_KEY',
}
params = {
'start_date': '2026-09-01',
'end_date': '2026-09-30',
'order_by': 'views',
'limit': '10',
}
response = requests.get('https://api.virlo.ai/v1/hashtags', headers=headers, params=params)
response.raise_for_status()
print(response.json())Why this exists
Every API documents its endpoints in curl, and almost nobody ships curl. The translation is mechanical but fiddly: headers become a dict or a map, -d becomes a body or a query string depending on whether -G is present, and basic auth becomes a different construct in each language. Getting one of those wrong produces a 400 that looks like an API problem and is not.
What to check in the output
- The method. curl infers POST from the presence of a body. If the original had no explicit
-X, confirm the inferred method is the one the endpoint expects. - The body encoding. A JSON body needs a JSON content-type header. The converter passes your body through verbatim rather than guessing, so if the header was missing from the curl command it will be missing from the code.
- The secret. The generated snippet contains whatever the command contained. Move the key to an environment variable before it reaches a commit.
After the first call
A converted snippet gets one request working. Production needs the parts curl never shows: retries with backoff on a 429, a timeout shorter than your own request budget, and pagination through the cursor. Those are documented per endpoint, and the rate-limit calculator below works out the pace your job needs before you write the loop.
FAQ
- Which curl flags are supported?
- The ones that appear in API documentation: -X / --request, -H / --header, -d and its --data variants, -G, -u / --user, -A, -b, -e, -L and -k. Line continuations with a trailing backslash are handled. Anything unrecognised is reported rather than silently dropped.
- Is my API key sent anywhere?
- No. The parser and the code generators are plain functions running in this page, so a command with a live bearer token in it never leaves your browser. There is no signup and no request to our servers.
- Why does -G change the output?
- Without -G, curl sends -d values as a request body and makes the request a POST. With -G it appends them to the query string and keeps the method as GET. The generated code follows the same rule, which is why the same -d flags can end up as params or as a body.
- Does it handle multipart uploads?
- Not properly. -F is flagged with a warning and the value is passed through as a body, because a faithful multipart conversion differs enough per language that a half-right version would cost more time than it saves.
- Which languages does it output?
- Python with requests, JavaScript with fetch, Node with axios, Go with net/http, and PHP with the curl extension. Each one is idiomatic rather than minimal: the Python version raises on a bad status, and the Go version closes the body.
- Can I convert a Virlo API call with it?
- Yes — the example loaded on the page is a real hashtag call. Every curl snippet in the Virlo docs converts the same way, so the quickest route to a working client is to copy a documented call and switch the language here.
Get the data behind the tool
The Virlo API returns TikTok, Instagram Reels and YouTube Shorts data by the call — hashtags, videos, sounds, creators and trends. Pay per call, no scrapers to maintain.
Create your API key