sgcREST: REST API Server & OpenAPI Components for Delphi & C++ Builder
Standalone product REST Server & OpenAPI

sgcREST: REST API Server & OpenAPI Components for Delphi & C++ Builder

Two jobs, seven classes. TsgcHTTPRESTServer is a REST API server with CORS handling and three attachable companions: request stats, multi-tenancy and a local user store. Alongside it, an OpenAPI engine serves an API straight from a spec, or generates that spec from an attributed Delphi class, and TsgcOpenAPI_Client consumes any OpenAPI-described API. sgcREST is standalone, it bundles the sgcWebSockets Core runtime every class is built on.

Full source code
Delphi 7 to 13 & C++ Builder
Bundled runtime sgcWebSockets Core The HTTP, TLS and JSON runtime under every class
REST Server TsgcHTTPRESTServer
OpenAPI TsgcOpenAPI_Client
4 Palette components REST server, stats, tenancy & users, one page on the palette
7 Classes total REST server family, OpenAPI server engine & OpenAPI client
4 Client auth schemes Basic auth, bearer token, generic OAuth2 and JWT built in
100% Source code included All seven classes and the bundled Core runtime
12 Months of updates Every release published while your license is active

Two Things Worth Knowing First

What sgcREST needs from you, and what it does not. Both answers are short.

sgcREST is self-contained

Standalone, the sgcWebSockets Core runtime is included: the HTTP/TLS server and client stack the REST server and every OpenAPI class run on, and the JSON layer that serializes every request and response. One SKU, one installer, and sgcREST runs on the standard Indy library that ships with RAD Studio.

Full source code ships with every license, so the REST server, its companions and the OpenAPI engine step through in your own debugger rather than disappearing into a binary.

One version requirement

Code-first OpenAPI needs Delphi XE7+

Generating an OpenAPI spec from an attributed Delphi class relies on the RTTI that arrived in Delphi XE7, so TsgcOpenAPICodeFirstScanner and TsgcOpenAPICodeFirstDispatcher compile from XE7 up. The REST server and its companions, and the spec-first OpenAPI engine that routes from a JSON or YAML document you already have, run on every supported compiler, Delphi 7 to 13.

No OpenAPI document to start from? Write the Delphi class first and let the scanner generate one, that is exactly what code-first is for on XE7 and later.

Four Palette Components, Three Code-Only Classes

The REST server and its three companions are non-visual components on the SGC REST palette page, declared across the sgcHTTP_REST_Server* units. Drop TsgcHTTPRESTServer on a form or create it in code, then attach ServerStats and Tenancy as needed. The OpenAPI server engine and the OpenAPI client class live in the sgcHTTP_OpenAPI_* units as code-only classes, there is nothing to drop on a form for those: create one, configure it, and call its methods directly.

REST Server4 components

One server, three companions you attach as needed

TsgcHTTPRESTServer extends the standard TsgcHTTPServer with CORS handling through CORSOptions, and two properties for optional companions: ServerStats and Tenancy. TsgcHTTPServerStats counts every request by status class, tracks latency minimum, average and maximum, and serves a Prometheus-format /metrics endpoint plus a JSON /health endpoint, with GetEndpointStats for a per-route breakdown. TsgcHTTPServer_Tenancy resolves the caller's tenant from the host name, a path segment, a request header or a JWT claim, and the server's own Tenant property reads the result for the request being served. TsgcHTTPServer_Users is a fourth, free-standing companion: a local account store with AddUser, ValidateCredentials, role tags and salted password hashing, with optional encryption at rest, queried directly from a route handler rather than wired to the server as a property.

OpenAPI Server2 ways to define an API

Serve a spec you already have, or generate one from your code

