RequestRocketRequestRocketDocs
Getting started

Get Started API

Create a user token, the first proxy, and call the proxy URL.

You will create a user token, then call the Core API to build a target, two credentials, and a proxy. The final call goes through the proxy to HTTPBin. Every object must share one region.

Run the complete example

This script requires curl and jq. Set TOKEN to a user token from API keys. It uses the first organisation returned by GET /api/clients and creates four records in us-east-2.

set -euo pipefail

API="https://api.requestrocket.com/api"
REGION="us-east-2"
TOKEN="u-your-token"
AUTH="Authorization: ${TOKEN}"

CLIENT_ID="$(
  curl --fail --silent --show-error "${API}/clients" -H "${AUTH}" |
    jq -er '.clients[0].clientId'
)"

TARGET_ID="$(
  curl --fail --silent --show-error "${API}/clients/${CLIENT_ID}/targets" \
    -H "${AUTH}" -H "Content-Type: application/json" \
    --data "{\"targetName\":\"HTTPBin\",\"targetBaseURL\":\"https://httpbin.org\",\"targetTestPath\":\"/get\",\"targetRegion\":\"${REGION}\"}" |
    jq -er '.targets[0].sKey'
)"

TARGET_CREDENTIAL_ID="$(
  curl --fail --silent --show-error "${API}/clients/${CLIENT_ID}/credentials" \
    -H "${AUTH}" -H "Content-Type: application/json" \
    --data "{\"credentialName\":\"HTTPBin target credential\",\"credentialType\":\"target\",\"credentialAuthType\":\"none\",\"credentialRegion\":\"${REGION}\",\"credentialSecret\":{}}" |
    jq -er '.credentials[0].sKey'
)"

INBOUND_CREDENTIAL_ID="$(
  curl --fail --silent --show-error "${API}/clients/${CLIENT_ID}/credentials" \
    -H "${AUTH}" -H "Content-Type: application/json" \
    --data "{\"credentialName\":\"HTTPBin inbound credential\",\"credentialType\":\"proxy\",\"credentialAuthType\":\"key\",\"credentialRegion\":\"${REGION}\",\"credentialSecret\":{\"key\":\"Authorization\",\"value\":\"my-secret-key\",\"addToHeader\":true}}" |
    jq -er '.credentials[0].sKey'
)"

PROXY_ID="$(
  curl --fail --silent --show-error "${API}/clients/${CLIENT_ID}/proxies" \
    -H "${AUTH}" -H "Content-Type: application/json" \
    --data "{\"proxyName\":\"HTTPBin\",\"proxyRegion\":\"${REGION}\",\"proxyProxyCredentialId\":\"${INBOUND_CREDENTIAL_ID}\",\"proxyTargetId\":\"${TARGET_ID}\",\"proxyTargetCredentialId\":\"${TARGET_CREDENTIAL_ID}\",\"proxyActive\":true}" |
    jq -er '.proxies[0].sKey'
)"

curl --fail --include \
  "https://${REGION}.requestrocket.com/api/${PROXY_ID}/get" \
  -H "Authorization: my-secret-key"

Keep CLIENT_ID, TARGET_ID, TARGET_CREDENTIAL_ID, INBOUND_CREDENTIAL_ID, and PROXY_ID if you continue with the API reference. A successful final call returns HTTPBin JSON and requestrocket-proxy-code: proxy-access-granted.

Create a user token

Open API keys in the app and create a token. Copy the sKey value — it is the token. Send it as Authorization: u-your-token on every Core API call below.

Find your organisation id

GET /api/clients returns your organisations. Copy the clientId from the one you want to use. Every path below includes :clientId.

Request

curl -X GET "https://api.requestrocket.com/api/clients" \
  -H "Authorization: u-your-token"
import axios from "axios";

const response = await axios.request({
  method: "GET",
  url: "https://api.requestrocket.com/api/clients",
  headers: {
    "Authorization": "u-your-token",
  }
});

console.log(response.status, response.data);
import requests

response = requests.request(
    "GET",
    "https://api.requestrocket.com/api/clients",
    headers={
        "Authorization": "u-your-token",
    }
)
print(response.status_code, response.json())
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    var payload io.Reader
    req, _ := http.NewRequest("GET", "https://api.requestrocket.com/api/clients", payload)
    req.Header.Set("Authorization", "u-your-token")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(resp.StatusCode, string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.requestrocket.com/api/clients"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .header("Authorization", "u-your-token")
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}

Responses

{
  "clients": [
    {
      "clientId": "b3a1c7d2-5e44-4f0a-9c1e-7d2f8a6b1c90",
      "clientName": "My Organisation"
    }
  ],
  "message": "Success"
}

Create the target

