The Request API is a REST API that enables you to create requests, list requests, and find a specific request by its ID. Its purpose is to simplify interaction with the Request Protocol, abstracting all Blockchain-related aspects.
Our API accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes and Bearer authentication.
Before using the API you must create an account here, and retrieve your test API Key (which will run on the Rinkeby Ethereum Test network). If you would like to verify your code on Ethereum Mainnet, you may use the live API Key.
Please note, if you would like to run a completely decentralized version of the Request network you can deploy your own node and interact with the network using the Request Client.
You can view the full API spec here.
To construct a REST API request, combine these components:
Component | Description |
HTTP method |
|
API URL | Mainnet. |
URI Path | The resource to query, submit data to, update, or delete. For example, |
Optional. Controls which data appears in the response. Use to filter, limit the size of, and sort the data in an API response. | |
HTTP Request Headers | Includes the |
JSON request body | Required for some endpoints, and details in the specs. |
The Request API uses API keys to authenticate requests. You can view and manage your API keys using your Request Account.
Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
Status Code | Summary |
| Everything worked as expected. |
| No valid API key provided. |
| You cannot access this resource. |
| The requested resource doesn't exist. |
The Request API uses conventional HTTP response codes to indicate the success or failure of an API request. In general: The 200
code indicates a successful request. Codes in the 4xx
range indicate an error that failed given the information provided (e.g., a required parameter was omitted, authentication issue, etc.).
When fetching multiple Requests you will need to utilize cursor-based pagination via the skip
and take
parameters. Both parameters take an integer value and return a list of Requests ordered by the Request ID. The skip
parameter bypasses a specified number of search results. The take
parameter specifies the number of search results to return. Both of these parameters are optional, the defaults can be found here.
As an example, if you wanted to retrieve the first 50 Requests, skip
would equal 0, and the take
value would be 50. If you then wanted to retrieve the subsequent 50 Requests skip
would equal 50, and take
would equal 50.
We assume API_KEY environment variable is set. You can do that with API_KEY=YOUR-API-KEY
. Don't forget, you can get your API key from your Request Dashboard.
Here is an example of creating a Request using the API via curl. We are creating a basic BTC request.
curl -H "Authorization: $API_KEY" \-H "Content-Type: application/json" \-X POST \-d '{"currency": "BTC","expectedAmount": "100000000", "payment": { "type": "bitcoin-testnet", "value": "mqdT2zrDfr6kp69hHLBM8CKLMtRzRbT2o9" }}' \https://api.request.network/requests
You can then retrieve your Request with this command.
curl -H "Authorization: $API_KEY" \-H "Content-Type: application/json" \https://api.request.network/requests/[YOUR_REQUEST_ID]
To create an invoice, you must create a basic Request
object which outlines some information about the Request such as the receiving payment address, which payment network is being used, the currency and the amount expected. You can retrieve individual requests as well as list all requests. Requests are identified by a unique UUID.
The data
object contains a requestId
field that you can use for other API calls.
Heads up!
If you are an early adopter of this API, please note the temporary _id
field has been removed and replaced with requestId
, which is the actual identifier of the Request on the Network. Use this field to fetch a Request, like in the example below.
All invoices have a unique ID, with this ID you can retrieve all the details of an invoice that has previously been created. By supplying the ID that was returned when creating the invoice you can query the endpoint as seen below, the API will then return the corresponding invoice information.
If you would like to get in touch with other developers, and the team that works on this API, you can join our Slack workspace and write in the #develoment channel.