Skip to main content

v1 (discontinued)

API Discontinued

This API version is discontinued, it's advised you use gRPC.

POST /v1/export

JSON Body

FieldTypeDescription
tokenstringThe bot token for performing requests
channelIdstringThe id of the channel to export

Response Codes

StatusDescription
200Success - exported channel sent as text/html
401Unauthorized - bad Discord bot token
409Conflict - unknown channel

Examples

Typescript:

import fetch from 'node-fetch';

async function exportChannel(channelId: string, token: string): Promise<Buffer> {
const response = await fetch('http://exportapi:80/v1/export', {
method: 'POST',
body: JSON.stringify({ channelId, token }),
headers: {
'Content-Type': 'application/json'
}
});
if (response.ok) {
return response.buffer();
}
throw Error('Channel export failed!');
}

Rust

// reqwest = { version = "0.10", features = ["json"] }
use reqwest::Client;
use std::collections::HashMap;
use std::io::copy;
use std::fs::File;

async fn export_channel(channelId: &str, token: &str) -> Result<File, reqwest::Error> {
let client = Client::new();
let mut map = HashMap::new();
map.insert("channelId", "channel id");
map.insert("token", "discord token");

let file = client.post("http://exportapi:80/v1/export").json(&map).await?.text().await?;

let dest = File::create("myexport.html")?;
copy(&mut file.as_bytes(), &mut dest)?;

Ok(dest)
}