1.22.24 • Published 1 day ago

@scalar/api-reference v1.22.24

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

Scalar API Reference

Version Downloads Hits on jsdelivr License Discord

Generate interactive API documentations from Swagger files. Try our Demo

Screenshot of an API Reference

Installation

npm install @scalar/api-reference

Usage

<script setup>
import { ApiReference } from '@scalar/api-reference'
</script>

<template>
  <ApiReference />
</template>

You can even mount the component in React.

Configuration

There’s a configuration object that can be used on all platforms. In Vue.js, you use it like this:

isEditable?: boolean

Whether the Swagger editor should be shown.

<ApiReference :configuration="{ isEditable: true }" />

spec.content?: string

Directly pass an OpenAPI/Swagger spec.

<ApiReference :configuration="{ spec: { content: '{ … }' } }" />

spec.url?: string

Pass the URL of a spec file (JSON or Yaml).

<ApiReference :configuration="{ spec: { url: '/openapi.json' } }" />

proxyUrl?: string

Making requests to other domains is restricted in the browser and requires CORS headers. It’s recommended to use a proxy to send requests to other origins.

<ApiReference :configuration="{ proxy: 'https://proxy.example.com' }" />

ℹ️ You can use @scalar/api-client-proxy to host your own proxy or you can just use ours:

<ApiReference
  :configuration="{ proxy: 'https://api.scalar.com/request-proxy' }" />

showSidebar?: boolean

Whether the sidebar should be shown.

<ApiReference :configuration="{ showSidebar: true } />

hideModels?: boolean

Whether models (components.schemas or definitions) should be shown in the sidebar, search and content.

@default false

<ApiReference :configuration="{ hideModels: true } />

hideDownloadButton?: boolean

Whether to show the "Download OpenAPI Specification" button

@default false

<ApiReference :configuration="{ hideDownloadButton: true } />

customCss?: string

You can pass custom CSS directly to the component. This is helpful for the integrations for Fastify, Express, Hono and others where you it’s easier to add CSS to the configuration.

In Vue or React you’d probably use other ways to add custom CSS.

<script setup>
const customCss = `* { font-family: "Comic Sans MS", cursive, sans-serif; }`
</script>

<template>
  <ApiReference :configuration="{ customCss }" />
</template>

searchHotKey?: string

Key used with CTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k)

<ApiReference :configuration="{ searchHotKey: 'l'} />

metaData?: object

You can pass information to the config object to configure meta information out of the box.

<ApiReference :configuration="{
  metaData: {
        title: 'Page title',
        description: 'My page page',
        ogDescription: 'Still about my my page',
        ogTitle: 'Page title',
        ogImage: 'https://example.com/image.png',
        twitterCard: 'summary_large_image',
        //Add more...
      }
  } />

hiddenClients?: array

You can pass an array of httpsnippet clients to hide from the clients menu.

<ApiReference :configuration="{
  hiddenClients: ['fetch']
  } />

By default hides Unirest, pass [] to show all clients

onSpecUpdate?: (spec: string) => void

You can listen to spec changes with onSpecUpdate that runs on spec/swagger content change

<ApiReference :configuration="{
    onSpecUpdate: (value: string) => {
      console.log('Content updated:', value)
    }
  } />

authentication?: Partial

To make authentication easier you can prefill the credentials for your users:

<ApiReference :configuration="{
  authentication: {
      // The OpenAPI file has keys for all security schemes:
      // Which one should be used by default?
      preferredSecurityScheme: 'my_custom_security_scheme',
      // The `my_custom_security_scheme` security scheme is of type `apiKey`, so prefill the token:
      apiKey: {
        token: 'super-secret-token',
      },
    },
  } />
```

For OpenAuth2 it’s more looking like this:

```js
<ApiReference :configuration="{
  authentication: {
      // The OpenAPI file has keys for all security schemes
      // Which one should be used by default?
      preferredSecurityScheme: 'planets_auth',
      // The `petstore_auth` security scheme is of type `oAuth2`, so prefill the client id and the scopes:
      oAuth2: {
        clientId: 'foobar123',
        // optional:
        scopes: ['read:planets', 'write:planets'],
      },
    },
  } />
