REST API

Your First Requests

Once you have your API key and Oracle Program ID, you can make your first request to SEDA FAST.

Basic Example (cURL):

curl -X GET "https://fast-api.seda.xyz/execute?execProgramId=YOUR_PROGRAM_ID&execInputs=YOUR_INPUTS" \\
  -H "Authorization: Bearer YOUR_API_KEY"
circle-info

By default inputs prefixed with 0x are treated as hexadecimal and inputs without 0x are directly passed as a UTF-8 string. See API reference for more details.

Javascript Example:

const response = await fetch(
  'https://fast-api.seda.xyz/execute?execProgramId=YOUR_PROGRAM_ID&execInputs=YOUR_INPUTS',
  {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  }
);

const data = await response.json();
console.log(data);
circle-info

The /execute endpoint supports both GET (with query parameters) and POST (JSON body). For more complex inputs we recommend POST.

Understanding the Response

A successful execution returns a JSON response structured as follows:

Key fields:

  • id - Unique identifier for this execution request

  • dataRequest - Details of the Oracle Program execution request (program IDs, inputs, gas limits)

  • dataResult.result - The hex-encoded final result from the Oracle Program

  • dataResult.exitCode - 0 indicates success, non-zero indicates an error

  • dataResult.gasUsed - Total gas consumed during execution

  • dataResult.drId - Unique identifier for this data request

  • signature - Cryptographic signature produced by the FAST service.

  • result - Convenient top-level access to the result (same as dataResult.result)

circle-info

Additional fields may be included in the response depending on the query parameters used. See the API Reference for complete details on all available parameters and response fields.

Basic Error Handling

SEDA FAST uses standard HTTP status codes to indicate success or failure. Always check the response status before processing the data. Common error codes include insufficient credits (403), invalid API keys (401), and program execution failures (599).

Javascript example:

The error code 599 is a special case. The request succeeded, but the oracle program ran into a problem during execution and exited with a non-zero exit code. When debugging these failures, the response can include additional fields like "stderr" and "stdout" to help identify the issue (use the includeDebugInfo parameter to enable these).

For a complete list of error codes and their meanings, see the Error Codes section in the REST API Reference.

Last updated

Was this helpful?