# Wonky Ord API Documentation

## Introduction

The Wonky Ord API provides access to Junkcoin blockchain data, including transactions, blocks, balances, inscriptions, and dune information. This API allows developers to interact with the Junkcoin blockchain and its various features.

Base URL: `https://junkinals.junk-coin.com/`

## API Endpoints

### Block Information

#### Get Block Count
```http
GET /block-count
```
Returns the current block height of the Junkcoin blockchain.

**Response**: Plain text containing the block count

#### Get Block Details
```http
GET /block/{query}
```
Retrieves block information by height or hash.

**Parameters**:
- `query` (path): Block height or hash

**Response**: HTML formatted block details

#### Get Blocks Range
```http
GET /blocks/{start}/{end}
```
Retrieves multiple blocks within a specified range.

**Parameters**:
- `start` (path): Starting block height
- `end` (path): Ending block height
- `no_inscriptions` (query, optional): Skip inscriptions data
- `no_input_data` (query, optional): Skip input data

**Response**: JSON array of block details

### Transaction Information

#### Get Transaction Details
```http
GET /tx/{txid}
```
Retrieves detailed information about a specific transaction.

**Parameters**:
- `txid` (path): Transaction ID
- `json` (query, optional): Return response in JSON format

**Response**: HTML or JSON formatted transaction details

#### Get Output Details
```http
GET /output/{output}
```
Retrieves information about a specific transaction output.

**Parameters**:
- `output` (path): OutPoint in format `txid:vout`

**Response**: HTML formatted output details

### Balance Information

#### Get UTXO Balance
```http
GET /utxos/balance/{address}
```
Retrieves UTXO balance information for a specific address.

**Parameters**:
- `address` (path): Cryptocurrency address
- `limit` (query, optional): Limit the number of results
- `show_all` (query, optional): Show all UTXOs
- `show_unsafe` (query, optional): Show unsafe UTXOs
- `value_filter` (query, optional): Filter UTXOs by value

**Response Example**:
```json
{
  "utxos": [
    {
      "txid": "string",
      "vout": 0,
      "script": "string",
      "shibes": 0,
      "confirmations": 0
    }
  ],
  "total_shibes": 0,
  "total_utxos": 0,
  "total_inscription_shibes": 0
}
```

### JKC20 Token Operations

#### Get JKC20 Balance
```http
GET /jkc20/balance/{address}
```
Retrieves JKC20 token balance for a specific address.

**Parameters**:
- `address` (path): Cryptocurrency address
- `tick` (query, optional): Filter by token tick
- `show_utxos` (query, optional): Show UTXO information
- `value_filter` (query, optional): Filter by value

#### Get JKC20 Tick Information
```http
GET /jkc20/tick/{tick}
```
Retrieves information about a specific JKC20 token tick.

**Parameters**:
- `tick` (path): JKC20 tick identifier

#### Get All JKC20 Ticks
```http
GET /jkc20/tick
```
Retrieves information about all JKC20 ticks.

### Dune Operations

#### Get Dune Details
```http
GET /dune/{dune}
```
Retrieves information about a specific dune.

**Parameters**:
- `dune` (path): Dune identifier
- `json` (query, optional): Return response in JSON format

#### Get All Dunes
```http
GET /dunes
```
Retrieves a list of all dunes.

#### Get Dune Balances
```http
GET /dunes/balance/{address}
```
Retrieves dune balances for a specific address.

**Parameters**:
- `address` (path): Cryptocurrency address
- `show_all` (query, optional): Show all dune balances
- `list_dunes` (query, optional): List dune information
- `filter` (query, optional): Filter dune information

### Inscription Operations

#### Get Inscription Details
```http
GET /inscription/{inscription_id}
```
Retrieves details about a specific inscription.

**Parameters**:
- `inscription_id` (path): Inscription ID
- `json` (query, optional): Return response in JSON format

#### Get All Inscriptions
```http
GET /inscriptions
```
Retrieves a list of all inscriptions.

#### Get Inscriptions From Number
```http
GET /inscriptions/{from}
```
Retrieves inscriptions starting from a specific number.

**Parameters**:
- `from` (path): Inscription number to start from

#### Get Inscription Content
```http
GET /content/{inscription_id}
```
Retrieves the content of a specific inscription.

**Parameters**:
- `inscription_id` (path): Inscription ID

### Search Operations

#### Search
```http
GET /search?query={query}
```
Search for blocks, transactions, or inscriptions.

**Parameters**:
- `query` (query): Search query

### Pagination Support

Many endpoints support pagination for large datasets:

#### Paginated UTXO Balance
```http
GET /utxos/balance/{address}/{page}
```

#### Paginated JKC20 Balance
```http
GET /jkc20/balance/{address}/{page}
```

#### Paginated Dune Balances
```http
GET /dunes/balance/{address}/{page}
```

## Error Handling

The API uses standard HTTP response codes:

- 200: Success
- 302: Redirect (for search operations)
- 400: Bad Request
- 404: Not Found
- 500: Internal Server Error

## Rate Limiting

Please be mindful of rate limiting and implement appropriate caching strategies in your applications.

## Examples

### Example 1: Get Block Count
```bash
curl https://junkinals.junk-coin.com/block-count
```

### Example 2: Get Transaction Details
```bash
curl https://junkinals.junk-coin.com/tx/abc123...?json=true
```

### Example 3: Get Address Balance
```bash
curl https://junkinals.junk-coin.com/utxos/balance/JUNK123...
```

## Best Practices

1. Implement proper error handling in your applications
2. Cache responses when appropriate
3. Use pagination for large datasets
4. Include appropriate timeouts in your API calls
5. Monitor rate limits and implement backoff strategies
