Expansions
The expansion object
Each field available on a Magic: The Gathering expansion is described below with its field name and corresponding data type.
id <string>
The unique identifier for the expansion (e.g., LEA).
name <string>
The name of the expansion (e.g., Limited Edition Alpha).
code <string>
The set code for the expansion (e.g., LEA).
type <string>
The type of expansion (e.g., core, expansion, commander).
block <string | null>
The name of the block the expansion belongs to. May be null if the expansion does not belong to a block.
parent_id <string | null>
The identifier of the parent expansion, if this expansion is part of another set. May be null if there is no parent expansion.
total <integer>
The total set size, including cards beyond the base set numbering. Foil and non-foil versions are not counted separately.
language <string>
The language of the expansion. Defaults to English when no language is provided.
language_code <string>
The two-letter language code of the expansion. Defaults to EN when no language code is provided.
release_date <string | null>
The release date of the expansion in YYYY/MM/DD format (e.g., 1993/08/05). May be null if the release date is unavailable.
is_foreign_only <boolean>
Whether the expansion was released exclusively in languages other than English.
is_foil_only <boolean>
Whether the expansion contains only foil cards.
is_non_foil_only <boolean>
Whether the expansion contains only non-foil cards.
is_online_only <boolean>
Whether the expansion is available exclusively in digital form.
is_paper_only <boolean>
Whether the expansion is available exclusively in physical form.
is_partial_preview <boolean>
Whether the expansion data represents a partial preview rather than the complete set.
logo <string>
The URL of the expansion’s logo.
symbol <string>
The URL of the expansion’s set symbol.
Here is an example JSON representation of the Magic The Gathering expansion object:
{
"id": "NPH",
"name": "New Phyrexia",
"code": "NPH",
"type": "expansion",
"block": "Scars of Mirrodin",
"parent_id": null,
"total": 180,
"release_date": "2011/05/13",
"is_foreign_only": false,
"is_foil_only": false,
"is_non_foil_only": false,
"is_online_only": false,
"is_paper_only": false,
"is_partial_preview": false,
"language": "English",
"language_code": "EN",
"logo": "https://images.scrydex.com/magicthegathering/NPH-logo/logo",
"symbol": "https://images.scrydex.com/magicthegathering/NPH-symbol/symbol"
}
curl --request GET \
--url https://api.scrydex.com/magicthegathering/v1/expansions \
--header 'X-Api-Key: <api_key_here>'
--header 'X-Team-ID: <team_id_here>'
curl --request GET \
--url https://api.scrydex.com/magicthegathering/v1/expansions/NPH \
--header 'X-Api-Key: <api_key_here>'
--header 'X-Team-ID: <team_id_here>'
Get an expansion
This endpoint retrieves a specific Magic The Gathering expansion by its unique identifier.
URL
GET https://api.scrydex.com/magicthegathering/v1/expansions/<id>
URL Parameters
- id
<string>
The unique identifier of the expansion to retrieve. This is a required parameter.
Query Parameters
select
<comma-separated string>
Specifies which fields to return in the response (e.g.,"name,logo").casing
<string>
Allows changing the output format of the response. Supported values are:camelsnake
Here is how you can retrieve an expansion using various programming languages (SDKs coming soon):
curl --request GET \
--url https://api.scrydex.com/magicthegathering/v1/expansions/NPH \
--header 'X-Api-Key: <api_key_here>'
--header 'X-Team-ID: <team_id_here>'
Search expansions
Fetching and searching for multiple expansions in the Scrydex API is simple yet powerful.
Use the various query parameters to customize your requests and retrieve the specific cards or data you need.
Query Parameters
All query parameters are optional, but combining them allows for advanced and targeted searches.
Note that all query parameters can be used with snake case or camel case (so pageSize or page_size are both acceptable).
| Parameter | Description | Default Value |
|---|---|---|
| q | A search query for advanced filtering. Examples can be found below. | - |
| page | The page of data to access. | 1 |
| page_size | The maximum number of cards to return per page. The highest allowable value is 100. |
100 (max: 100) |
| select | A comma-delimited list of fields to return in the response (e.g., ?select=id,name). If omitted, all fields are returned. |
- |
Key Features of q (Search Queries)
Search queries use a Lucene-like syntax for filtering, making it easy to build powerful card searches.
Below are examples of supported query operations:
Keyword Matching
- Find expansions that contain "phyrexia" in the name field:
name:phyrexia - Search for the phrase "new phyrexia" in the name field:
name:"new phyrexia" - Combine multiple conditions:
- Expansions with the type "core" and a total less than 300 cards:
type:core total:[* TO 300]
- Expansions with the type "core" and a total less than 300 cards:
Exclude Results
- Retrieve only expansions with
type:corewhile excluding phyrexia:type:core -name:phyrexia
Wildcard Matching
- Expansions where the name starts with "new":
name:new* - Expansions where the name starts with "tales" and ends with "earth":
name:tales*earth
Exact Matching
- Match expansions where the name is exactly "new phyrexia" (no other characters appear in the name field):
!name:"new phyrexia"
Range Searches
Fields containing numerical data (e.g., "total", "printed_total") support range searches:
- Expansions with at least 200 cards:
total:[200 TO *] - Expansions with at most 100 cards:
total:[* TO 100] - Expansions with a printed total of 100 or more:
total:[100 TO *]
Pro Tip: Use square brackets
[ ]for inclusive ranges, and curly braces{ }for exclusive ranges.
Example: Fetch & Search Expansions
Use the query parameters to retrieve and search expansions. Below are examples using Scrydex API:
Ordering Data
The orderBy parameter allows for flexible sorting of results:
- Order expansions by name:
?orderBy=name - Combine ascending (
ASC) and descending (DESC) order:?orderBy=name,-total
Field Selection
Optimize and reduce response payload sizes using the select parameter to return only the fields you care about:
- Example: Request only
idandnamefields for all cards:?select=id,name
Response Example
Here’s a sample response for a search query:
{
"data": [
{
"id": "ONE",
"name": "Phyrexia: All Will Be One",
"code": "ONE",
"type": "expansion",
"block": null,
"parent_id": null,
"total": 493,
"release_date": "2023/02/03",
"is_foreign_only": false,
"is_foil_only": false,
"is_non_foil_only": false,
"is_online_only": false,
"is_paper_only": false,
"is_partial_preview": false,
"language": "English",
"language_code": "EN",
"logo": "https://images.scrydex.com/magicthegathering/ONE-logo/logo",
"symbol": "https://images.scrydex.com/magicthegathering/ONE-symbol/symbol"
},
{
"id": "NPH",
"name": "New Phyrexia",
"code": "NPH",
"type": "expansion",
"block": "Scars of Mirrodin",
"parent_id": null,
"total": 180,
"release_date": "2011/05/13",
"is_foreign_only": false,
"is_foil_only": false,
"is_non_foil_only": false,
"is_online_only": false,
"is_paper_only": false,
"is_partial_preview": false,
"language": "English",
"language_code": "EN",
"logo": "https://images.scrydex.com/magicthegathering/NPH-logo/logo",
"symbol": "https://images.scrydex.com/magicthegathering/NPH-symbol/symbol"
}
],
"page": 1,
"page_size": 100,
"count": 2,
"total_count": 2
}
Best Practices for Fetching & Searching
- Paginate Results: Use the
pageandpageSizeparameters to prevent overloading responses. - Limit Fields Returned: Use the
selectparameter to only get the data you need. - Avoid Overhead: Minimize wildcard or range queries for better performance.
