API Management

Services and Routes

Define your APIs and determine which Service receives incoming requests.

How Services and Routes Work Together

A Service stores the address and connection behavior of the API that will process a request. A Route stores the public matching rules used to decide whether an incoming request belongs to that Service.

Create the Service first, then attach one or more Routes. Multiple Routes can point to the same Service when different hosts, paths, methods or policies must reach the same API.

Request flow

Client request → Route match → Service connection → API response. A request must satisfy the configured Route conditions before it can reach the Service.

Before You Configure an API

  • Prepare the protocol, host or IP address, port and optional base path of the target API.
  • Decide which public hosts, paths and HTTP methods clients will use.
  • Choose a unique naming convention for Services and Routes, such as team-api-environment.
  • Prepare Certificate and CA Certificate IDs before enabling client-certificate authentication or upstream TLS verification.

Create a Service

Navigation pathMain menuServicesCreate Service
  1. Open Services and select Create Service.
  2. Enter a unique Service Name. The name must contain at least three characters and can use letters, numbers, hyphens and underscores.
  3. Choose Full URL to let Apiruler derive the protocol, host, port and path, or choose Manual Configuration to enter those values separately.
  4. Select a folder and add comma-separated tags when you need to group or filter the Service.
  5. Keep Service Enabled on to make the configuration active after creation.
  6. Review Advanced Configuration when retry, timeout or TLS behavior must differ from the defaults, then select Create.
FieldRequirementDescriptionExample
Service NameRequiredUnique name with at least three supported characters.orders-api
Full URLRequired in URL modeComplete HTTP or HTTPS target. Apiruler derives its connection fields.https://backend.example.com/v1
ProtocolRequired in manual modeHTTP, HTTPS, gRPC, gRPCs, TCP or TLS.HTTPS
HostRequired in manual modeTarget hostname, IP address or Load Balancer name.backend.example.com
PortRequired in manual modeTarget port from 1 through 65535.443
PathOptionalBase path appended to requests sent to the target API./v1
FolderOptionalLogical group used to organize Services in the interface.Production APIs
TagsOptionalComma-separated labels used for filtering and organization.production, orders
Full URL defaults

When a Full URL does not contain a port, HTTPS uses 443 and HTTP uses 80. A root URL path is stored without an additional Service path.

Expected result

The new Service appears in the Services list with its protocol, host, port and enabled status.

Service Advanced Configuration

FieldDefaultAllowed valueTechnical effect
Retries50–100Maximum retry count used when a connection attempt fails.
Connect Timeout60000 msAt least 1 msMaximum time allowed to establish the target connection.
Write Timeout60000 msAt least 1 msMaximum idle time allowed while sending the request.
Read Timeout60000 msAt least 1 msMaximum idle time allowed while waiting for response data.
Client Certificate IDEmptyExisting Certificate IDCertificate presented when a client certificate is required by the target API.
CA CertificatesEmptyComma-separated CA Certificate IDsTrust records used to verify the target TLS certificate.
TLS VerificationOffOn or offControls whether the target TLS certificate is verified.
TLS dependency

Enable TLS Verification only after the required CA Certificate records are available and their IDs are assigned to the Service.

Create a Route

Navigation pathMain menuRoutesCreate Route
  1. Open Routes and select Create Route.
  2. Enter a Route Name with at least two characters. Letters, numbers, dots, hyphens and underscores are accepted.
  3. Select the Service that will receive matching requests. The Service assignment is required during creation and cannot be changed from the edit form.
  4. Select HTTP, HTTPS or both. If neither option remains selected, the form submits both HTTP and HTTPS.
  5. Enter one or more matching conditions in Paths, Hosts, Methods, Headers or SNIs.
  6. Review the advanced path, redirect and buffering options, then select Create.
Matching rule required

Use at least one meaningful Paths, Hosts, Methods, Headers or SNIs condition. A Route with overly broad conditions can receive traffic intended for another API.

Route Matching Fields

FieldInput formatMatching behaviorExample
PathsComma-separated pathsMatches the request URL path./orders, /v1/orders
HostsComma-separated hostnamesMatches the incoming Host value.api.example.com
MethodsComma-separated HTTP methodsLimits the Route to the listed methods.GET, POST
HeadersJSON object with arrays of valuesMatches requests containing the configured header values.{"x-client-type":["mobile","web"]}
SNIsComma-separated namesMatches the TLS server name used by the client.api.example.com, *.example.com
ProtocolsHTTP and/or HTTPSLimits the transport protocols that can match.HTTP, HTTPS
{"x-api-version":["v1"],"x-client-type":["mobile","web"]}

Advanced Route Behavior

FieldDefaultDescription
Path Handlingv0Controls how the Route path and Service path are combined.
HTTPS Redirect Status CodeEmptyOptional integer from 301 through 599 used for protocol redirection behavior.
Regex Priority0Priority used when multiple regular-expression paths can match.
Strip PathOnRemoves the matched Route path before the request is sent to the Service.
Preserve HostOffKeeps the incoming Host header instead of using the Service host.
Request BufferingOnBuffers the client request before forwarding when supported.
Response BufferingOnBuffers the Service response before returning it when supported.

Verify Service and Route Configuration

  1. Open the Service detail page and confirm the target protocol, host, port, path and enabled status.
  2. Open the Route detail page and confirm that it points to the intended Service.
  3. Send one request that satisfies the Route conditions and confirm that the expected API response is returned.
  4. Send a second request with a non-matching host, path or method and confirm that the Route is not selected.
  5. Check Monitoring and Logging for request count, latency and error evidence after test traffic is sent.

Service and Route Troubleshooting

ProblemLikely causeWhat to do
The Service cannot be created.The name, URL, host or port does not satisfy form validation.Check the supported name characters, use a complete URL, or enter a port from 1 through 65535.
A matching request does not reach the API.The Route conditions do not match or the Service target is unreachable.Compare the request host, path, method and protocol with the Route, then verify the Service address.
The API receives an unexpected path.Strip Path, Path Handling or the Service base path is not configured as intended.Review the three path settings together and retest with a known request URL.
TLS verification fails.The target certificate is untrusted, expired or does not match the configured host.Check the CA Certificate IDs, target hostname and certificate validity before retrying.
A request reaches the wrong Route.Two Routes have overlapping matching rules.Make the host, path, method or regex priority more specific.

Need a hand?

If you get stuck during installation or configuration, our team is ready to help.