Mastodon API Specification (https://github.com/mastodon/mastodon)
mastodon · Social
Mastodon API Specification (https://github.com/mastodon/mastodon) API
Authentication
Sample Requests
OEmbed as JSON
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/mastodon.local/1.0/api/oembed?url=https%3A%2F%2Fexample.com&maxwidth=400&maxheight=1"
import requests
params = {
"url": "https://example.com",
"maxwidth": "400",
"maxheight": "1"
}
response = requests.get(
"https://api.apis.guru/v2/specs/mastodon.local/1.0/api/oembed",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/mastodon.local/1.0/api/oembed');
url.searchParams.set('url', 'https://example.com');
url.searchParams.set('maxwidth', '400');
url.searchParams.set('maxheight', '1');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/mastodon.local/1.0/api/oembed")
q := baseURL.Query()
q.Set("url", "https://example.com")
q.Set("maxwidth", "400")
q.Set("maxheight", "1")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/mastodon.local/1.0/api/oembed")
uri.query = URI.encode_www_form({
"url" => "https://example.com",
"maxwidth" => "400",
"maxheight" => "1"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/mastodon.local/1.0/api/oembed?" . http_build_query([
"url" => "https://example.com",
"maxwidth" => "400",
"maxheight" => "1"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));View identity proof
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/mastodon.local/1.0/api/proofs?provider=example&username=testuser"
import requests
params = {
"provider": "example",
"username": "testuser"
}
response = requests.get(
"https://api.apis.guru/v2/specs/mastodon.local/1.0/api/proofs",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/mastodon.local/1.0/api/proofs');
url.searchParams.set('provider', 'example');
url.searchParams.set('username', 'testuser');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/mastodon.local/1.0/api/proofs")
q := baseURL.Query()
q.Set("provider", "example")
q.Set("username", "testuser")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/mastodon.local/1.0/api/proofs")
uri.query = URI.encode_www_form({
"provider" => "example",
"username" => "testuser"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/mastodon.local/1.0/api/proofs?" . http_build_query([
"provider" => "example",
"username" => "testuser"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Displays an authorization form to the user. If approved, it will create and return an authorization code, then redirect to the desired redirect_uri, or show the authorization code if urn:ietf:wg:oauth:2.0:oob was requested. The authorization code can be used while requesting a token to obtain access
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/mastodon.local/1.0/oauth/authorize?scope=example&client_id=example&force_login=true&redirect_uri=example&response_type=example"
import requests
params = {
"scope": "example",
"client_id": "example",
"force_login": "true",
"redirect_uri": "example",
"response_type": "example"
}
response = requests.get(
"https://api.apis.guru/v2/specs/mastodon.local/1.0/oauth/authorize",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/mastodon.local/1.0/oauth/authorize');
url.searchParams.set('scope', 'example');
url.searchParams.set('client_id', 'example');
url.searchParams.set('force_login', 'true');
url.searchParams.set('redirect_uri', 'example');
url.searchParams.set('response_type', 'example');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/mastodon.local/1.0/oauth/authorize")
q := baseURL.Query()
q.Set("scope", "example")
q.Set("client_id", "example")
q.Set("force_login", "true")
q.Set("redirect_uri", "example")
q.Set("response_type", "example")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/mastodon.local/1.0/oauth/authorize")
uri.query = URI.encode_www_form({
"scope" => "example",
"client_id" => "example",
"force_login" => "true",
"redirect_uri" => "example",
"response_type" => "example"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/mastodon.local/1.0/oauth/authorize?" . http_build_query([
"scope" => "example",
"client_id" => "example",
"force_login" => "true",
"redirect_uri" => "example",
"response_type" => "example"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- See official documentation for authentication and setup.
What can you build with Mastodon API Specification (https://github.com/mastodon/mastodon)?
Mastodon API Specification (https://github.com/mastodon/mastodon) is a Social API. Developers commonly use social APIs for:
- adding social login (Sign in with Google/Twitter)
- fetching user-generated content for analysis
- scheduling and publishing social posts
- tracking mentions and engagement metrics
- building community dashboards
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. Mastodon API Specification (https://github.com/mastodon/mastodon) is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide