---
title: "Validate a URL"
method: POST
path: "/validate-url"
tags: ["Validation"]
---

# Validate a URL

`POST /validate-url`

## Request

- Base URL: `https://api.cofferdock.com`
- URL: `https://api.cofferdock.com/validate-url`
- Auth: API key in header `x-api-key`

Checks whether a URL is well-formed and breaks it into protocol, hostname, port, pathname and query. Never connects to the URL (no SSRF risk).

Costs 1 credit per call.

## Request body

- object
  - `url` string, required: The URL to check (up to 4096 characters). It must include the protocol, e.g. "https://example.com/path?x=1". It is only parsed, never opened.
  - `allowed_protocols` string[]: Protocols that count as valid, as a non-empty array such as ["http","https","ftp"]. Default ["http","https"]. Case is ignored and the trailing ":" is optional.

## Response `200`

Result.

- object
  - `success` boolean
  - `valid` boolean
  - `reason` string, nullable
  - `protocol` string, nullable
  - `hostname` string, nullable
  - `port` string, nullable
  - `pathname` string, nullable
  - `query` object, nullable
  - `meta` object
    - `used` integer: Credits used this month, after this call.
    - `remaining` integer, nullable: Credits left this month (null = unlimited).
    - `unlimited` boolean

## Other responses

- `400`: Invalid input (nothing is charged).
- `401`: Missing or invalid API key.
- `403`: Email not verified.
- `429`: Monthly credit limit reached, or too many requests per minute for this key (see Retry-After).
- `503`: Server busy (queue full). Retry after the seconds in the Retry-After header.

---

[API](https://skmtc.dev/cofferdock/apis/cofferdock-api.md) · [All operations](https://skmtc.dev/cofferdock/apis/cofferdock-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cofferdock/apis/cofferdock-api/revisions/b57aa000d33a?raw)
