Scryfall MTG API
api.scryfall.com · Media
The definitive Magic: The Gathering API — 100,000+ cards with prices, rulings, images, sets, and search syntax. Free, no API key required.
Authentication
No authentication requiredFree to use with no key needed.
Sample Requests
GET
Search cards
Search for Lightning Bolt cards sorted by price.
https://api.scryfall.com/cards/search?q=lightning bolt&order=usd
Hover any highlighted part to learn what it does
curl -X GET "https://api.scryfall.com/cards/search?q=lightning%20bolt&order=usd"
import requests
params = {
"q": "lightning bolt",
"order": "usd"
}
response = requests.get(
"https://api.scryfall.com/cards/search",
params=params,
)
print(response.json())const url = new URL('https://api.scryfall.com/cards/search');
url.searchParams.set('q', 'lightning bolt');
url.searchParams.set('order', 'usd');
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.scryfall.com/cards/search")
q := baseURL.Query()
q.Set("q", "lightning bolt")
q.Set("order", "usd")
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.scryfall.com/cards/search")
uri.query = URI.encode_www_form({
"q" => "lightning bolt",
"order" => "usd"
})
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.scryfall.com/cards/search?" . http_build_query([
"q" => "lightning bolt",
"order" => "usd"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Random card
Get a completely random Magic card.
https://api.scryfall.com/cards/random
Hover any highlighted part to learn what it does
curl -X GET "https://api.scryfall.com/cards/random"
import requests
response = requests.get(
"https://api.scryfall.com/cards/random",
)
print(response.json())const url = 'https://api.scryfall.com/cards/random'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.scryfall.com/cards/random"
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.scryfall.com/cards/random")
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.scryfall.com/cards/random";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Card by name
Get Black Lotus card data.
https://api.scryfall.com/cards/named?exact=Black Lotus
Hover any highlighted part to learn what it does
curl -X GET "https://api.scryfall.com/cards/named?exact=Black%20Lotus"
import requests
params = {
"exact": "Black Lotus"
}
response = requests.get(
"https://api.scryfall.com/cards/named",
params=params,
)
print(response.json())const url = new URL('https://api.scryfall.com/cards/named');
url.searchParams.set('exact', 'Black Lotus');
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.scryfall.com/cards/named")
q := baseURL.Query()
q.Set("exact", "Black Lotus")
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.scryfall.com/cards/named")
uri.query = URI.encode_www_form({
"exact" => "Black Lotus"
})
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.scryfall.com/cards/named?" . http_build_query([
"exact" => "Black Lotus"
]);
$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
- No API key needed
- Try GET https://api.scryfall.com/cards/random
- Search syntax: GET /cards/search?q=type:creature+cmc=3
- Named: GET /cards/named?exact=Lightning+Bolt or ?fuzzy=lightnin+bolt
- Images included in image_uris field