POST /api/clients/:clientId/targets creates the HTTPBin target. Note the region — the two credentials and the proxy must use the same one.

Request

curl -X POST "https://api.requestrocket.com/api/clients/:clientId/targets" \
  -H "Authorization: u-your-token" \
  -H "Content-Type: application/json" \
  -d '{
  "targetName": "HTTPBin",
  "targetBaseURL": "https://httpbin.org",
  "targetTestPath": "/get",
  "targetRegion": "us-east-2"
}'
import axios from "axios";

const response = await axios.request({
  method: "POST",
  url: "https://api.requestrocket.com/api/clients/:clientId/targets",
  headers: {
    "Authorization": "u-your-token",
    "Content-Type": "application/json",
  },
  data: {
  "targetName": "HTTPBin",
  "targetBaseURL": "https://httpbin.org",
  "targetTestPath": "/get",
  "targetRegion": "us-east-2"
}
});

console.log(response.status, response.data);
import requests

response = requests.request(
    "POST",
    "https://api.requestrocket.com/api/clients/:clientId/targets",
    headers={
        "Authorization": "u-your-token",
        "Content-Type": "application/json",
    },
    data="{\n  \"targetName\": \"HTTPBin\",\n  \"targetBaseURL\": \"https://httpbin.org\",\n  \"targetTestPath\": \"/get\",\n  \"targetRegion\": \"us-east-2\"\n}"
)
print(response.status_code, response.json())
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := strings.NewReader(`{
  "targetName": "HTTPBin",
  "targetBaseURL": "https://httpbin.org",
  "targetTestPath": "/get",
  "targetRegion": "us-east-2"
}`)
    req, _ := http.NewRequest("POST", "https://api.requestrocket.com/api/clients/:clientId/targets", payload)
    req.Header.Set("Authorization", "u-your-token")
    req.Header.Set("Content-Type", "application/json")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(resp.StatusCode, string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.requestrocket.com/api/clients/:clientId/targets"))
            .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"targetName\": \"HTTPBin\",\n  \"targetBaseURL\": \"https://httpbin.org\",\n  \"targetTestPath\": \"/get\",\n  \"targetRegion\": \"us-east-2\"\n}"))
            .header("Authorization", "u-your-token")
            .header("Content-Type", "application/json")
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}

Responses

{
  "targets": [
    {
      "sKey": "7c2e9a14-6b31-4d8f-a0c5-3e1f7b9d2a44",
      "targetName": "HTTPBin",
      "targetBaseURL": "https://httpbin.org",
      "targetTestPath": "/get",
      "targetRegion": "us-east-2",
      "clientId": "b3a1c7d2-5e44-4f0a-9c1e-7d2f8a6b1c90"
    }
  ],
  "message": "Target created successfully"
}
{
  "message": "Input failed data validation",
  "errors": [
    "/targetRegion: must have required property 'targetRegion'"
  ]
}

Copy the sKey from the response — it is the targetId.

Create the target credential

POST /api/clients/:clientId/credentials with credentialType target and credentialAuthType none. HTTPBin does not require authentication.

Request

curl -X POST "https://api.requestrocket.com/api/clients/:clientId/credentials" \
  -H "Authorization: u-your-token" \
  -H "Content-Type: application/json" \
  -d '{
  "credentialName": "HTTPBin target credential",
  "credentialType": "target",
  "credentialAuthType": "none",
  "credentialRegion": "us-east-2",
  "credentialSecret": {}
}'
import axios from "axios";

const response = await axios.request({
  method: "POST",
  url: "https://api.requestrocket.com/api/clients/:clientId/credentials",
  headers: {
    "Authorization": "u-your-token",
    "Content-Type": "application/json",
  },
  data: {
  "credentialName": "HTTPBin target credential",
  "credentialType": "target",
  "credentialAuthType": "none",
  "credentialRegion": "us-east-2",
  "credentialSecret": {}
}
});

console.log(response.status, response.data);
import requests

response = requests.request(
    "POST",
    "https://api.requestrocket.com/api/clients/:clientId/credentials",
    headers={
        "Authorization": "u-your-token",
        "Content-Type": "application/json",
    },
    data="{\n  \"credentialName\": \"HTTPBin target credential\",\n  \"credentialType\": \"target\",\n  \"credentialAuthType\": \"none\",\n  \"credentialRegion\": \"us-east-2\",\n  \"credentialSecret\": {}\n}"
)
print(response.status_code, response.json())
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := strings.NewReader(`{
  "credentialName": "HTTPBin target credential",
  "credentialType": "target",
  "credentialAuthType": "none",
  "credentialRegion": "us-east-2",
  "credentialSecret": {}
}`)
    req, _ := http.NewRequest("POST", "https://api.requestrocket.com/api/clients/:clientId/credentials", payload)
    req.Header.Set("Authorization", "u-your-token")
    req.Header.Set("Content-Type", "application/json")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(resp.StatusCode, string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.requestrocket.com/api/clients/:clientId/credentials"))
            .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"credentialName\": \"HTTPBin target credential\",\n  \"credentialType\": \"target\",\n  \"credentialAuthType\": \"none\",\n  \"credentialRegion\": \"us-east-2\",\n  \"credentialSecret\": {}\n}"))
            .header("Authorization", "u-your-token")
            .header("Content-Type", "application/json")
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}

Responses

{
  "credentials": [
    {
      "sKey": "9e1d3a76-5b48-4c02-8a7f-1d4c6b8e0f31",
      "credentialType": "target",
      "credentialAuthType": "none",
      "credentialName": "HTTPBin target credential",
      "credentialRegion": "us-east-2",
      "clientId": "b3a1c7d2-5e44-4f0a-9c1e-7d2f8a6b1c90"
    }
  ],
  "message": "Success"
}
{
  "message": "credentialType is required"
}

Copy the sKey — it is the target credentialId.

Create the inbound credential

Same endpoint, credentialType proxy. The key type means callers send a header value you choose.

Request

curl -X POST "https://api.requestrocket.com/api/clients/:clientId/credentials" \
  -H "Authorization: u-your-token" \
  -H "Content-Type: application/json" \
  -d '{
  "credentialName": "HTTPBin inbound credential",
  "credentialType": "proxy",
  "credentialAuthType": "key",
  "credentialRegion": "us-east-2",
  "credentialSecret": {
    "key": "Authorization",
    "value": "my-secret-key",
    "addToHeader": true
  }
}'
import axios from "axios";

const response = await axios.request({
  method: "POST",
  url: "https://api.requestrocket.com/api/clients/:clientId/credentials",
  headers: {
    "Authorization": "u-your-token",
    "Content-Type": "application/json",
  },
  data: {
  "credentialName": "HTTPBin inbound credential",
  "credentialType": "proxy",
  "credentialAuthType": "key",
  "credentialRegion": "us-east-2",
  "credentialSecret": {
    "key": "Authorization",
    "value": "my-secret-key",
    "addToHeader": true
  }
}
});

console.log(response.status, response.data);
import requests

response = requests.request(
    "POST",
    "https://api.requestrocket.com/api/clients/:clientId/credentials",
    headers={
        "Authorization": "u-your-token",
        "Content-Type": "application/json",
    },
    data="{\n  \"credentialName\": \"HTTPBin inbound credential\",\n  \"credentialType\": \"proxy\",\n  \"credentialAuthType\": \"key\",\n  \"credentialRegion\": \"us-east-2\",\n  \"credentialSecret\": {\n    \"key\": \"Authorization\",\n    \"value\": \"my-secret-key\",\n    \"addToHeader\": true\n  }\n}"
)
print(response.status_code, response.json())
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := strings.NewReader(`{
  "credentialName": "HTTPBin inbound credential",
  "credentialType": "proxy",
  "credentialAuthType": "key",
  "credentialRegion": "us-east-2",
  "credentialSecret": {
    "key": "Authorization",
    "value": "my-secret-key",
    "addToHeader": true
  }
}`)
    req, _ := http.NewRequest("POST", "https://api.requestrocket.com/api/clients/:clientId/credentials", payload)
    req.Header.Set("Authorization", "u-your-token")
    req.Header.Set("Content-Type", "application/json")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(resp.StatusCode, string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.requestrocket.com/api/clients/:clientId/credentials"))
            .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"credentialName\": \"HTTPBin inbound credential\",\n  \"credentialType\": \"proxy\",\n  \"credentialAuthType\": \"key\",\n  \"credentialRegion\": \"us-east-2\",\n  \"credentialSecret\": {\n    \"key\": \"Authorization\",\n    \"value\": \"my-secret-key\",\n    \"addToHeader\": true\n  }\n}"))
            .header("Authorization", "u-your-token")
            .header("Content-Type", "application/json")
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}

Responses

{
  "credentials": [
    {
      "sKey": "2a6f4b81-9c05-4e37-b1d8-6f0a3c5e7d92",
      "credentialType": "proxy",
      "credentialAuthType": "key",
      "credentialName": "HTTPBin inbound credential",
      "credentialRegion": "us-east-2",
      "clientId": "b3a1c7d2-5e44-4f0a-9c1e-7d2f8a6b1c90"
    }
  ],
  "message": "Success"
}
{
  "message": "credentialType is required"
}

Copy the sKey — it is the inbound credentialId.

Create the proxy

POST /api/clients/:clientId/proxies binds the three records. Use the ids from the previous steps.

Request

