You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: advanced/rest-api/overview.mdx
+13-14Lines changed: 13 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,29 +4,29 @@ title: Overview
4
4
5
5
## Trigger Updates
6
6
7
-
Leverage the REST API to programmatically trigger an update when desired.
8
-
The primary use-case will be to trigger updates. We will be adding more and more
9
-
functionality to the API overtime. Let us know what else you want to see in
7
+
You can use our REST API to automatically start updates whenever you need them.
8
+
The main purpose is to let you control when updates happen. We're working on adding more
9
+
features to the API over time. Have suggestions? Share them with us in
10
10
[our community](https://mintlify.com/community)!
11
11
12
12
## Authentication
13
13
14
-
You can generate an API key through
15
-
[the dashboard](https://dashboard.mintlify.com/settings/integrations). The API key is
16
-
associated with the entire org and can be used across multiple deployments.
14
+
To use the API, you'll need an API key. You can create one through
15
+
[the dashboard](https://dashboard.mintlify.com/settings/integrations). This key works for your whole organization and can be used across all your deployments.
17
16
18
17
<Frame>
19
18
<imgsrc="/images/external-api-key.png" />
20
19
</Frame>
21
20
22
21
## Discovery API
23
22
24
-
The Discovery API allows you to embed an AI chat experience grounded in your docs and continually kept up to date into any application of your choosing.
25
-
Responses include citations so you can point your users to the right places they need to get help.
23
+
The Discovery API helps you add AI-powered chat to your documentation. This chat feature understands your docs and stays current with any changes you make.
24
+
When the AI responds, it includes references to show users exactly where the information came from.
26
25
27
26
## Getting Started
28
27
29
-
To get started, you'll need to generate a Discovery API key in the [dashboard](https://dashboard.mintlify.com/products/chat/widget):
28
+
Follow these steps to begin:
29
+
1. First, create a Discovery API key in the [dashboard](https://dashboard.mintlify.com/products/chat/widget):
30
30
31
31
<Frame>
32
32
<img
@@ -36,10 +36,9 @@ To get started, you'll need to generate a Discovery API key in the [dashboard](h
36
36
</Frame>
37
37
38
38
<Note>
39
-
The Discovery API token is a public token that can be referenced in your
40
-
frontend code whereas the API key is a server-side token that should be kept
41
-
secret.
39
+
There are two types of keys:
40
+
- The Discovery API token is public and can be used in your website's code
41
+
- The API key is private and should be kept secure on your server
42
42
</Note>
43
43
44
-
Now that you have an API key, check out our [example](https://github.com/mintlify/discovery-api-example) for how to use
45
-
the API for AI chat. You can also see a deployed version of this example at [chat.mintlify.com](https://chat.mintlify.com).
44
+
Once you have your API key, you can see how to use it by checking out our [example code](https://github.com/mintlify/discovery-api-example). Want to see it in action? Visit [chat.mintlify.com](https://chat.mintlify.com) to try a live demo.
Copy file name to clipboardExpand all lines: advanced/subpath/cloudflare.mdx
+13-15Lines changed: 13 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,20 +5,20 @@ description: "Host documentation at a /docs subpath using Cloudflare Workers"
5
5
6
6
## Create Cloudflare Worker
7
7
8
-
Navigate to the `Workers & Pages > Create application > Create worker`. You
9
-
should be able to presented with the following screen where you can create a new
10
-
Cloudlfare worker.
8
+
To get started, go to `Workers & Pages > Create application > Create worker` in your Cloudflare dashboard. You'll see a screen where you can set up a new Cloudflare worker.
11
9
12
10
<Frame>
13
11
<imgalt="Create a Cloudflare worker"src="/images/cloudflare/worker.png" />
14
12
</Frame>
15
13
16
14
### Add custom domain
17
15
18
-
Once the worker is created, click `Configure worker`. Navigate to the worker
19
-
`Settings > Triggers`. Click on `Add Custom Domain` to add your desired domain
20
-
into the list - we recommend you add both the version with and without `www.`
21
-
prepended to the domain.
16
+
After creating your worker, follow these steps:
17
+
1. Click `Configure worker`
18
+
2. Go to `Settings > Triggers`
19
+
3. Click `Add Custom Domain`
20
+
4. Add your domain to the list
21
+
- We suggest adding two versions: one with `www.` and one without it
22
22
23
23
<Frame>
24
24
<img
@@ -27,21 +27,20 @@ prepended to the domain.
27
27
/>
28
28
</Frame>
29
29
30
-
If you have trouble setting up a custom subdirectory,
31
-
[contact our support team](mailto:[email protected]) and we'll walk you through
32
-
upgrading your hosting with us.
30
+
Need help setting up your custom subdirectory? [Contact our support team](mailto:[email protected]) and we'll help you upgrade your hosting.
33
31
34
32
### Edit Worker Script
35
33
36
-
Click on `Edit Code` and add the following script into the worker's code.
34
+
Now you'll need to add some code to your worker. Click on `Edit Code` and copy the script below into the code editor.
Copy file name to clipboardExpand all lines: api-playground/openapi/advanced-features.mdx
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,25 @@
1
1
---
2
2
title: "Advanced Features"
3
-
description: "Support for advanced OpenAPI features"
3
+
description: "Learn how to use powerful OpenAPI features"
4
4
---
5
5
6
-
OpenAPI 3 has some advanced features for describing complex APIs. Here's how you can use them with Mintlify.
6
+
OpenAPI 3 offers several advanced ways to describe complex APIs. Let's explore how to use these features with Mintlify.
7
7
8
8
## `oneOf`, `anyOf`, `allOf`
9
9
10
-
For complex datatypes, OpenAPI provides the `oneOf`, `anyOf`, and `allOf`keywords, allowing you to combine schemas in certain ways. You can read more about these keywords in the [Swagger documentation](https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/), but essentially:
10
+
OpenAPI provides three special keywords to help you work with complex data types: `oneOf`, `anyOf`, and `allOf`. These keywords let you combine different data structures. Here's what each one does:
11
11
12
-
-`oneOf` functions like an "exclusive-or" operator
13
-
-`anyOf` functions like an "or" operator
14
-
-`allOf` functions like an "and" operator
12
+
-`oneOf`: Means "pick exactly one option from the list"
13
+
-`anyOf`: Means "pick one or more options from the list"
14
+
-`allOf`: Means "include everything from all options"
15
15
16
-
<Warning>Mintlify treats the`oneOf` and `anyOf`keywords the same. We have found that, when people use `oneOf`, they often *mean*`anyOf` - and there is often no meaningful difference to the user.</Warning>
16
+
<Warning>In Mintlify, we handle`oneOf` and `anyOf` the same way. We've found that most developers use these terms interchangeably, and the difference rarely matters to users.</Warning>
17
17
18
-
<Info>Mintlify currently does not support the `not` keyword.</Info>
18
+
<Info>Note: Mintlify doesn't support the `not` keyword at this time.</Info>
19
19
20
-
### Combining schemas with `allOf`
20
+
### Using `allOf` to Combine Data Structures
21
21
22
-
Mintlify performs some preprocessing on your OpenAPI document to display these complex combinations in a readable way. For example, when you combine two object schemas with `allOf`, Mintlify combines the properties of both into a single object. This becomes especially useful when leveraging [OpenAPI's reusable `components`](https://swagger.io/docs/specification/components/).
22
+
Mintlify makes it easy to read combined data structures. For example, when you join two objects with `allOf`, we show all their properties together in one place. This is especially helpful when you're using [reusable components in OpenAPI](https://swagger.io/docs/specification/components/).
23
23
24
24
```yaml
25
25
org_with_users:
@@ -52,9 +52,9 @@ components:
52
52
</Expandable>
53
53
</ParamField>
54
54
55
-
### Providing options with `oneOf` and `anyOf`
55
+
### Offering Choices with `oneOf` and `anyOf`
56
56
57
-
When you use `oneOf` or `anyOf`, Mintlify displays the options in a tabbed container. To give your options helpful names, make sure to give each subschema a `title` field. For example, here's how you might display two different types of delivery addresses:
57
+
When you use `oneOf` or `anyOf`, Mintlify shows the options in tabs. To make these tabs easy to understand, give each option a clear title. Here's an example showing two different ways to write a delivery address:
58
58
59
59
```yaml
60
60
delivery_address:
@@ -94,21 +94,21 @@ delivery_address:
94
94
95
95
## `x-codeSamples`
96
96
97
-
If your users interact with your API using an SDK rather than directly through a network request, you can add code samples to your OpenAPI document, and Mintlify will display them in your OpenAPI pages. You can define your code samples using the `x-codeSamples` extension. This property can be added within any request method, and has the following schema:
97
+
If your users work with your API through an SDK instead of direct API calls, you can add example code to your documentation. Use the `x-codeSamples` feature to add these examples. You can add this to any API endpoint, and it needs:
98
98
99
99
<ParamField body="lang" type="string" required>
100
-
The language of the code sample.
100
+
The programming language used in the example
101
101
</ParamField>
102
102
103
103
<ParamField body="label" type="string">
104
-
The label for the sample. This is useful when providing multiple examples for a single endpoint.
104
+
A name for the example (helpful when you have multiple examples)
105
105
</ParamField>
106
106
107
107
<ParamField body="source" type="string" required>
108
-
The source code of the sample.
108
+
The actual code for the example
109
109
</ParamField>
110
110
111
-
Here's an example of some code samples for a plant tracking app, which has both a Bash CLI tool and a JavaScript SDK.
111
+
Here's an example from a plant tracking app that has both a command-line tool and a JavaScript SDK:
description: "Reference OpenAPI endpoints in your docs pages"
3
+
description: "Learn how to add API documentation to your pages"
4
4
---
5
5
6
-
## Add an OpenAPI specification file
6
+
## Add an OpenAPI File
7
7
8
-
To describe your endpoints with OpenAPI, make sure you have a valid OpenAPI
9
-
document in either JSON or YAML format that follows the
10
-
[OpenAPI specification](https://swagger.io/specification/). Your document must
11
-
follow OpenAPI specification 3.0+.
8
+
To document your API endpoints, you'll need a valid OpenAPI file in either JSON or YAML format. This file needs to follow the [OpenAPI 3.0+ specification](https://swagger.io/specification/).
12
9
13
-
## Auto-populate API pages
10
+
## Quick Setup: Auto-generate API Pages
14
11
15
-
The fastest way to get started with OpenAPI is to add an `openapi` field to a tab or anchor in the `mint.json`. This field can contain either the path to an OpenAPI document in your docs repo, or the URL of a hosted OpenAPI document. Mintlify will automatically generate a page for each OpenAPI operation and place them in the tab/anchor.
12
+
The easiest way to get started is to add an `openapi` field to your `mint.json` file. You can either:
13
+
- Point to an OpenAPI file in your docs folder
14
+
- Link to an OpenAPI file hosted online
16
15
17
-
**Example with Anchors:**
16
+
Mintlify will then create pages for each API endpoint automatically.
17
+
18
+
**Setting up with Anchors:**
18
19
19
20
```json {5}
20
21
{
@@ -31,7 +32,7 @@ The fastest way to get started with OpenAPI is to add an `openapi` field to a ta
31
32
32
33

33
34
34
-
**Example with Tabs:**
35
+
**Setting up with Tabs:**
35
36
36
37
```json {6}
37
38
{
@@ -47,66 +48,54 @@ The fastest way to get started with OpenAPI is to add an `openapi` field to a ta
47
48
48
49

49
50
50
-
<Tip>To validate your OpenAPI spec, you can use this command: <br/>`mintlify openapi-check <openapiFilenameOrUrl>`</Tip>
51
-
52
-
53
-
When using this option, the metadata for the generated pages will have the following default values:
54
-
55
-
*`title`: The `summary` field from the OpenAPI operation, if present. Otherwise a title generated from the HTTP method and endpoint.
51
+
<Tip>Check if your OpenAPI file is valid with this command: <br/>`mintlify openapi-check <yourFile>`</Tip>
56
52
57
-
*`description`: The `description` field from the OpenAPI operation, if present.
53
+
When you use this auto-generate option, your pages will have these default settings:
54
+
* The page title will use the OpenAPI operation's `summary` field, or create one from the endpoint details
55
+
* The description will come from the OpenAPI operation's `description` field
56
+
* The version will match what's in your anchor or tab settings
58
57
59
-
*`version`: The `version` value from the anchor or tab, if present.
58
+
Need more control? You can create custom pages for each API endpoint using MDX files.
60
59
61
-
There are some scenarios in which the default behavior isn't sufficient. If you need more customizability, you can create an MDX page for your OpenAPI operation, and modify it just like any other MDX page.
60
+
## Custom API Pages with MDX
62
61
63
-
## Create MDX files for API pages
62
+
Sometimes you might want to:
63
+
- Change how the page information appears
64
+
- Add extra content
65
+
- Skip certain API endpoints
66
+
- Change the order of pages
64
67
65
-
If you want to customize the page metadata, add additional content, omit certain OpenAPI operations, or reorder OpenAPI pages in your navigation, you'll need an MDX page for each operation. Here is [an example MDX OpenAPI page](https://github.com/elevenlabs/elevenlabs-docs/blob/e5e267c97b8d1e4c21db1dcdb8b005eb1dfed7da/api-reference/speech-to-speech.mdx?plain=1#L2) from [Elevenlabs](https://elevenlabs.io/docs/api-reference/speech-to-speech). 
68
+
In these cases, you'll need to create MDX files for your API endpoints. Here's [an example from Elevenlabs](https://github.com/elevenlabs/elevenlabs-docs/blob/e5e267c97b8d1e4c21db1dcdb8b005eb1dfed7da/api-reference/speech-to-speech.mdx?plain=1#L2).
For large OpenAPI documents, creating one MDX page for each OpenAPI operation can be a lot of work. To make it easier, we created a local OpenAPI page scraper.
autogenerates MDX files for your OpenAPI endpoints. Use the relative path to the
75
-
OpenAPI document in your codebase.
74
+
If you have many API endpoints, creating MDX files by hand can take a long time. Our Mintlify [scraper tool](https://www.npmjs.com/package/@mintlify/scraping) can create these files for you:
Learn more about our scraping package [here](https://www.npmjs.com/package/@mintlify/scraping).
89
-
90
-
The scraper will output an array of
91
-
[Navigation entries](/settings/global#structure) containing your OpenAPI MDX
92
-
files. You can either append these entries to your existing Navigation, or
93
-
reorder and add the files to your navigation manually.
94
-
95
86
<Note>
96
-
If your OpenAPI document is invalid, the files will not autogenerate.
87
+
Your OpenAPI file must be valid for this to work.
97
88
</Note>
98
89
99
-
### Manually specify files
90
+
### Create MDX Files by Hand
100
91
101
-
You can always create an MDX page manually, and reference the OpenAPI operation in the page's metadata using the `openapi` field.
92
+
You can also create MDX pages manually. Just add an `openapi` field in the page's settings to link it to your API endpoint.
102
93
103
94
<Snippetfile="api-playground/openapi.mdx" />
104
95
105
-
By using the OpenAPI reference, the name, description, parameters, responses,
106
-
and the API playground will be automatically generated from the OpenAPI document.
96
+
This will automatically add the endpoint's details and an interactive API playground to your page.
107
97
108
-
If you have multiple OpenAPI files, include the path to the OpenAPI file to ensure Mintlify finds the correct OpenAPI document. This is not required if you have
109
-
only one OpenAPI file - it will automatically detect your OpenAPI file.
98
+
If you have multiple OpenAPI files, include the file path to help Mintlify find the right one:
110
99
111
100
<CodeGroup>
112
101
```md Example
@@ -118,7 +107,7 @@ only one OpenAPI file - it will automatically detect your OpenAPI file.
118
107
119
108
```md Format
120
109
---
121
-
title: "title of the page"
110
+
title: "page title"
122
111
openapi: openapi-file-path method path
123
112
---
124
113
```
@@ -127,15 +116,12 @@ only one OpenAPI file - it will automatically detect your OpenAPI file.
127
116
<br />
128
117
129
118
<Note>
130
-
The method and path must match the method and path specified in the OpenAPI
131
-
document exactly. If the endpoint doesn't exist in the OpenAPI file,
132
-
the page will be empty.
119
+
Make sure the method and path match exactly what's in your OpenAPI file.
133
120
</Note>
134
121
135
-
## Create MDX files for OpenAPI schemas
122
+
## Pages for API Data Types
136
123
137
-
Mintlify also allows you to create individual pages for any OpenAPI schema
138
-
defined in an OpenAPI document's `components.schemas` field:
124
+
You can also create pages that explain the data types (schemas) defined in your OpenAPI file:
139
125
140
126
<CodeGroup>
141
127
```md Example
@@ -146,7 +132,7 @@ defined in an OpenAPI document's `components.schemas` field:
0 commit comments