API Reference

REST API and GraphQL endpoints for Base Names Service integration.

API Coming Soon
In Development

Our REST API and GraphQL endpoints are currently in development. For now, please interact directly with the smart contracts using web3 libraries like Viem or ethers.js.

Smart Contract Interface

Use these contract methods to interact with Base Names directly

BaseRegistrar.available(uint256 id)

Check if a domain is available for registration

// Returns: bool
const isAvailable = await contract.read.available([labelHash('mydomain')]);

BaseController.rentPrice(string name, uint256 duration)

Get the cost to register a domain for specified duration

// Returns: [basePrice, premium]
const [basePrice, premium] = await contract.read.rentPrice(['mydomain', duration]);

BaseController.register(...)

Register a new domain (payable function)

// Parameters: name, owner, duration, secret, resolver, data, reverseRecord, ownerControlledFuses
await contract.write.register([
  'mydomain',
  '0x...',
  duration,
  '0x0000...',
  resolverAddress,
  [],
  true,
  0
], { value: totalPrice });

Planned API Endpoints

These endpoints will be available when our API launches

GET /api/domains/{name}

Coming Soon

Get domain information including availability, owner, and resolver records

GET /api/domains/search

Coming Soon

Search for available domains with filters and sorting

GET /api/address/{address}/domains

Coming Soon

Get all domains owned by a specific address

GET /api/analytics

Coming Soon

Get registration statistics and marketplace data

GraphQL Endpoint

Flexible query interface for complex data requirements

POST /graphql

Coming Soon

GraphQL endpoint for complex queries across domains, owners, and analytics data.

query GetDomainInfo($name: String!) {
  domain(name: $name) {
    name
    owner
    available
    expiryDate
    resolver {
      address
      contentHash
    }
    records {
      key
      value
    }
  }
}

Current Integration Methods

Direct Contract Interaction

Use web3 libraries to interact directly with our verified smart contracts:

Documentation

For detailed integration guides and examples, visit our documentation page.