curl -X POST "https://api.requestrocket.com/api/clients/:clientId/proxies" \
  -H "Authorization: u-your-token" \
  -H "Content-Type: application/json" \
  -d '{
  "proxyName": "HTTPBin",
  "proxyRegion": "us-east-2",
  "proxyProxyCredentialId": "2a6f4b81-9c05-4e37-b1d8-6f0a3c5e7d92",
  "proxyTargetId": "7c2e9a14-6b31-4d8f-a0c5-3e1f7b9d2a44",
  "proxyTargetCredentialId": "9e1d3a76-5b48-4c02-8a7f-1d4c6b8e0f31",
  "proxyActive": true
}'
import axios from "axios";

const response = await axios.request({
  method: "POST",
  url: "https://api.requestrocket.com/api/clients/:clientId/proxies",
  headers: {
    "Authorization": "u-your-token",
    "Content-Type": "application/json",
  },
  data: {
  "proxyName": "HTTPBin",
  "proxyRegion": "us-east-2",
  "proxyProxyCredentialId": "2a6f4b81-9c05-4e37-b1d8-6f0a3c5e7d92",
  "proxyTargetId": "7c2e9a14-6b31-4d8f-a0c5-3e1f7b9d2a44",
  "proxyTargetCredentialId": "9e1d3a76-5b48-4c02-8a7f-1d4c6b8e0f31",
  "proxyActive": true
}
});

console.log(response.status, response.data);
import requests

response = requests.request(
    "POST",
    "https://api.requestrocket.com/api/clients/:clientId/proxies",
    headers={
        "Authorization": "u-your-token",
        "Content-Type": "application/json",
    },
    data="{\n  \"proxyName\": \"HTTPBin\",\n  \"proxyRegion\": \"us-east-2\",\n  \"proxyProxyCredentialId\": \"2a6f4b81-9c05-4e37-b1d8-6f0a3c5e7d92\",\n  \"proxyTargetId\": \"7c2e9a14-6b31-4d8f-a0c5-3e1f7b9d2a44\",\n  \"proxyTargetCredentialId\": \"9e1d3a76-5b48-4c02-8a7f-1d4c6b8e0f31\",\n  \"proxyActive\": true\n}"
)
print(response.status_code, response.json())
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := strings.NewReader(`{
  "proxyName": "HTTPBin",
  "proxyRegion": "us-east-2",
  "proxyProxyCredentialId": "2a6f4b81-9c05-4e37-b1d8-6f0a3c5e7d92",
  "proxyTargetId": "7c2e9a14-6b31-4d8f-a0c5-3e1f7b9d2a44",
  "proxyTargetCredentialId": "9e1d3a76-5b48-4c02-8a7f-1d4c6b8e0f31",
  "proxyActive": true
}`)
    req, _ := http.NewRequest("POST", "https://api.requestrocket.com/api/clients/:clientId/proxies", payload)
    req.Header.Set("Authorization", "u-your-token")
    req.Header.Set("Content-Type", "application/json")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(resp.StatusCode, string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.requestrocket.com/api/clients/:clientId/proxies"))
            .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"proxyName\": \"HTTPBin\",\n  \"proxyRegion\": \"us-east-2\",\n  \"proxyProxyCredentialId\": \"2a6f4b81-9c05-4e37-b1d8-6f0a3c5e7d92\",\n  \"proxyTargetId\": \"7c2e9a14-6b31-4d8f-a0c5-3e1f7b9d2a44\",\n  \"proxyTargetCredentialId\": \"9e1d3a76-5b48-4c02-8a7f-1d4c6b8e0f31\",\n  \"proxyActive\": true\n}"))
            .header("Authorization", "u-your-token")
            .header("Content-Type", "application/json")
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}

Responses

{
  "proxies": [
    {
      "sKey": "4d8f1a2b-7c3e-4096-b5a1-9e2d6f0c8b73",
      "proxyName": "HTTPBin",
      "proxyRegion": "us-east-2",
      "proxyActive": true,
      "clientId": "b3a1c7d2-5e44-4f0a-9c1e-7d2f8a6b1c90"
    }
  ],
  "message": "Success"
}
{
  "message": "Input failed data validation",
  "errors": [
    "/proxyProxyCredentialId: must have required property 'proxyProxyCredentialId'"
  ]
}

Copy the sKey — it is the proxyId.

Call the proxy

The proxy URL is https://{region}.requestrocket.com/api/{proxyId}/{target-path}. Authenticate with the inbound credential, not the user token.

curl https://us-east-2.requestrocket.com/api/4d8f1a2b-7c3e-4096-b5a1-9e2d6f0c8b73/get \
  -H "Authorization: my-secret-key"

A granted call returns the HTTPBin JSON and the header requestrocket-proxy-code: proxy-access-granted.

Next

On this page