Spec-first: load an OpenAPI 3.0 or 3.1 document and TsgcOpenAPIRouteTable builds the route table from its paths section automatically. A matched request arrives as a TsgcOpenAPIServerContext, with typed path and query parameter access, body helpers and RespondJSON/RespondError, TsgcOpenAPIServerHandler wraps every call in BeforeHandle, AfterHandle and HandleException, and TsgcOpenAPIJSONValidator checks bodies, query and path parameters against the JSON Schemas the spec declares. Code-first flips the source of truth: annotate a plain Delphi class with sgcServiceContract, sgcRoute, sgcHttpGet/sgcHttpPost and sgcFromPath/sgcFromQuery/sgcFromBody attributes, and TsgcOpenAPICodeFirstScanner.GenerateSpec produces the OpenAPI document straight from its RTTI, no YAML to hand-write. Pair it with TsgcOpenAPICodeFirstDispatcher and the annotated methods are invoked directly for each operation, no manual dispatch chain needed. Code-first requires Delphi XE7 or later.

OpenAPI Client1 class

Consume any OpenAPI-described API

TsgcOpenAPI_Client is a generic runtime client for any endpoint an OpenAPI document describes: HTTP_REQUEST carries the call, Authentication covers Basic auth and bearer tokens plus generic OAuth2 and JWT, and OnBeforeRequest, OnUpload and OnDownload track it.

One Server, Composable Companions

The seven classes split cleanly by role. The REST server carries the HTTP traffic, three companions add what a production API needs, and the OpenAPI engine turns a spec, written or generated, into a working route table.

The REST server is a TsgcHTTPServer with extras

TsgcHTTPRESTServer inherits the bindings, TLS and HTTP/2 handling of the plain HTTP server that ships in every sgcWebSockets edition, and adds CORS handling plus two attachable companions on top, so a REST API gets metrics, health checks and multi-tenancy without a separate framework.

Stats, tenancy and users are companions, not baked-in features

TsgcHTTPServerStats, TsgcHTTPServer_Tenancy and TsgcHTTPServer_Users are separate components. Attach the ones a given API needs and leave the rest out, an attached but unconfigured companion costs the server nothing to check.

Spec-first and code-first end up in the same route table

Whether the OpenAPI document comes from a file you loaded or from TsgcOpenAPICodeFirstScanner.GenerateSpec scanning an attributed class, both are JSON, and the same route table and request context serve either one. Only the code-first scanner itself needs Delphi XE7 or later.

The Core runtime is in the box

Standalone, the sgcWebSockets Core runtime is included. It contributes the HTTP/TLS stack the REST server and every OpenAPI class run on, and its full source is part of the package like everything else.

A REST Server and an OpenAPI Client, Side by Side

The REST server is declared in sgcHTTP_REST_Server, the OpenAPI client in sgcHTTP_OpenAPI_Client. The same code compiles in Delphi 7 to 13 and C++ Builder.

uses
  sgcHTTP_REST_Server, sgcHTTP_OpenAPI_Client;

var
  RESTServer: TsgcHTTPRESTServer;
  APIClient: TsgcOpenAPI_Client;
  Request: TsgcOpenAPIRequest;
  Response: TsgcOpenAPIResponse;
begin
  // REST server: CORS on, stats and health/metrics wired in
  RESTServer := TsgcHTTPRESTServer.Create(nil);
  RESTServer.Bindings.Add.Port := 8080;
  RESTServer.CORSOptions.Enabled := True;
  RESTServer.ServerStats := HTTPServerStats1;
  RESTServer.Active := True;

  // OpenAPI client: call any OpenAPI-described API with basic auth
  APIClient := TsgcOpenAPI_Client.Create(nil);
  APIClient.SetBaseURL('https://api.example.com');
  APIClient.Authentication.Basic.Enabled := True;
  APIClient.Authentication.Basic.Username := 'apiuser';
  APIClient.Authentication.Basic.Password := '...';

  Request := TsgcOpenAPIRequest.Create;
  Response := TsgcOpenAPIResponse.Create;
  APIClient.HTTP_REQUEST(Request, Response);
end;
// include: sgcHTTP_REST_Server.hpp, sgcHTTP_OpenAPI_Client.hpp

// REST server: CORS on, stats and health/metrics wired in
TsgcHTTPRESTServer *RESTServer = new TsgcHTTPRESTServer(this);
RESTServer->Bindings->Add()->Port = 8080;
RESTServer->CORSOptions->Enabled = true;
RESTServer->ServerStats = HTTPServerStats1;
RESTServer->Active = true;

