Call the free URL encode API endpoint
curl -X POST https://aisenseapi.com/services/v1/url_encode \
-H "Content-Type: application/json" \
-d '{"data": "a b/c?é"}'{"url_encoded_data":"a%20b%2Fc%3F%C3%A9"}The other way is the URL decode API endpoint.
What is encoded
| In | Out | Why |
|---|---|---|
| a space | %20 | not +, which means a space only in HTML form bodies |
/ ? # & = | %2F %3F %23 %26 %3D | they separate the parts of a URL |
@ | %40 | ada@example.com becomes ada%40example.com |
é | %C3%A9 | each UTF-8 byte on its own |
A-Z a-z 0-9 - _ . ~ | unchanged | the unreserved characters |
Encode each segment or value on its own. Encoding a whole URL turns its own slashes into %2F.
Send the data as {"data": "..."} with Content-Type: application/json, or as the raw request body with any other content type. The raw body takes binary data as it is: curl --data-binary @file.bin -H "Content-Type: application/octet-stream".
Errors
| Status | error | When |
|---|---|---|
| 400 | No data to encode. | No data string and no body |
| 413 | Data over 1 MiB. | More than 1 MiB in one request |
Each refusal also carries fix, a sentence saying what to send instead.
Common uses
Path arguments
This API takes its arguments in the path. A value with a space, a slash or an @ in it goes in encoded.
Query values
Build a query string for another API without a library, one value at a time.
Agents building URLs
Let an agent hand over the text and get back exactly what the URL needs, instead of guessing the escapes.
Privacy and limits
Nothing is stored. The URL encode answer is worked out while the request is open and the data is gone with it. The access log records the path and the status, not the body.
The base URL is https://aisenseapi.com/services/v1. There is no key, no account and no sign-up step. One request carries at most 1 MiB of data, and the service-wide limit is 5000 requests per IP address per day. Every endpoint in the collection is listed on the Free public REST APIs reference, and the encodings side by side on Encoding APIs.