xga.fyi
API Endpoints/Auctions

Get auctions with filtering and pagination

Retrieve auctions with optional filtering by state, slot range, and other criteria. Results are paginated and include metadata for navigation.

GET
/api/v1/auctions

Query Parameters

state?string

Filter by auction state

Value in"pending" | "bidding" | "closing" | "settling" | "settled" | "finalizing" | "finalized" | "disputed" | "cancelled"
fromSlot?number

Filter auctions from this slot number

Range1 <= value
toSlot?number

Filter auctions up to this slot number

Range1 <= value
limit?number

Number of results to return

Range1 <= value <= 100
offset?number

Number of results to skip

Response Body

curl -X GET "http://localhost:3000/api/v1/auctions?state=bidding&fromSlot=1234567&toSlot=1234600&limit=20"
fetch("http://localhost:3000/api/v1/auctions?state=bidding&fromSlot=1234567&toSlot=1234600&limit=20")
package main

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

func main() {
  url := "http://localhost:3000/api/v1/auctions?state=bidding&fromSlot=1234567&toSlot=1234600&limit=20"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "http://localhost:3000/api/v1/auctions?state=bidding&fromSlot=1234567&toSlot=1234600&limit=20"

response = requests.request("GET", url)

print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;

HttpClient client = HttpClient.newBuilder()
  .connectTimeout(Duration.ofSeconds(10))
  .build();

HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
  .uri(URI.create("http://localhost:3000/api/v1/auctions?state=bidding&fromSlot=1234567&toSlot=1234600&limit=20"))
  .GET()
  .build();

try {
  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
  System.out.println("Status code: " + response.statusCode());
  System.out.println("Response body: " + response.body());
} catch (Exception e) {
  e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;

var client = new HttpClient();
var response = await client.GetAsync("http://localhost:3000/api/v1/auctions?state=bidding&fromSlot=1234567&toSlot=1234600&limit=20");
var responseBody = await response.Content.ReadAsStringAsync();
{
  "data": [
    {
      "id": "pfh0haxfpzowht3oi213cqos",
      "slot": 1234567,
      "state": "bidding",
      "createdAt": "2024-01-01T00:00:00.000Z",
      "biddingDeadline": "2024-01-01T00:00:08.000Z",
      "settlementDeadline": "2024-01-01T00:00:12.000Z",
      "finalizedAt": "2024-01-01T00:00:20.000Z",
      "metadata": {
        "reservePrice": "1000000000000000000",
        "maxBidders": 100,
        "settlementMethod": "uniform_price"
      },
      "totalBids": 42,
      "clearingPrice": "1500000000000000000",
      "totalAllocated": 1000
    }
  ],
  "meta": {
    "page": 0,
    "limit": 20,
    "total": 150,
    "totalPages": 8,
    "hasNext": true,
    "hasPrevious": false,
    "currentPageItems": 20
  },
  "links": {
    "first": "/api/v1/bids?limit=20&offset=0",
    "previous": null,
    "self": "/api/v1/bids?limit=20&offset=0",
    "next": "/api/v1/bids?limit=20&offset=20",
    "last": "/api/v1/bids?limit=20&offset=140"
  }
}
{
  "statusCode": 400,
  "message": "Validation failed",
  "error": "Bad Request",
  "code": "VALIDATION_ERROR",
  "details": {
    "value": [
      "must be a positive number",
      "must be a string"
    ],
    "gasFeeCap": [
      "must not be empty"
    ]
  },
  "timestamp": "2024-01-01T12:00:00.000Z",
  "path": "/api/v1/bids",
  "requestId": "req_1234567890abcdef"
}