API Reference

beta

The API reference is a detailed documentation of all the endpoints available in the API.

Introduction

SVGL API is a RESTFul API that allows you to get all the information of the SVGs that are in the repository.

Limitations

The API is currently open to everyone and does not require any authentication. However, to prevent abusive use of the API, there is a limit to the number of requests.

Base URL

The base URL for the API is:

https://svgl.app/api/svgs
# or
https://svgl.app/api/categories

Typescript usage

  • For categories:
export interface Category {
  category: string;
  total: number;
}
  • For SVGs:
type ThemeOptions = {
  light: string;
  dark: string;
};

export interface iSVG {
  id: number;
  title: string;
  category: string | string[];
  route: string | ThemeOptions;
  wordmark?: string | ThemeOptions;
  url: string;
}

Endpoints

GET

Get all SVGs

Returns all the SVGs in the repository.

/api/svgs

// Returns:
[
  {
    "id": 0,
    "title": "Discord",
    "category": "Software",
    "route": "https://svgl.app/library/discord.svg",
    "url": "https://discord.com/"
  },
  ...
]

GET

Get a limited number of SVGs

Returns a limited number of SVGs in the repository. Start from the first SVG.

/api/svgs?limit=10

// Returns:
[
  {
    "id": 0,
    "title": "Discord",
    "category": "Software",
    "route": "https://svgl.app/library/discord.svg",
    "url": "https://discord.com/"
  },
  ...
]

GET

Filter SVGs by category

Returns all the SVGs in the repository that match the category.

/api/svgs?category=software

// Returns:
[
  {
    "id": 0,
    "title": "Discord",
    "category": "Software",
    "route": "https://svgl.app/library/discord.svg",
    "url": "https://discord.com/"
  },
  ...
]

The list of categories is available here (except for the all category).

GET

Get only categories

Returns only categories with the number of SVGs in each category.

/api/categories

// Returns:
[
  {
    "category": "Software",
    "total": 97
  },
  {
    "category": "Library",
    "total": 25
  },
  ...
]

GET

Search SVGs by name

Returns all the SVGs in the repository that match the name.

/api/svgs?search=axiom

// Returns:
[
  {
    "id": 267,
    "title": "Axiom",
    "category": "Software",
    "route": {
      "light": "https://svgl.app/library/axiom-light.svg",
      "dark": "https://svgl.app/library/axiom-dark.svg"
    },
    "url": "https://axiom.co/"
  }
]