Quickstart
Get Relay up and running in under 5 minutes. This walkthrough will guide you through creating an API, generating an API key, and sending your first authenticated request through the gateway.
1. Create an API
First, register your upstream service with Relay to create a new API target. You must pass your workspace ID and an authentication token in the headers. For more depth on authentication, see the Authentication guide.
Copy# Create a new API target in Relay
curl -X POST https://relay-g0ia.onrender.com/apis \
-H "Authorization: Bearer $RELAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": 1,
"name": "My First API",
"slug": "my-first-api",
"upstream_url": "https://httpbin.org",
"environment": "development"
}'
2. Generate an API Key
Now that you have an API registered, generate an API key to authenticate requests from your clients. Be sure to save the rawKey returned in the response, as it will never be displayed again. For more details, see the Create an API key reference.
Copy# Create an API Key for your new API (replace 1 with your API ID)
curl -X POST https://relay-g0ia.onrender.com/apis/1/keys \
-H "Authorization: Bearer $RELAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Dev Key",
"environment": "development"
}'
3. Send a Request
Use your newly generated API key to send an authenticated request through the Relay Gateway. The gateway will validate the key, apply rate limits, and proxy the request to your upstream_url.
Copy# Send a request through the Relay Gateway
curl -X GET https://relay-gateway-4o8z.onrender.com/my-first-api/anything \
-H "Authorization: Bearer relay_live_YOUR_RAW_KEY"
Once your request goes through, you will see it logged and categorized in your dashboard.