Skip to content
API Now! is currently in closed beta. We are constantly updating these guides as we release updates!

URL (Semantic Module)

← Back to Modules Reference

The URL semantic module validates that incoming values are properly formed, absolute web links conforming to the WHATWG URL Standard.

Beyond simple format checking, the URL semantic module functions as a critical security shield against Server-Side Request Forgery (SSRF), credential leaks, and malicious URL schemes by restricting protocols, IP hostnames, explicit ports, and embedded authentication.


AttributeSpecification
ScopeProperty (Applied to a text or string property)
Data TypeString
Parsing StandardWHATWG URL Standard
Default Protocolshttp: and https: (https: only when requireHttps is enabled)
Credential ProtectionRejects embedded credentials (user:pass@host) by default

Every submitted value is parsed using the standard WHATWG URL parser. Relative paths (such as /about or profile/link), malformed syntax, and non-web protocols (like javascript:, data:, or ftp:) are strictly rejected.

2. HTTPS Protocol Enforcement (requireHttps)

Section titled “2. HTTPS Protocol Enforcement (requireHttps)”

When building production SaaS or fintech backends, external webhook URLs, profile links, or business websites should always be encrypted:

  • When requireHttps: true is set, any URL starting with unencrypted http:// is blocked with a validation error.
  • By default, both standard http:// and https:// are permitted.

3. SSRF & Internal Network Protection (allowIP & allowPort)

Section titled “3. SSRF & Internal Network Protection (allowIP & allowPort)”

If your backend or background workers fetch user-submitted URLs, attackers may try to submit internal IP addresses (such as http://169.254.169.254 or http://192.168.1.1:8080) to access cloud metadata services or internal databases.

  • IP Fencing (allowIP: false): Rejects raw IPv4 and IPv6 addresses as hostnames.
  • Port Fencing (allowPort: false): Blocks URLs specifying custom ports (such as :8080, :3000, or :22), permitting only standard web ports.

4. Credential Leakage Prevention (allowAuthentication)

Section titled “4. Credential Leakage Prevention (allowAuthentication)”

URLs can accidentally expose sensitive API keys or passwords if entered as https://admin:secret123@api.example.com. By default (allowAuthentication: false), API Now automatically blocks any URL containing embedded usernames or passwords.

  • allowQueryParams: false: Rejects URLs containing query parameters (e.g. ?ref=affiliate), ensuring only clean domain or path endpoints are stored.
  • allowFragments: false: Rejects URLs containing anchor hashes (e.g. #section-2).

When configuring the URL semantic in the Domain Modeler, you can customize the following security parameters:

OptionTypeDefaultDescription
requireHttpsbooleanfalseEnforces that the URL must use the secure https: protocol.
allowAuthenticationbooleanfalseForbids embedded credentials (user:pass@host) to prevent security leaks.
allowIPbooleantrueWhen false, blocks raw IP addresses (e.g., http://192.168.1.1) to prevent SSRF.
allowPortbooleantrueWhen false, forbids custom ports (e.g., :8080).
allowQueryParamsbooleantrueWhen false, rejects URLs containing search query parameters (?key=value).
allowFragmentsbooleantrueWhen false, rejects URLs containing anchor fragments (#heading).
allowInternationalbooleantrueWhen false, blocks Internationalized Domain Names (IDN) and Punycode (xn--...).

A client creates a profile with a secure website URL:

POST /companies
Content-Type: application/json
{
"name": "Acme Corp",
"website": "https://www.acme.com/about"
}

Server Response (201 Created):

{
"data": {
"id": "comp_101",
"name": "Acme Corp",
"website": "https://www.acme.com/about"
}
}

If requireHttps: true is configured and the client submits an unencrypted http:// link:

Server Response (422 Unprocessable Entity):

{
"type": "https://docs.apinow.app/errors/validation",
"title": "Validation Error",
"status": 422,
"code": "E_VALIDATION_ERROR",
"detail": "The field 'website' must use the HTTPS protocol."
}

3. Security Rejection (Embedded Credentials)

Section titled “3. Security Rejection (Embedded Credentials)”

If an input contains embedded authentication credentials:

{
"website": "https://admin:supersecret@example.com"
}

Server Response (422 Unprocessable Entity):

{
"type": "https://docs.apinow.app/errors/validation",
"title": "Validation Error",
"status": 422,
"code": "E_VALIDATION_ERROR",
"detail": "The field 'website' is not allowed to contain embedded credentials."
}

  • String Properties Only: The URL semantic module can only be applied to a String or Text property. Tagging a non-string property yields a Semantic Data Alignment [Error].
  • Files & Media: For user file uploads or image attachments stored in S3/cloud storage, prefer specialized file upload actions and semantics rather than generic URLs.