← Back to docs

irclog-api-guide

Language: EN | EN | SV

IRC Memory Lane - API Guide

For developers who want to search logs or integrate with other systems.

What is the API?

The API lets you search IRC logs directly without using the web interface. Perfect for:

Getting Started

1. Get an API Key

  1. Log in to IRC Memory Lane
  2. Go to SettingsAPI Keys
  3. Click Create New Key
  4. Copy the key (shown only once!)

2. Use the Key in Your Requests

Add the key to every request:

curl -H "Authorization: Bearer YOUR_KEY" \
  https://tools.tornevall.net/api/irclog/search?q=hello

Search Examples

Simple Search

GET /api/irclog/search?q=hello&channel_id=123

Returns first 100 results containing "hello" in channel 123.

Advanced Search

POST /api/irclog/search
Authorization: Bearer YOUR_KEY
Content-Type: application/json

{
  "query": "php mysql",
  "channel_id": 123,
  "nick": "Robin",
  "date_from": "2024-01-01",
  "date_to": "2024-12-31",
  "limit": 50,
  "page": 1
}

Response:

{
  "results": [
    {
      "id": 12345,
      "channel": "#general",
      "network": "EFNet",
      "nick": "Robin",
      "message": "php and mysql",
      "occurred_at": "2024-01-15T14:30:00Z",
      "permalink": "/irclog/h/abc123xyz"
    }
  ],
  "total": 42,
  "page": 1,
  "per_page": 50
}

Highlights - Save Favorites via API

Get Your Highlights

GET /api/irclog/highlights
Authorization: Bearer YOUR_KEY

Response:

{
  "highlights": [
    {
      "id": 789,
      "title": "Funny quote",
      "event": {
        "nick": "Robin",
        "message": "That was funny!",
        "date": "2024-01-15T14:30:00Z"
      },
      "permalink": "/irclog/h/abc123xyz"
    }
  ]
}

Create a Highlight

POST /api/irclog/highlights
Authorization: Bearer YOUR_KEY
Content-Type: application/json

{
  "log_event_id": 12345,
  "title": "Important quote",
  "note": "This person was right",
  "is_public": true
}

Response:

{
  "id": 789,
  "permalink": "/irclog/h/abc123xyz"
}

Now you can share the link /irclog/h/abc123xyz with others!

Code Examples

JavaScript/Node.js

const API_KEY = 'your_key_here';

// Search
async function search(query) {
  const response = await fetch(
    'https://tools.tornevall.net/api/irclog/search?q=' + query,
    {
      headers: {
        'Authorization': 'Bearer ' + API_KEY
      }
    }
  );
  
  const data = await response.json();
  return data.results;
}

// Use it
search('php mysql').then(results => {
  results.forEach(r => {
    console.log(r.nick + ': ' + r.message);
  });
});

Python

import requests

API_KEY = 'your_key_here'
headers = {'Authorization': f'Bearer {API_KEY}'}

# Search
response = requests.post(
  'https://tools.tornevall.net/api/irclog/search',
  headers=headers,
  json={
    'query': 'php mysql',
    'channel_id': 123,
    'limit': 50
  }
)

results = response.json()['results']
for msg in results:
  print(f"{msg['nick']}: {msg['message']}")

PHP

<?php
$apiKey = 'your_key_here';

$ch = curl_init('https://tools.tornevall.net/api/irclog/search');
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'query' => 'php mysql',
        'channel_id' => 123,
        'limit' => 50
    ])
]);

$response = curl_exec($ch);
$data = json_decode($response, true);

foreach ($data['results'] as $msg) {
    echo $msg['nick'] . ': ' . $msg['message'] . "\n";
}
?>

Error Codes

If something goes wrong:

{
  "error": "Something went wrong",
  "code": "ERROR_CODE"
}

Common error codes:

Limits

Need higher limits? Contact admin!

Date Format

Always use ISO 8601 format for dates:

2024-01-15        ← Date only
2024-01-15T14:30:00Z   ← Date + time (UTC)

More Info


Version: 1.0
Updated: 2026-02-24