cURL to SQL Server Converter
Convert curl commands to SQL code using SQL Server. Paste a command and the SQL Server snippet appears instantly — everything runs in your browser.
- Instant ConversionCode updates as you type
- Multiple Languages40 languages, 61 libraries
- 100% Client SideYour data stays private
How to use this tool
Steps for using the cURL to Code.
- Copy a curl command — from API documentation, or from your browser's DevTools (Network tab → right-click a request → Copy as cURL (bash)).
- Paste it into Enter cURL command. The SQL Server code appears instantly; other SQL libraries (PostgreSQL http, Oracle UTL_HTTP) are in the tabs above the code.
- Set up: Available in Azure SQL Database, Azure SQL Managed Instance and SQL Server 2025. On SQL Server, enable it with
sp_configure 'external rest endpoint enabled', 1. The user needs the EXECUTE ANY EXTERNAL ENDPOINT permission. - Run it: Run the T-SQL in SSMS, Azure Data Studio or sqlcmd. Replace placeholders such as
YOUR_TOKENfirst, and check any notes under the editors for curl options that have no SQL Server equivalent.
Example
GET with headers → SQL Server
curl 'https://api.example.com/v1/users?page=2' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'-- Azure SQL Database, Azure SQL Managed Instance and SQL Server 2025. On SQL Server, enable it first:
-- EXEC sp_configure 'external rest endpoint enabled', 1; RECONFIGURE;
DECLARE @ret INT, @response NVARCHAR(MAX);
EXEC @ret = sp_invoke_external_rest_endpoint
@url = N'https://api.example.com/v1/users?page=2',
@method = 'GET',
@headers = N'{"Accept":"application/json","Authorization":"Bearer YOUR_TOKEN"}',
@response = @response OUTPUT;
-- @response is JSON: the status is in $.response.status.http and the body in $.result.
SELECT @ret AS return_code,
JSON_VALUE(@response, '$.response.status.http.code') AS http_status,
@response AS response;Common use cases
- Calling Azure Functions or other APIs from T-SQL
- Sending data to webhooks from stored procedures
Converting curl to SQL Server
sp_invoke_external_rest_endpoint is a system stored procedure that calls an HTTPS endpoint from T-SQL. The code passes the URL, method, headers (as JSON) and body, and reads the result from the @response JSON.
The converter reads the curl command the way curl does — the method (-X), headers (-H), request bodies (-d, --data-raw, --json, -F), query strings, basic auth (-u) and cookies — and writes the equivalent SQL Server code. Options that have no SQL Server equivalent are listed under the editors rather than silently dropped.
Other libraries for SQL, each with its own page: PostgreSQL http, Oracle UTL_HTTP.
Limitations
- Only HTTPS URLs; Azure SQL Database may also limit which endpoints can be called — check Microsoft's documentation.
- Only GET, POST, PUT, PATCH, DELETE and HEAD are supported.
- File uploads (curl -F) aren't supported.
- The code is a starting point: add timeouts, retries and error handling for production use.
- Secrets in the curl command are copied into the code — move them to environment variables before committing.
Frequently asked questions
How do I get the status code and body?
@response is JSON: the status is at $.response.status.http.code and the body at $.result. Use JSON_VALUE or OPENJSON to read them.
Does it work on older SQL Server versions?
No. On-premises SQL Server has it from SQL Server 2025.
Is my curl command sent to a server?
No. The conversion runs entirely in your browser, so tokens and passwords in the command never leave your device. Still, replace real secrets before sharing the generated code.