```

#### withDefaultFonts?: boolean

By default we’re using Inter and JetBrains Mono, served by Google Fonts. If you use a different font or just don’t want to use Google Fonts, pass `withDefaultFonts: false` to the configuration.

```js
<ApiReference :configuration="{
  withDefaultFonts: false
} />
```
1.22.24

1 day ago

1.22.20

6 days ago

1.22.19

7 days ago

1.22.18

7 days ago

1.22.17

8 days ago

1.22.16

9 days ago

1.22.15

9 days ago

1.22.14

11 days ago

1.22.13

12 days ago

1.22.12

13 days ago

1.22.11

13 days ago

1.22.10

14 days ago

1.22.7

15 days ago

1.22.8

15 days ago

1.22.9

15 days ago

1.22.4

16 days ago

1.22.5

16 days ago

1.22.6

16 days ago

1.22.0

20 days ago

1.22.3

19 days ago

1.22.1

19 days ago

1.22.2

19 days ago

1.21.1

23 days ago

1.21.2

22 days ago

1.20.32

25 days ago

1.20.30

26 days ago

1.20.31

26 days ago

1.20.27

30 days ago

1.20.28

29 days ago

1.20.29

29 days ago

1.20.26

1 month ago

1.20.25

1 month ago

1.20.21

1 month ago

1.20.22

1 month ago

1.20.23

1 month ago

1.20.24

1 month ago

1.20.16

1 month ago

1.20.17

1 month ago

1.20.18

1 month ago

1.20.15

1 month ago

1.20.20

1 month ago

1.20.14

1 month ago

1.20.13

1 month ago

1.20.12

1 month ago

1.20.11

1 month ago

1.20.10

1 month ago

1.20.9

2 months ago

1.20.8

2 months ago

1.20.7

2 months ago

1.20.2

2 months ago

1.20.5

2 months ago

1.20.3

2 months ago

1.20.4

2 months ago

1.20.1

2 months ago

1.20.0

2 months ago

1.19.7

2 months ago

1.19.6

2 months ago

1.19.4

2 months ago

1.19.5

2 months ago

1.19.3

2 months ago

1.19.2

2 months ago

1.19.1

2 months ago

1.18.7

2 months ago

1.18.6

2 months ago

1.18.4

2 months ago

1.18.3

2 months ago

1.18.2

2 months ago

1.18.1

2 months ago

1.18.0

2 months ago

1.17.16

2 months ago

1.17.15

2 months ago

1.17.14

2 months ago

1.17.13

2 months ago

1.17.12

2 months ago

1.17.11

2 months ago

1.17.10

2 months ago

1.17.9

2 months ago

1.17.8

2 months ago

1.17.7

2 months ago

1.17.2

3 months ago

1.17.1

3 months ago

1.17.4

2 months ago

1.17.3

3 months ago

1.17.0

3 months ago

1.16.3

3 months ago

1.16.2

3 months ago

1.16.1

3 months ago

1.16.0

3 months ago

1.15.6

3 months ago

1.15.4

3 months ago

1.15.3

3 months ago

1.15.2

3 months ago

1.15.5

3 months ago

1.15.0

3 months ago

1.15.1

3 months ago

1.14.10

3 months ago

1.14.9

3 months ago

1.14.8

3 months ago

1.14.7

3 months ago

1.14.6

3 months ago

1.14.5

3 months ago

1.14.1

3 months ago

1.14.4

3 months ago

1.14.3

3 months ago

1.14.0

3 months ago

1.13.19

3 months ago

1.13.17

3 months ago

1.13.18

3 months ago

1.13.15

3 months ago

1.13.13

4 months ago

1.13.14

4 months ago

1.13.12

4 months ago

1.13.11

4 months ago

1.13.10

4 months ago

1.13.9

4 months ago

1.13.6

4 months ago

1.13.7

4 months ago

1.13.2

4 months ago

1.13.1

4 months ago

1.13.5

4 months ago

1.13.4

4 months ago

1.13.3

4 months ago

1.13.0

4 months ago

1.12.9

4 months ago

1.12.8

4 months ago

1.12.7

5 months ago

1.12.6

5 months ago

1.12.5

5 months ago

1.12.3

5 months ago

1.12.2

5 months ago

1.12.4

5 months ago

1.12.1

5 months ago

1.12.0

5 months ago

1.11.1

5 months ago

1.10.3-alpha

5 months ago

1.11.0

5 months ago

1.10.4-alpha

5 months ago

1.10.2

5 months ago

1.10.1

5 months ago

1.9.2

5 months ago

1.9.1

5 months ago

1.9.0

5 months ago

1.8.0

5 months ago

1.7.1

5 months ago

1.7.0

5 months ago

1.6.1

5 months ago

1.5.0

5 months ago

1.4.0

5 months ago

1.3.0

5 months ago

1.2.7

5 months ago

1.2.6

5 months ago

1.2.5

6 months ago

1.2.4

6 months ago

1.2.3

6 months ago

1.2.2

6 months ago

1.2.1

6 months ago

1.2.0

6 months ago

1.1.7

6 months ago

1.1.6

6 months ago

1.1.5

6 months ago

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago

0.8.10

6 months ago

0.8.9

6 months ago

0.8.8

6 months ago

0.8.7

6 months ago

0.8.6

6 months ago

0.8.5

7 months ago

0.8.4

7 months ago

0.8.3

7 months ago

0.8.2

7 months ago

0.8.1

7 months ago

0.8.0

7 months ago

0.7.11

7 months ago

0.7.10

7 months ago

0.7.9

7 months ago

0.7.8

7 months ago

0.7.7

7 months ago

0.7.6

7 months ago

0.7.5

7 months ago

0.7.4

7 months ago

0.7.3

7 months ago

0.7.2

7 months ago

0.7.1

7 months ago

0.7.0

7 months ago

0.6.23

7 months ago

0.6.22

7 months ago

0.6.21

7 months ago

0.6.20

7 months ago

0.6.19

7 months ago

0.6.18

7 months ago

0.6.17

7 months ago

0.6.16

7 months ago

0.6.15

7 months ago

0.6.14

7 months ago

0.6.13

7 months ago

0.6.12

7 months ago

0.6.11

7 months ago

0.6.8

7 months ago

0.6.7

7 months ago

0.6.6

7 months ago

0.6.5

7 months ago

0.6.4

7 months ago

0.6.3

7 months ago

0.6.2

7 months ago

0.6.1

8 months ago

0.6.0

8 months ago

0.5.6

8 months ago

0.5.5

8 months ago

0.5.4

8 months ago

0.5.3

8 months ago

0.5.2

8 months ago

0.5.1

8 months ago

0.5.0

8 months ago

0.4.0

8 months ago

0.3.4

8 months ago

0.3.3

8 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.1.31

8 months ago

0.1.30

8 months ago

0.1.29

8 months ago

0.1.28

8 months ago

0.1.27

9 months ago

0.1.26

9 months ago

0.1.25

9 months ago

0.1.24

9 months ago

0.1.23

9 months ago

0.1.22

9 months ago

0.1.21

9 months ago

0.1.20

9 months ago

0.1.19

9 months ago

0.1.18

9 months ago

0.1.17

9 months ago

0.1.16

9 months ago

0.1.15

9 months ago

0.1.14

9 months ago

0.1.13

9 months ago

0.1.12

9 months ago

0.1.11

9 months ago

0.1.10

9 months ago

0.1.9

9 months ago

0.1.8

9 months ago

0.1.7

9 months ago

0.1.6

9 months ago

0.1.5

9 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago