Skip to main content
Glama

download_icon_by_id

Retrieve and download a specific icon by its unique ID, selecting desired format and size. Supports formats like SVG, PNG, and more, with adjustable PNG sizes for tailored usage.

Instructions

Download the specified icon by its unique ID in the requested format and size.

Path Parameters:

  • id (Required): Icon resource ID

Query Parameters:

  • format: These are the formats available for download

  • Note: gif, mp4, aep, json, psd and eps are not available for standard and sticker icon types.

  • png_size: These are the sizes available for png_url formats.

  • Note: Only apply to format png.

Responses:

  • 200 (Success): OK

    • Content-Type: application/json

    • Response Properties:

    • Example:

{ "data": { "filename": "filename", "url": "https://openapi-generator.tech" } }
  • 400: Bad Request - The server could not understand the request due to invalid syntax.

    • Content-Type: application/json

    • Response Properties:

    • Example:

{ "message": "message" }
  • 401: Unauthorized - The client must authenticate itself to get the requested response.

    • Content-Type: application/json

    • Response Properties:

    • Example:

{ "message": "message" }
  • 403: Forbidden - The client does not have permission to access the requested resource.

    • Content-Type: application/json

    • Response Properties:

    • Example:

{ "message": "message" }
  • 404: Not Found - The server can not find the requested resource.

    • Content-Type: application/json

    • Response Properties:

    • Example:

{ "message": "message" }
  • 429: Too Many Requests - The client has sent too many requests in a given amount of time.

    • Content-Type: application/json

    • Response Properties:

    • Example:

{ "message": "message" }
  • 500: Internal Server Error - The server has encountered a situation it doesn't know how to handle.

    • Content-Type: application/json

    • Response Properties:

    • Example:

{ "message": "Internal Server Error" }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
Accept-LanguageNoSpecifies the search query language using the ISO 639-1 (2-letter language code) and the ISO 3166-1 (2-letter country code) for language variants. The API will use "en-US" as a default language for processing if a code is not provided, or does not exist.
formatNoThese are the formats available for download - Note: gif, mp4, aep, json, psd and eps are not available for standard and sticker icon types.
idYesIcon resource ID
png_sizeNoThese are the sizes available for png_url formats. - Note: Only apply to format png.

Implementation Reference

  • Registers all /v1/icon.* endpoints as MCPType.TOOL, enabling icon search and download tools including download_icon_by_id from Freepik API.
    # Icons API - Full access RouteMap( methods=[ "GET", "POST", ], pattern=r"/v1/icon.*", mcp_type=MCPType.TOOL, ),
  • Instantiates FastMCP server from OpenAPI specification with route maps that include icon tools, generating OpenAPITool instances for endpoints like download_icon_by_id.
    server = FastMCP.from_openapi( openapi_spec=openapi_spec, client=http_client, name=server_config.name, route_maps=route_maps, mcp_component_fn=mcp_component_fn, )
  • Factory method to create httpx.AsyncClient configured with Freepik API base URL and key, used by OpenAPITools to execute icon download requests.
    @staticmethod def create_api_client(config: ApiConfig) -> httpx.AsyncClient: """ Create an HTTP client configured for the Freepik API. Args: config: API configuration containing base URL, API key, and timeout. Returns: Configured HTTP client for Freepik API. """ return httpx.AsyncClient( base_url=config.base_url, headers={"x-freepik-api-key": config.api_key}, timeout=config.timeout, )
  • Loads the Freepik OpenAPI spec which defines the schema and paths for icon tools including download by ID.
    cached_spec = self._load_from_cache() if cached_spec is not None: return cached_spec return self._download_and_cache_spec()
  • Dynamic client creation for per-request API calls, supporting updated credentials without restart.
    def create_dynamic_client() -> httpx.AsyncClient: """ Create an HTTP client with fresh configuration from environment. This method reads the current environment configuration each time it's called, allowing for dynamic API key updates without server restart. Returns: Configured HTTP client with current environment settings. """ config = ApiConfig.from_environment() return httpx.AsyncClient( base_url=config.base_url, headers={"x-freepik-api-key": config.api_key}, timeout=config.timeout, )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/freepik-company/freepik-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server