### Get All Sets (Python) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use Set.all() to retrieve all available sets. No specific setup is required beyond importing the library. ```python sets = Set.all() ``` -------------------------------- ### Ordering Data Examples Source: https://docs.pokemontcg.io/api-reference/cards/search-cards Examples of using the orderBy query parameter to sort API results. ```text ?orderBy=number ``` ```text ?orderBy=name,-number ``` -------------------------------- ### Search Query Syntax Examples Source: https://docs.pokemontcg.io/api-reference/cards/search-cards Examples of Lucene-like query strings for filtering card data. ```text name:charizard ``` ```text name:"venusaur v" ``` ```text name:charizard subtypes:mega ``` ```text name:charizard (subtypes:mega OR subtypes:vmax) ``` ```text subtypes:mega -types:water ``` ```text name:char* ``` ```text name:char*der ``` ```text !name:charizard ``` ```text nationalPokedexNumbers:[1 TO 151] ``` ```text hp:[* TO 100] ``` ```text hp:[150 TO *] ``` ```text set.id:sm1 ``` ```text attacks.name:Spelunk ``` ```text legalities.standard:banned ``` -------------------------------- ### Python Code Examples Source: https://docs.pokemontcg.io/api-reference/cards/search-cards Examples of how to search and filter cards using the pokemontcg.io Python library. ```APIDOC ## Python Examples ### Get all cards (will take awhile, automatically pages through data) ```python cards = Card.all() ``` ### Get a single page of cards ```python cards = Card.where(page=1, pageSize=250) ``` ### Filter cards via query parameters ```python cards = Card.where(q='set.name:generations subtypes:mega') ``` ### Order by release date (descending) ```python cards = Card.where(q='subtypes:mega', orderBy='-set.releaseDate') ``` ``` -------------------------------- ### Ruby Code Examples Source: https://docs.pokemontcg.io/api-reference/cards/search-cards Examples of how to search and filter cards using the pokemontcg.io Ruby library. ```APIDOC ## Ruby Examples ### Get all cards (will take awhile, automatically pages through data) ```ruby cards = Pokemon::Card.all ``` ### Get a single page of cards ```ruby cards = Pokemon::Card.where(page: 1, pageSize: 250) ``` ### Filter cards via query parameters ```ruby cards = Pokemon::Card.where(q: 'set.name:generations subtypes:mega') ``` ### Order by release date (descending) ```ruby cards = Pokemon::Card.where(q: 'subtypes:mega', orderBy: '-set.releaseDate') ``` ``` -------------------------------- ### Get All Sets (Ruby) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use Pokemon::Set.all to retrieve all available sets. This requires the Pokemon Ruby client library to be installed and configured. ```ruby sets = Pokemon::Set.all ``` -------------------------------- ### cURL Code Examples Source: https://docs.pokemontcg.io/api-reference/cards/search-cards Examples of how to search and filter cards using cURL. ```APIDOC ## cURL Examples ### Get all cards ```bash curl "https://api.pokemontcg.io/v2/cards" ``` ### Get a single page of cards ```bash curl "https://api.pokemontcg.io/v2/cards?page=1&pageSize=250" ``` ### Filter cards via query parameters ```bash curl "https://api.pokemontcg.io/v2/cards?q=set.name:generations subtypes:mega" ``` ### Order by release date (descending) ```bash curl "https://api.pokemontcg.io/v2/cards?q=subtypes:mega&orderBy=-set.releaseDate" ``` ``` -------------------------------- ### JavaScript Code Examples Source: https://docs.pokemontcg.io/api-reference/cards/search-cards Examples of how to search and filter cards using the pokemontcg.io JavaScript library. ```APIDOC ## JavaScript Examples ### Get all cards (will take awhile, automatically pages through data) ```javascript pokemon.card.all() .then((cards) => { console.log(cards[0].name) // "Blastoise" }) ``` ### Get a single page of cards ```javascript pokemon.card.where({ pageSize: 250, page: 1 }) .then(result => { console.log(result.data[0].name) // "Blastoise" }) ``` ### Filter cards via query parameters ```javascript pokemon.card.all({ q: 'set.name:generations subtypes:mega' }) .then(result => { console.log(result.data[0].name) // "Venusaur" }) ``` ### Order by release date (descending) ```javascript pokemon.card.all({ q: 'subtypes:mega', orderBy: '-set.releaseDate' }) .then(result => { console.log(result.data[0].name) }) ``` ``` -------------------------------- ### Get All Supertypes (Python) Source: https://docs.pokemontcg.io/api-reference/supertypes/get-supertypes Use the Supertype.all() method to retrieve all supertypes. Ensure the PokemonTCG library is installed and configured. ```python supertypes = Supertype.all() ``` -------------------------------- ### Get All Rarities (Python) Source: https://docs.pokemontcg.io/api-reference/rarities/get-rarities Use this method to retrieve all available rarity types from the API. Ensure you have the necessary library installed. ```python rarities = Rarity.all() ``` -------------------------------- ### Get All Supertypes (Ruby) Source: https://docs.pokemontcg.io/api-reference/supertypes/get-supertypes Use the Pokemon::Supertype.all method to retrieve all supertypes. This requires the Pokemon TCG Ruby gem to be installed. ```ruby supertypes = Pokemon::Supertype.all ``` -------------------------------- ### API Client Implementation Examples Source: https://docs.pokemontcg.io/api-reference/cards/search-cards Code samples for interacting with the Pokémon TCG API using various languages. ```python # Get all cards (will take awhile, automatically pages through data) cards = Card.all() # Get a single page of cards cards = Card.where(page=1, pageSize=250) # Filter cards via query parameters cards = Card.where(q='set.name:generations subtypes:mega') # Order by release date (descending) cards = Card.where(q='subtypes:mega', orderBy='-set.releaseDate') ``` ```ruby # Get all cards (will take awhile, automatically pages through data) cards = Pokemon::Card.all # Get a single page of cards cards = Pokemon::Card.where(page: 1, pageSize: 250) # Filter cards via query parameters cards = Pokemon::Card.where(q: 'set.name:generations subtypes:mega') # Order by release date (descending) cards = Pokemon::Card.where(q: 'subtypes:mega', orderBy: '-set.releaseDate') ``` ```javascript // Get all cards (will take awhile, automatically pages through data) pokemon.card.all() .then((cards) => { console.log(cards[0].name) // "Blastoise" }) // Get a single page of cards pokemon.card.where({ pageSize: 250, page: 1 }) .then(result => { console.log(result.data[0].name) // "Blastoise" }) // Filter cards via query parameters pokemon.card.all({ q: 'set.name:generations subtypes:mega' }) .then(result => { console.log(result.data[0].name) // "Venusaur" }) // Order by release date (descending) pokemon.card.all({ q: 'subtypes:mega', orderBy: '-set.releaseDate' }) .then(result => { console.log(result.data[0].name) }) ``` ```bash # Get all cards curl "https://api.pokemontcg.io/v2/cards" # Get a single page of cards curl "https://api.pokemontcg.io/v2/cards?page=1&pageSize=250" # Filter cards via query parameters curl "https://api.pokemontcg.io/v2/cards?q=set.name:generations subtypes:mega" # Order by release date (descending) curl "https://api.pokemontcg.io/v2/cards?q=subtypes:mega&orderBy=-set.releaseDate" ``` -------------------------------- ### Get All Sets (cURL) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Make a GET request to the /sets endpoint to retrieve all available sets. No query parameters are needed for this basic request. ```curl curl "https://api.pokemontcg.io/v2/sets" ``` -------------------------------- ### Get All Rarities (cURL) Source: https://docs.pokemontcg.io/api-reference/rarities/get-rarities Use this cURL command to make a direct HTTP GET request to the API endpoint for fetching all rarities. No authentication is required. ```curl curl "https://api.pokemontcg.io/v2/rarities" ``` -------------------------------- ### Get All Supertypes (cURL) Source: https://docs.pokemontcg.io/api-reference/supertypes/get-supertypes Make a GET request to the /supertypes endpoint using cURL to retrieve all available supertypes. ```curl curl "https://api.pokemontcg.io/v2/supertypes" ``` -------------------------------- ### Fetch a card by ID Source: https://docs.pokemontcg.io/api-reference/cards/get-card Examples of retrieving card data using different client libraries and raw HTTP requests. ```python card = Card.find('xy1-1') ``` ```ruby card = Pokemon::Card.find('xy1-1') ``` ```javascript pokemon.card.find('base1-4') .then(card => { console.log(card.name) // "Charizard" }) ``` ```bash curl --request GET \ --url https://api.pokemontcg.io/v2/cards/xy1-1 \ --header 'X-Api-Key: ' ``` -------------------------------- ### Get All Sets (Javascript) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use the pokemon.set.all() method to fetch all sets. This is an asynchronous operation that returns a Promise. ```javascript pokemon.set.all() .then((sets) => { console.log(sets[0].name) // "Base" }) ``` -------------------------------- ### Get All Rarities (Ruby) Source: https://docs.pokemontcg.io/api-reference/rarities/get-rarities This Ruby method fetches all rarity types. It requires the Pokemon TCG gem to be installed and configured. ```ruby rarities = Pokemon::Rarity.all ``` -------------------------------- ### Get All Types (cURL) Source: https://docs.pokemontcg.io/api-reference/types/get-types Use the cURL command to make an HTTP GET request to the Pokemontcg.io API to retrieve all available types. ```cURL curl "https://api.pokemontcg.io/v2/types" ``` -------------------------------- ### Get All Types Source: https://docs.pokemontcg.io/api-reference/types/get-types Retrieves a list of all possible types available in the Pokemon Trading Card Game. ```APIDOC ## GET /v2/types ### Description Get all possible types in the Pokemon Trading Card Game. ### Method GET ### Endpoint https://api.pokemontcg.io/v2/types ### Parameters #### Path Parameters _None_ #### Query Parameters _None_ ### Request Body _None_ ### Response #### Success Response (200) - **data** (array) - A list of strings, where each string is a Pokemon type. #### Response Example { "data": [ "Colorless", "Darkness", "Dragon", "Fairy", "Fighting", "Fire", "Grass", "Lightning", "Metal", "Psychic", "Water" ] } ``` -------------------------------- ### Get Supertypes Source: https://docs.pokemontcg.io/api-reference/supertypes/get-supertypes Retrieves a list of all possible supertypes available in the Pokémon TCG. ```APIDOC ## GET /v2/supertypes ### Description Get all possible supertypes. ### Method GET ### Endpoint https://api.pokemontcg.io/v2/supertypes ### Parameters #### Path Parameters _None_ #### Query Parameters _None_ ### Request Body _None_ ### Response #### Success Response (200) - **data** (array) - A list of supertype strings. #### Response Example ```json { "data": [ "Energy", "Pokémon", "Trainer" ] } ``` ``` -------------------------------- ### Get Specific Page of Data (Python) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use Set.where() with 'page' and 'pageSize' parameters to paginate through the set data. Adjust 'pageSize' up to the maximum allowed. ```python sets = Set.where(page=2, pageSize=10) ``` -------------------------------- ### Fetch Set Details in Python Source: https://docs.pokemontcg.io/api-reference/sets/get-set Use this Python snippet to find a specific set by its ID. Ensure you have the Pokemon TCG library installed. ```python card = Set.find('swsh1') ``` -------------------------------- ### Get All Types (Javascript) Source: https://docs.pokemontcg.io/api-reference/types/get-types Use the pokemon.type.all() method to retrieve all available Pokemon TCG types in Javascript. ```Javascript pokemon.type.all() ``` -------------------------------- ### Get All Types (Python) Source: https://docs.pokemontcg.io/api-reference/types/get-types Use the Type.all() method to retrieve all available Pokemon TCG types in Python. ```Python types = Type.all() ``` -------------------------------- ### GET /v2/subtypes Source: https://docs.pokemontcg.io/api-reference/subtypes/get-subtypes Retrieves a comprehensive list of all valid Pokémon TCG subtypes. ```APIDOC ## GET https://api.pokemontcg.io/v2/subtypes ### Description Retrieves a list of all possible subtypes available in the Pokémon TCG API. ### Method GET ### Endpoint https://api.pokemontcg.io/v2/subtypes ### Response #### Success Response (200) - **data** (array) - A list of strings representing all available subtypes. #### Response Example { "data": [ "BREAK", "Baby", "Basic", "EX", "GX", "Goldenrod Game Corner", "Item", "LEGEND", "Level-Up", "MEGA", "Pokémon Tool", "Pokémon Tool F", "Rapid Strike", "Restored", "Rocket's Secret Machine", "Single Strike", "Special", "Stadium", "Stage 1", "Stage 2", "Supporter", "TAG TEAM", "Technical Machine", "V", "VMAX" ] } ``` -------------------------------- ### Get All Rarities (JavaScript) Source: https://docs.pokemontcg.io/api-reference/rarities/get-rarities Call this method to get all rarity types. This is typically used within a JavaScript application interacting with the API. ```javascript pokemon.rarity.all() ``` -------------------------------- ### GET /v2/rarities Source: https://docs.pokemontcg.io/api-reference/rarities/get-rarities Retrieves a list of all possible card rarities available in the Pokemon TCG database. ```APIDOC ## GET https://api.pokemontcg.io/v2/rarities ### Description Get all possible rarities. ### Method GET ### Endpoint https://api.pokemontcg.io/v2/rarities ### Response #### Success Response (200) - **data** (array) - A list of strings representing all available card rarities. #### Response Example { "data": [ "Amazing Rare", "Common", "LEGEND", "Promo", "Rare", "Rare ACE", "Rare BREAK", "Rare Holo", "Rare Holo EX", "Rare Holo GX", "Rare Holo LV.X", "Rare Holo Star", "Rare Holo V", "Rare Holo VMAX", "Rare Prime", "Rare Prism Star", "Rare Rainbow", "Rare Secret", "Rare Shining", "Rare Shiny", "Rare Shiny GX", "Rare Ultra", "Uncommon" ] } ``` -------------------------------- ### GET /cards/{id} Source: https://docs.pokemontcg.io/api-reference/cards/get-card Fetch the details of a single card by its unique ID. ```APIDOC ## GET https://api.pokemontcg.io/v2/cards/ ### Description Fetch the details of a single card. ### Method GET ### Endpoint https://api.pokemontcg.io/v2/cards/ ### Parameters #### Path Parameters - **id** (string) - Required - The Id of the card #### Query Parameters - **select** (string) - Optional - A comma delimited list of fields to return in the response (ex. ?select=id,name). By default, all fields are returned. ### Response #### Success Response (200) - **data** (object) - The card object containing details such as name, hp, types, attacks, and set information. #### Response Example { "data": { "id": "xy1-1", "name": "Venusaur-EX", "supertype": "Pokémon", "hp": "180" } } ``` -------------------------------- ### Get All Types (Ruby) Source: https://docs.pokemontcg.io/api-reference/types/get-types Use the Pokemon::Type.all method to retrieve all available Pokemon TCG types in Ruby. ```Ruby types = Pokemon::Type.all ``` -------------------------------- ### Get Specific Page of Data (Javascript) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use pokemon.set.where() with 'pageSize' and 'page' properties in the options object to retrieve paginated data. The data is available in the 'data' field of the response. ```javascript pokemon.set.where({ pageSize: 10, page: 2 }) .then(result => { console.log(result.data[0].name) }) ``` -------------------------------- ### Get Specific Page of Data (Ruby) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use Pokemon::Set.where with 'page' and 'pageSize' keys in the hash argument to paginate results. The maximum pageSize is 250. ```ruby sets = Pokemon::Set.where(page: 2, pageSize: 10) ``` -------------------------------- ### GET /cards Source: https://docs.pokemontcg.io/api-reference/cards/search-cards Retrieves a list of Pokémon TCG cards. Supports filtering, sorting, and pagination. ```APIDOC ## GET /cards ### Description Retrieves a list of Pokémon TCG cards. Supports filtering, sorting, and pagination. ### Method GET ### Endpoint /cards ### Query Parameters - **q** (string) - Optional - A query string to filter cards based on various fields (e.g., `name:Pikachu`, `types:Fire`). - **orderBy** (string) - Optional - Field to sort the results by (e.g., `name`, `hp`). - **page** (integer) - Optional - The page number for pagination. Defaults to 1. - **pageSize** (integer) - Optional - The number of results per page. Defaults to 250. ### Response #### Success Response (200) - **data** (array) - An array of card objects. - **page** (integer) - The current page number. - **pageSize** (integer) - The number of results per page. - **count** (integer) - The total number of cards returned for the current query. - **totalCount** (integer) - The total number of cards available matching the query. #### Response Example ```json { "data": [ { "id": "g1-1", "name": "Venusaur-EX", "supertype": "Pokémon", "subtypes": [ "Basic", "EX" ], "hp": "180", "types": [ "Grass" ], "evolvesTo": [ "M Venusaur-EX" ], "rules": [ "Pokémon-EX rule: When a Pokémon-EX has been Knocked Out, your opponent takes 2 Prize cards." ], "attacks": [ { "name": "Frog Hop", "cost": [ "Grass", "Colorless", "Colorless" ], "convertedEnergyCost": 3, "damage": "40+", "text": "Flip a coin. If heads, this attack does 40 more damage." }, { "name": "Poison Impact", "cost": [ "Grass", "Grass", "Colorless", "Colorless" ], "convertedEnergyCost": 4, "damage": "80", "text": "Your opponent's Active Pokémon is now Asleep and Poisoned." } ], "weaknesses": [ { "type": "Fire", "value": "×2" } ], "retreatCost": [ "Colorless", "Colorless", "Colorless", "Colorless" ], "convertedRetreatCost": 4, "set": { "id": "g1", "name": "Generations", "series": "XY", "printedTotal": 115, "total": 115, "legalities": { "unlimited": "Legal", "expanded": "Legal" }, "ptcgoCode": "GEN", "releaseDate": "2016/02/22", "updatedAt": "2020/08/14 09:35:00", "images": { "symbol": "https://images.pokemontcg.io/g1/symbol.png", "logo": "https://images.pokemontcg.io/g1/logo.png" } }, "number": "1", "artist": "Eske Yoshinob", "rarity": "Rare Holo EX", "nationalPokedexNumbers": [ 3 ], "legalities": { "unlimited": "Legal", "expanded": "Legal" }, "images": { "small": "https://images.pokemontcg.io/g1/1.png", "large": "https://images.pokemontcg.io/g1/1_hires.png" }, "tcgplayer": { "url": "https://prices.pokemontcg.io/tcgplayer/g1-1", "updatedAt": "2021/07/15", "prices": { "holofoil": { "low": 2.44, "mid": 5.4, "high": 16.99, "market": 5.38, "directLow": 6.1 } } } } ], "page": 1, "pageSize": 250, "count": 117, "totalCount": 117 } ``` ``` -------------------------------- ### Get All Supertypes (JavaScript) Source: https://docs.pokemontcg.io/api-reference/supertypes/get-supertypes Call the pokemon.supertype.all() method to fetch all supertypes. This assumes you have initialized the Pokemon TCG JavaScript client. ```javascript pokemon.supertype.all() ``` -------------------------------- ### Get Specific Page of Data (cURL) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use the 'page' and 'pageSize' query parameters with the /sets endpoint to fetch specific pages of data. The maximum pageSize is 250. ```curl curl "https://api.pokemontcg.io/v2/sets?page=2&pageSize=10" ``` -------------------------------- ### Get a Set by ID Source: https://docs.pokemontcg.io/api-reference/sets/get-set Fetches the details of a single Pokemon TCG set using its unique identifier. ```APIDOC ## GET /v2/sets/{id} ### Description Fetch the details of a single set. ### Method GET ### Endpoint https://api.pokemontcg.io/v2/sets/ ### Parameters #### Path Parameters - **id** (string) - Required - The Id of the set #### Query Parameters - **select** (string) - Optional - A comma delimited list of fields to return in the response (ex. ?select=id,name). By default, all fields are returned if this query parameter is not used. ### Request Example ```json { "example": "curl --request GET \ --url https://api.pokemontcg.io/v2/sets/swsh1 \ --header 'X-Api-Key: '" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the set details. - **id** (string) - The ID of the set. - **name** (string) - The name of the set. - **series** (string) - The series the set belongs to. - **printedTotal** (integer) - The total number of cards printed in the set. - **total** (integer) - The total number of cards available in the set. - **legalities** (object) - An object detailing the legality of the set in different game formats. - **unlimited** (string) - Legality in unlimited format. - **standard** (string) - Legality in standard format. - **expanded** (string) - Legality in expanded format. - **ptcgoCode** (string) - The PTCGO code for the set. - **releaseDate** (string) - The release date of the set (YYYY/MM/DD). - **updatedAt** (string) - The last updated date and time of the set information. - **images** (object) - An object containing URLs for the set's symbol and logo. - **symbol** (string) - URL for the set's symbol image. - **logo** (string) - URL for the set's logo image. #### Response Example ```json { "data": { "id": "swsh1", "name": "Sword & Shield", "series": "Sword & Shield", "printedTotal": 202, "total": 216, "legalities": { "unlimited": "Legal", "standard": "Legal", "expanded": "Legal" }, "ptcgoCode": "SSH", "releaseDate": "2020/02/07", "updatedAt": "2020/08/14 09:35:00", "images": { "symbol": "https://images.pokemontcg.io/swsh1/symbol.png", "logo": "https://images.pokemontcg.io/swsh1/logo.png" } } } ``` ``` -------------------------------- ### Filter Sets by Query (Python) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use Set.where() with the 'q' parameter to filter sets based on specific criteria, such as legalities. Ensure the query syntax is correct. ```python sets = Set.where(q='legailities.standard:legal') ``` -------------------------------- ### Fetch Set Details in Javascript Source: https://docs.pokemontcg.io/api-reference/sets/get-set Use this Javascript code to asynchronously fetch set details. It logs the set's name to the console upon successful retrieval. ```javascript pokemon.set.find('swsh1') .then(set => { console.log(set.name) // "Sword & Shield" }) ``` -------------------------------- ### Sample Error Response Source: https://docs.pokemontcg.io/getting-started/errors A sample JSON structure for an error response from the Pokémon TCG API. ```APIDOC ## Sample Error Response ```json { "error": { "message": "Bad Request. Your request is either malformed, or is missing one or more required fields.", "code": 400 } } ``` ``` -------------------------------- ### Retrieve all subtypes Source: https://docs.pokemontcg.io/api-reference/subtypes/get-subtypes Fetches the complete list of subtypes available in the Pokémon TCG database. ```python subtypes = Subtype.all() ``` ```ruby types = Pokemon::Subtype.all ``` ```javascript pokemon.subtype.all() ``` ```curl curl "https://api.pokemontcg.io/v2/subtypes" ``` -------------------------------- ### Fetch Set Details using cURL Source: https://docs.pokemontcg.io/api-reference/sets/get-set This cURL command fetches a specific set's details from the Pokemon TCG API. Remember to replace '' with your actual API key. ```curl curl --request GET \ --url https://api.pokemontcg.io/v2/sets/swsh1 \ --header 'X-Api-Key: ' ``` -------------------------------- ### Filter Sets by Query (cURL) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Append the 'q' query parameter to the /sets endpoint URL to filter results. Use URL encoding for special characters if necessary. ```curl curl "https://api.pokemontcg.io/v2/sets?q=legalities.standard:legal" ``` -------------------------------- ### Set Object Attributes Source: https://docs.pokemontcg.io/api-reference/sets/set-object Details the attributes available for the Set object. ```APIDOC ## Set Object Attributes This section details the attributes of the Set object. ### Attributes - **id** (string) - Unique identifier for the object. - **name** (string) - The name of the set. - **series** (string) - The series the set belongs to, like Sword and Shield or Base. - **printedTotal** (integer) - The number printed on the card that represents the total. This total does not include secret rares. - **total** (integer) - The total number of cards in the set, including secret rares, alternate art, etc. - **legalities** (hash) - The legalities of the set. If a given format is not legal, it will not appear in the hash. This is a hash with the following fields: - **standard** (string) - The standard game format. Possible values are Legal. - **expanded** (string) - The expanded game format. Possible values are Legal. - **unlimited** (string) - The unlimited game format. Possible values are Legal. - **ptcgoCode** (string) - The code the Pokémon Trading Card Game Online uses to identify a set. - **releaseDate** (string) - The date the set was released (in the USA). Format is YYYY/MM/DD. - **updatedAt** (string) - The date and time the set was updated. Format is YYYY/MM/DD HH:MM:SS. - **images** (hash) - Any images associated with the set, such as symbol and logo. This is a hash with the following fields: - **symbol** (string) - The url to the symbol image. - **logo** (string) - The url to the logo image. ### Sample JSON ```json { "id": "swsh1", "name": "Sword & Shield", "series": "Sword & Shield", "printedTotal": 202, "total": 216, "legalities": { "unlimited": "Legal", "standard": "Legal", "expanded": "Legal" }, "ptcgoCode": "SSH", "releaseDate": "2020/02/07", "updatedAt": "2020/08/14 09:35:00", "images": { "symbol": "https://images.pokemontcg.io/swsh1/symbol.png", "logo": "https://images.pokemontcg.io/swsh1/logo.png" } } ``` ``` -------------------------------- ### TCGPlayer Card Information Source: https://docs.pokemontcg.io/api-reference/cards/card-object Retrieves TCGPlayer pricing and purchase information for a specific Pokemon card. All prices are in USD. ```APIDOC ## GET /api/v1/cards/{id}/tcgplayer ### Description Fetches TCGPlayer data for a given card, including pricing and purchase URLs. Prices are in USD. ### Method GET ### Endpoint /api/v1/cards/{id}/tcgplayer ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the card. ### Response #### Success Response (200) - **url** (string) - The URL to the TCGPlayer store page. - **updatedAt** (string) - The date the price was last updated (YYYY/MM/DD). - **prices** (hash) - A hash containing various price types: - **normal** (hash) - Normal price details. - **holofoil** (hash) - Holofoil price details. - **reverseHolofoil** (hash) - Reverse holofoil price details. - **1stEditionHolofoil** (hash) - 1st Edition holofoil price details. - **1stEditionNormal** (hash) - 1st Edition normal price details. Each price type hash contains: - **low** (decimal) - The low price of the card. - **mid** (decimal) - The mid price of the card. - **high** (decimal) - The high price of the card. - **market** (decimal) - The market value of the card. - **directLow** (decimal) - The direct low price of the card. #### Response Example ```json { "url": "https://www.tcgplayer.com/product/12345/pokemon-card-name", "updatedAt": "2023/10/27", "prices": { "normal": { "low": 1.00, "mid": 1.50, "high": 2.00, "market": 1.75, "directLow": 1.25 }, "holofoil": { "low": 5.00, "mid": 6.00, "high": 7.00, "market": 6.50, "directLow": 5.50 } } } ``` ``` -------------------------------- ### Search Sets API Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Allows searching for one or many sets using a query string. Supports filtering, pagination, and field selection. ```APIDOC ## GET /v2/sets ### Description Search for one or many sets given a search query. ### Method GET ### Endpoint https://api.pokemontcg.io/v2/sets ### Query Parameters All query parameters are optional. - **q** (string) - Optional - The search query. Examples can be found below. - **page** (integer) - Optional - The page of data to access. Default: 1 - **pageSize** (integer) - Optional - The maximum amount of cards to return. Default: 250 (max of 250) - **orderBy** (string) - Optional - The field(s) to order the results by. Examples can be found below. - **select** (string) - Optional - A comma delimited list of fields to return in the response (ex. ?select=id,name). By default, all fields are returned if this query parameter is not used. ### Request Example ```json { "example": "Not applicable for GET request" } ``` ### Response #### Success Response (200) - **data** (array) - An array of set objects. - **page** (integer) - The current page number. - **pageSize** (integer) - The number of items per page. - **count** (integer) - The total number of items returned in the current response. - **totalCount** (integer) - The total number of items available across all pages. #### Response Example ```json { "data": [ { "id": "base1", "name": "Base", "series": "Base", "printedTotal": 102, "total": 102, "legalities": { "unlimited": "Legal" }, "ptcgoCode": "BS", "releaseDate": "1999/01/09", "updatedAt": "2020/08/14 09:35:00", "images": { "symbol": "https://images.pokemontcg.io/base1/symbol.png", "logo": "https://images.pokemontcg.io/base1/logo.png" } } ], "page": 1, "pageSize": 250, "count": 1, "totalCount": 123 } ``` ``` -------------------------------- ### Fetch Set Details in Ruby Source: https://docs.pokemontcg.io/api-reference/sets/get-set This Ruby snippet demonstrates how to find a Pokemon TCG set using its ID. It requires the Pokemon Ruby gem. ```ruby card = Pokemon::Set.find('swsh1') ``` -------------------------------- ### Filter Sets by Query (Javascript) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use pokemon.set.where() with an object containing the 'q' parameter to filter sets. The result is accessed via the 'data' property of the resolved Promise. ```javascript pokemon.set.where({ q: 'legalities.standard:legal' }) .then(result => { console.log(result.data[0].name) }) ``` -------------------------------- ### Filter Sets by Query (Ruby) Source: https://docs.pokemontcg.io/api-reference/sets/search-sets Use Pokemon::Set.where with a hash argument for the 'q' parameter to filter sets. The query string follows the API's defined syntax. ```ruby sets = Pokemon::Set.where(q: 'legailities.standard:legal') ``` -------------------------------- ### Sample Set JSON Object Source: https://docs.pokemontcg.io/api-reference/sets/set-object This JSON object represents a set in the Pokémon TCG API. It includes details such as the set's ID, name, series, card counts, legalities for game formats, PTCGO code, release date, and image URLs for its symbol and logo. ```json { "id": "swsh1", "name": "Sword & Shield", "series": "Sword & Shield", "printedTotal": 202, "total": 216, "legalities": { "unlimited": "Legal", "standard": "Legal", "expanded": "Legal" }, "ptcgoCode": "SSH", "releaseDate": "2020/02/07", "updatedAt": "2020/08/14 09:35:00", "images": { "symbol": "https://images.pokemontcg.io/swsh1/symbol.png", "logo": "https://images.pokemontcg.io/swsh1/logo.png" } } ``` -------------------------------- ### Sample Error Response Format Source: https://docs.pokemontcg.io/getting-started/errors This JSON structure represents a typical error response from the API. It includes a detailed error message and a corresponding error code. ```json { "error": { "message": "Bad Request. Your request is either malformed, or is missing one or more required fields.", "code": 400 } } ``` -------------------------------- ### Cardmarket Card Information Source: https://docs.pokemontcg.io/api-reference/cards/card-object Retrieves Cardmarket pricing and purchase information for a specific Pokemon card. All prices are in EUR. ```APIDOC ## GET /api/v1/cards/{id}/cardmarket ### Description Fetches Cardmarket data for a given card, including pricing and purchase URLs. Prices are in EUR. ### Method GET ### Endpoint /api/v1/cards/{id}/cardmarket ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the card. ### Response #### Success Response (200) - **url** (string) - The URL to the Cardmarket store page. - **updatedAt** (string) - The date the price was last updated (YYYY/MM/DD). - **prices** (hash) - A hash containing various price types: - **averageSellPrice** (decimal) - Average sell price for non-foils. - **lowPrice** (decimal) - Lowest price for non-foils. - **trendPrice** (decimal) - Trend price for non-foils. - **germanProLow** (decimal) - Lowest price from German professional sellers. - **suggestedPrice** (decimal) - Suggested sell price. - **reverseHoloSell** (decimal) - Average sell price for reverse holos. - **reverseHoloLow** (decimal) - Lowest price for reverse holos (EX+ condition). - **reverseHoloTrend** (decimal) - Trend price for reverse holos. - **lowPriceExPlus** (decimal) - Lowest price for non-foils (EX+ condition). - **avg1** (decimal) - Average sale price over the last day. - **avg7** (decimal) - Average sale price over the last 7 days. - **avg30** (decimal) - Average sale price over the last 30 days. - **reverseHoloAvg1** (decimal) - Reverse holo average sale price over the last day. - **reverseHoloAvg7** (decimal) - Reverse holo average sale price over the last 7 days. - **reverseHoloAvg30** (decimal) - Reverse holo average sale price over the last 30 days. #### Response Example ```json { "url": "https://www.cardmarket.com/en/Pokemon/Cards/card-name", "updatedAt": "2023/10/27", "prices": { "averageSellPrice": 2.50, "lowPrice": 1.80, "trendPrice": 2.20, "germanProLow": 2.00, "suggestedPrice": 2.30, "reverseHoloSell": 8.00, "reverseHoloLow": 6.50, "reverseHoloTrend": 7.50, "lowPriceExPlus": 1.90, "avg1": 2.40, "avg7": 2.35, "avg30": 2.30, "reverseHoloAvg1": 7.80, "reverseHoloAvg7": 7.70, "reverseHoloAvg30": 7.60 } } ``` ``` -------------------------------- ### HTTP Status Code Summary Source: https://docs.pokemontcg.io/getting-started/errors The Pokémon TCG API uses conventional HTTP response codes to indicate the success or failure of an API request. Codes in the 200 range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted). Codes in the 5xx range indicate an error with the Pokémon TCG API servers. ```APIDOC ## HTTP Status Code Summary | Status Code | Description | |---|---| | **200 - OK** | Everything worked as expected. | | **400 - Bad Request** | The request was unacceptable, often due to an incorrect query string parameter. | | **402 - Request Failed** | The parameters were valid but the request failed. | | **403 - Forbidden** | The user doesn't have permissions to perform the request. | | **404 - Not Found** | The requested resource doesn't exist. | | **429 - Too Many Requests** | The rate limit has been exceeded. | | **500, 502, 503, 504 - Server Errors** | Something went wrong on our end. | ``` -------------------------------- ### Search Cards API Source: https://docs.pokemontcg.io/api-reference/cards/search-cards Allows searching for one or many cards based on various criteria. All query parameters are optional. ```APIDOC ## GET /v2/cards ### Description Search for one or many cards given a search query. ### Method GET ### Endpoint https://api.pokemontcg.io/v2/cards ### Parameters #### Query Parameters - **q** (string) - Optional - The search query. Examples can be found in the documentation. - **page** (integer) - Optional - The page of data to access. Defaults to 1. - **pageSize** (integer) - Optional - The maximum amount of cards to return. Defaults to 250 (max of 250). - **orderBy** (string) - Optional - The field(s) to order the results by. Examples can be found in the documentation. - **select** (string) - Optional - A comma delimited list of fields to return in the response (ex. ?select=id,name). By default, all fields are returned if this query parameter is not used. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **data** (array) - An array of card objects matching the search criteria. - **pageInfo** (object) - Information about the pagination of the results. #### Response Example { "data": [ { "id": "xy7-1", "name": "Venusaur", "supertype": "Stage 2", "subtypes": [ "Evolves into" ], "level": "52", "hp": "150", "types": [ "Grass" ], "evolvesFrom": "Ivysaur", "attacks": [ { "name": "Solar Beam", "cost": [ "Grass", "Grass", "Colorless" ], "convertedEnergyCost": 3, "damage": "70", "text": "" } ], "weaknesses": [ { "type": "Fire", "value": "×2" } ], "resistances": [ { "type": "Water", "value": "-20" } ], "retreatCost": [ "Colorless", "Colorless" ], "convertedRetreatCost": 2, "set": { "id": "xy7", "name": "Ancient Origins", "series": "XY", "printedTotal": 98, "total": 100, "releaseDate": "2015/08/12", "updatedAt": "2020/08/14 09:39:00" }, "number": "1", "artist": "Hajime Kusajima", "rarity": "Rare", "flavorText": "By shedding its seed on its back, it grows a plant that is used for battle.", "illustrationArtist": "Hajime Kusajima", "identifiers": { "sugimoriId": "jv003", "tradingCardNum": "xy7-1" }, "legalities": { "unlimited": "Legal", "expanded": "Legal" }, "images": { "small": "https://images.pokemontcg.io/xy7/1.png", "large": "https://images.pokemontcg.io/xy7/1_hires.png" } } ], "pageInfo": { "numCards": 1, "page": 1, "pageSize": 250, "totalCount": 1 } } ```