Skip to main content
The HTTP Functions module enables you to register and invoke HTTP endpoints as native functions in your iii application. Perfect for integrating with external APIs, webhooks, and microservices.

Configuration

Configure the HTTP Functions module in config.yaml:
config.yaml

Security Configuration

The module includes built-in security controls to protect against SSRF and other vulnerabilities.
array<string>
default:"['*']"
List of URL patterns allowed for HTTP function invocations. Supports wildcards.Examples:
  • https://api.example.com/* - Allow all endpoints under api.example.com
  • https://*.example.com/* - Allow all subdomains of example.com
  • * - Allow all URLs (use with caution)
boolean
default:true
Block requests to private IP ranges (RFC 1918) to prevent SSRF attacks.Blocked ranges:
  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16
  • 127.0.0.0/8
  • 169.254.0.0/16
boolean
default:true
Require HTTPS for all HTTP function invocations. Rejects HTTP URLs.
The default security settings (block_private_ips: true, require_https: true) are recommended for production deployments to prevent SSRF vulnerabilities.

Registering HTTP Functions

HTTP functions are registered dynamically at runtime using the register_http_function method:

HttpFunctionConfig

string
required
The function ID to register. Used when calling the function via client.call().
string
required
The HTTP endpoint URL. Supports path parameters using {param} syntax.Must pass URL validation against the allowlist.
string
required
HTTP method: GET, POST, PUT, PATCH, DELETE
string
Optional description of the function’s purpose
number
default:30000
Request timeout in milliseconds
object
HTTP headers to include in the request. Common use cases:
  • Authentication: Authorization: Bearer {token}
  • Content type: Content-Type: application/json
  • API keys: X-API-Key: {key}
HttpAuth
Authentication configuration. See Authentication section.
object
JSON schema for request validation
object
JSON schema for response validation
object
Arbitrary metadata attached to the function

Invoking HTTP Functions

Once registered, HTTP functions are called like any other function:

Path Parameters

URL path parameters are extracted from the input data:

Query Parameters

Non-path parameters are added as query strings:

Request Body

For POST/PUT/PATCH requests, the input is sent as the request body:

Authentication

The module supports various authentication methods:

API Key in Headers

Bearer Token

Basic Auth

OAuth 2.0

Unregistering Functions

Remove HTTP functions when they’re no longer needed:

Use Cases

External API Integration

Microservice Communication

Webhook Forwarding

Error Handling

URL Validation Errors

Request Failures

Security Best Practices

  1. Use allowlists - Restrict HTTP functions to trusted domains
  2. Enable HTTPS - Set require_https: true in production
  3. Block private IPs - Keep block_private_ips: true to prevent SSRF
  4. Rotate credentials - Store API keys in environment variables, not hardcoded
  5. Validate responses - Use response_format to validate external API responses
  6. Set timeouts - Prevent hanging requests with appropriate timeout_ms values
  7. Rate limiting - Implement rate limiting for external API calls
  8. Monitor usage - Track HTTP function invocations for unusual patterns

Production Configuration

config.yaml

Development Configuration

config.yaml
Never use the development configuration in production. Always enforce strict security controls.

Limitations

  1. Synchronous only - HTTP functions are invoked synchronously
  2. No streaming - Response must fit in memory
  3. No retries - Failed requests do not retry automatically
  4. No caching - Responses are not cached (implement caching in your code)

API Reference

HttpInvoker

The underlying HTTP invoker is accessible via:

Registered Functions

Access the registry of HTTP functions: