# URL Encoder/Decoder API

> URL Encoder/Decoder converts text into percent-encoded strings or decodes existing URL components back into plain text. Pass any string with an encode or decode action to receive the processed output and your original text.

**Endpoint:** `POST https://api.apiverve.com/v1/urlencode`  
**Category:** Data Conversion  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/urlencode

## Overview

URL Encoder/Decoder works by converting special characters and spaces into percent-encoded format (%XX) for safe URL transmission or decoding percent-encoded strings back to original text. Essential for query parameters and URL construction.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/urlencode" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello World & Goodbye","action":"encode","mode":"value"}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | The text to encode; leading and trailing whitespace is encoded too. length 1-inf |
| `action` | string | No | The action to perform. default encode. One of: encode, decode |
| `mode` | string | No | component (default) percent-encodes spaces as %20 and leaves + alone; form follows application/x-www-form-urlencoded, encoding spaces as + and decoding + as a space. default component. One of: component, form |

## Response fields

- `action` — string · The encoding or decoding action that was performed
- `original` — string · The original text input before encoding or decoding
- `encoded` — string · The resulting encoded or decoded text output
- `length` — number · The total character length of the encoded or decoded output · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "action": "encode",
    "original": "Hello World & Goodbye",
    "encoded": "Hello%20World%20%26%20Goodbye",
    "length": 29
  }
}
```

## Use cases

- **API Requests** — Encode query parameters and URL components before making API requests to ensure proper formatting
- **Link Generation** — Generate properly encoded URLs for links, redirects, and sharing with special characters or spaces
- **Form Handling** — Encode form data for URL submission or decode URL-encoded form data received from submissions
- **Search Queries** — Encode search terms and filters for URL-based search functionality and bookmarkable search results

## SDKs

- **npm** — `npm install @apiverve/urlencode` (https://www.npmjs.com/package/@apiverve/urlencode)
- **NuGet** — `dotnet add package APIVerve.API.URLEncoderDecoder` (https://www.nuget.org/packages/APIVerve.API.URLEncoderDecoder)
- **Source** — https://github.com/apiverve/urlencode-api

## More

- Full reference: https://docs.apiverve.com/ref/urlencode
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