// OpenAPI client: call any OpenAPI-described API with basic auth
TsgcOpenAPI_Client *APIClient = new TsgcOpenAPI_Client(this);
APIClient->SetBaseURL("https://api.example.com");
APIClient->Authentication->Basic->Enabled = true;
APIClient->Authentication->Basic->Username = "apiuser";
APIClient->Authentication->Basic->Password = "...";

TsgcOpenAPIRequest *Request = new TsgcOpenAPIRequest();
TsgcOpenAPIResponse *Response = new TsgcOpenAPIResponse();
APIClient->HTTP_REQUEST(Request, Response);

No Add-On, Every Platform

All seven classes run on the standard Indy library that ships with RAD Studio, so the whole platform range sgcWebSockets already covers is available with no add-on required.

REST Server family TsgcHTTPRESTServer, ServerStats, Tenancy & Users
Windows Win32 Windows Win64 Linux64 macOS iOS Android
OpenAPI server & client family Spec-first, code-first and the OpenAPI client class
Windows Win32 Windows Win64 Linux64 macOS iOS Android
IDE support One source tree, design-time packages per version
Delphi 7 to 13 C++ Builder
Code-first OpenAPI Needs the RTTI that arrived in Delphi XE7
Delphi XE7 to 13
Trial installer The sgcWebSockets All-Access trial includes the sgcREST components
One download, all seven classes

Download the trial installer →

A Standalone Package

sgcREST is licensed on its own, starting at €249 for a single developer. All licenses include full source code, 1 year of updates and a 50% to 70% renewal discount: 50% when you renew one pack, 60% for two, 70% for three or more. sgcAI, sgcMQ, sgcSocial, sgcAuth, sgcHTTP and sgcREST each count as a pack. sgcREST is also included in the All-Access bundle.

sgcREST

€249

Single, Team and Site licenses available.

  • REST server with CORS, stats, tenancy & users
  • OpenAPI server, spec-first & code-first
  • OpenAPI client for any OpenAPI-described API
  • sgcWebSockets Core runtime included
  • Delphi 7 to 13 & C++ Builder
  • Full source code
  • 1 year of updates

No add-on to add or remove at checkout, sgcREST runs on the standard Indy library that ships with RAD Studio.

Checkout lists two items: the sgcWebSockets Core runtime entitlement, charged at zero, and the sgcREST pack itself. Full pricing details.

3,000+Developers
20+Years
761+Components
30+API Integrations
5Platforms
30-Day Money-Back GuaranteeNot satisfied? Request a full refund within 30 days of purchase. See refund policy

REST APIs and OpenAPI, Built Straight into Native Code

A REST server with stats, multi-tenancy and users, an OpenAPI server that works spec-first or code-first, and an OpenAPI client for any OpenAPI-described API, with the runtime bundled in and full source code in the box. Download the All-Access trial installer and try all seven classes today.

Other Products by eSeGeCe

Pair sgcREST with our other Delphi, C++ Builder and .NET component libraries.

sgcWebSockets

The full library: WebSocket clients and servers, HTTP/2, gRPC, IoT, P2P and AI components. Its Enterprise edition includes the OpenAPI server too.

Learn more →

sgcHTTP

HTTP/2, gRPC and Google Cloud Pub/Sub, Calendar and Firebase Cloud Messaging client components, with the Core runtime bundled.

Learn more →

sgcAuth

OAuth2 and JWT client components plus WebAuthn passkey sign-in, a natural pairing with a REST API's user store.

Learn more →

sgcAI

AI, LLM and MCP components. One chat component reaches OpenAI, Anthropic, Gemini, DeepSeek, Ollama, Grok and Mistral.

Learn more →

sgcMQ

Native MQTT 3.1.1/5.0, AMQP 0.9.1, AMQP 1.0, Apache Kafka and STOMP client components, with the Core runtime bundled.

Learn more →

sgcOpenAPI

A separate bundled product: an OpenAPI 3.x parser, a native Pascal SDK generator and over 1,195 pre-built cloud SDKs, for offline code generation rather than a runtime client.

Learn more →