Skip to content

Commit 8ab34de

Browse files
Documentation edits made through Mintlify web editor
1 parent 048eaaa commit 8ab34de

File tree

16 files changed

+362
-1270
lines changed

16 files changed

+362
-1270
lines changed

advanced/subpath/cloudflare.mdx

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,20 @@ title: "Cloudflare"
33
description: "Host documentation at a /docs subpath using Cloudflare Workers"
44
---
55

6-
## Create Cloudflare Worker
6+
## Setup Guide
77

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+
1. Create a Worker
9+
- Go to `Workers & Pages > Create application > Create worker`
10+
- Create a new worker from the dashboard
1111

1212
<Frame>
1313
<img alt="Create a Cloudflare worker" src="/images/cloudflare/worker.png" />
1414
</Frame>
1515

16-
### Add custom domain
17-
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+
2. Configure Domain
17+
- Go to `Configure worker > Settings > Triggers`
18+
- Add your domain via `Add Custom Domain`
19+
- Add both `domain.com` and `www.domain.com` versions
2220

2321
<Frame>
2422
<img
@@ -27,23 +25,16 @@ prepended to the domain.
2725
/>
2826
</Frame>
2927

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.
33-
34-
### Edit Worker Script
35-
36-
Click on `Edit Code` and add the following script into the worker's code.
28+
3. Deploy Code
29+
- Click `Edit Code`
30+
- Paste the worker script below
31+
- Replace `[SUBDOMAIN]` and `[YOUR_DOMAIN]` with your values
32+
- Click `Deploy`
3733

3834
<Frame>
3935
<img alt="Cloudflare edit code" src="/images/cloudflare/edit-code.png" />
4036
</Frame>
4137

42-
<Tip>
43-
Edit `DOCS_URL` by replacing `[SUBDOMAIN]` with your unique subdomain and
44-
`CUSTOM_URL` with your website's base URL.
45-
</Tip>
46-
4738
```javascript
4839
addEventListener("fetch", (event) => {
4940
event.respondWith(handleRequest(event.request));
@@ -76,5 +67,4 @@ async function handleRequest(request) {
7667
}
7768
```
7869

79-
Click on `Deploy` and wait for the changes to propagate (it can take up to a few
80-
hours).
70+
Changes may take a few hours to propagate. Need help? [Contact support](mailto:[email protected]).
Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
---
22
title: 'MDX Setup'
3-
description: 'Generate docs pages for your API endpoints using MDX'
3+
description: 'Configure API endpoints with MDX'
44
---
55

6-
Mintlify allows you to define your API endpoints using a combination of `mint.json` configuration, MDX metadata fields, and the `<ParamFields />` component. From the defined endpoints, we generate an API playground, request examples, and response examples.
6+
Set up your API documentation using `mint.json` configuration and MDX files. This generates an interactive API playground with request/response examples.
77

88
<Steps>
9-
<Step title="Configure your API">
10-
In your `mint.json` file, define your base URL and auth method:
9+
<Step title="Set up mint.json">
10+
Add your API configuration to `mint.json`:
1111

1212
```json
1313
{
1414
"api": {
15-
"baseUrl": "https://mintlify.com/api", // string array for multiple base URLs
15+
"baseUrl": "https://mintlify.com/api",
1616
"auth": {
17-
"method": "bearer" // options: bearer, basic, key.
17+
"method": "bearer" // Available: bearer, basic, key
1818
}
1919
}
2020
}
2121
```
2222

23-
If you would not like to show an API playground, you don't need to include auth types. Hide the playground with the following field:
24-
23+
To hide the API playground, use:
2524
```json
2625
{
2726
"api": {
@@ -32,12 +31,11 @@ Mintlify allows you to define your API endpoints using a combination of `mint.js
3231
}
3332
```
3433

35-
Find a full list of API configurations [here](/settings/global#api-configurations).
34+
See all API options in our [configuration guide](/settings/global#api-configurations).
3635
</Step>
3736

38-
<Step title="Create your endpoint pages">
39-
40-
Each API endpoint page should have a corresponding MDX file. At the top of each file, define:
37+
<Step title="Create endpoint pages">
38+
For each endpoint, create an MDX file with:
4139

4240
```md
4341
---
@@ -46,20 +44,17 @@ Mintlify allows you to define your API endpoints using a combination of `mint.js
4644
---
4745
```
4846

49-
You can specify path parameters by adding the parameter name to the path, wrapped with `{}`:
50-
47+
For path parameters, use `{}`:
5148
```bash
5249
https://api.example.com/v1/endpoint/{userId}
5350
```
5451

5552
<Note>
56-
57-
If you have `baseUrl` configured in [mint.json](/settings/global), you can use relative paths like `/v1/endpoint`.
58-
53+
With `baseUrl` configured, you can use relative paths like `/v1/endpoint`
5954
</Note>
6055
</Step>
6156

62-
<Step title="Add your endpoints to your docs">
63-
Add your endpoint pages to the sidebar by adding the paths to the `navigation` field in your `mint.json`. Learn more about structuring your docs [here](/settings/navigation).
57+
<Step title="Add to navigation">
58+
Add your endpoint pages to the `navigation` field in `mint.json`. [Learn more](/settings/navigation)
6459
</Step>
65-
</Steps>
60+
</Steps>

api-playground/openapi/setup.mdx

Lines changed: 25 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -3,150 +3,49 @@ title: "OpenAPI Setup"
33
description: "Reference OpenAPI endpoints in your docs pages"
44
---
55

6-
## Add an OpenAPI specification file
6+
## Quick Setup
77

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+
1. Have a valid OpenAPI 3.0+ spec file (JSON or YAML)
9+
2. Add the `openapi` field to your `mint.json`:
1210

13-
## Auto-populate API pages
14-
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.
16-
17-
**Example with Anchors:**
18-
19-
```json {5}
11+
```json
2012
{
2113
"anchors": [
2214
{
2315
"name": "API Reference",
24-
"openapi": "/path/to/openapi.json",
25-
"url": "api-reference",
26-
"icon": "square-terminal"
16+
"openapi": "/path/to/openapi.json", // Local file path or URL
17+
"url": "api-reference"
2718
}
2819
]
2920
}
3021
```
3122

32-
![](/images/anchors-autogeneration-anchors.png)
33-
34-
**Example with Tabs:**
35-
36-
```json {6}
37-
{
38-
"tabs": [
39-
{
40-
"name": "API Reference",
41-
"url": "api-reference",
42-
"openapi": "https://petstore3.swagger.io/api/v3/openapi.json"
43-
}
44-
]
45-
}
46-
```
47-
48-
![](/images/autogeneration-with-tabs.png)
49-
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.
56-
57-
* `description`: The `description` field from the OpenAPI operation, if present.
58-
59-
* `version`: The `version` value from the anchor or tab, if present.
60-
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.
62-
63-
## Create MDX files for API pages
64-
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).&#x20;
66-
67-
![](/images/elevenlabs-mdx-autogeneration-example.png)
23+
That's it! Mintlify will auto-generate API pages for each endpoint.
6824

69-
### Autogenerate files
25+
<Tip>Validate your spec with: `mintlify openapi-check <openapiFilenameOrUrl>`</Tip>
7026

71-
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.
27+
## Custom API Pages
7228

73-
Our Mintlify [scraper](https://www.npmjs.com/package/@mintlify/scraping)
74-
autogenerates MDX files for your OpenAPI endpoints. Use the relative path to the
75-
OpenAPI document in your codebase.
76-
77-
```bash
78-
npx @mintlify/scraping@latest openapi-file <path-to-openapi-file>
79-
```
80-
81-
Add the `-o` flag to specify a folder to populate the files into. If a folder is
82-
not specified, the files will populate in the working directory.
29+
Need more control? Create custom MDX pages for your endpoints:
8330

31+
1. Auto-generate MDX files:
8432
```bash
8533
npx @mintlify/scraping@latest openapi-file <path-to-openapi-file> -o api-reference
8634
```
8735

88-
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-
<Note>
96-
If your OpenAPI document is invalid, the files will not autogenerate.
97-
</Note>
98-
99-
### Manually specify files
100-
101-
You can always create an MDX page manually, and reference the OpenAPI operation in the page's metadata using the `openapi` field.
102-
103-
<Snippet file="api-playground/openapi.mdx" />
104-
105-
By using the OpenAPI reference, the name, description, parameters, responses,
106-
and the API playground will be automatically generated from the OpenAPI document.
107-
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.
110-
111-
<CodeGroup>
112-
```md Example
113-
---
114-
title: "Get users"
115-
openapi: "/path/to/openapi-1.json GET /users"
116-
---
117-
```
118-
119-
```md Format
120-
---
121-
title: "title of the page"
122-
openapi: openapi-file-path method path
123-
---
124-
```
125-
</CodeGroup>
126-
127-
<br />
128-
129-
<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.
133-
</Note>
134-
135-
## Create MDX files for OpenAPI schemas
136-
137-
Mintlify also allows you to create individual pages for any OpenAPI schema
138-
defined in an OpenAPI document's `components.schemas` field:
36+
2. Or create them manually:
37+
```md
38+
---
39+
title: "Get users"
40+
openapi: "/path/to/openapi.json GET /users"
41+
---
42+
```
13943

140-
<CodeGroup>
141-
```md Example
142-
---
143-
openapi-schema: OrderItem
144-
---
145-
```
44+
## Schema Pages
14645

147-
```md Format
148-
---
149-
openapi-schema: "schema-key"
150-
---
151-
```
152-
</CodeGroup>
46+
Create pages for OpenAPI schemas:
47+
```md
48+
---
49+
openapi-schema: SchemaName
50+
---
51+
```

api-playground/openapi/writing-openapi.mdx

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,29 @@ description: "Use OpenAPI features to enhance your Mintlify docs"
55

66
## Describing your API
77

8-
There are many great tools online for learning about and constructing OpenAPI documents. Here are our favorites:
9-
- [Swagger's OpenAPI Guide](https://swagger.io/docs/specification/about/) for familiarizing yourself with the OpenAPI syntax
10-
- [OpenAPI v3.1.0 Specification](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md) for all the details about the newest OpenAPI specification
11-
- [Swagger & OpenAPI Validator](https://apitools.dev/swagger-parser/online/) for debugging your OpenAPI document
12-
- [Swagger's Editor](https://editor.swagger.io/) for seeing examples in action
8+
Need help writing OpenAPI docs? Here are essential resources:
9+
- [Swagger's OpenAPI Guide](https://swagger.io/docs/specification/about/) - Learn OpenAPI syntax
10+
- [OpenAPI v3.1.0 Spec](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md) - Official documentation
11+
- [Validator](https://apitools.dev/swagger-parser/online/) - Debug your OpenAPI docs
12+
- [Swagger Editor](https://editor.swagger.io/) - See live examples
1313

1414
<Note>
15-
Swagger's OpenAPI Guide is for OpenAPI v3.0, but nearly all of the information is applicable to v3.1. For more information on the differences between v3.0 and v3.1, check out [OpenAPI's blog post](https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0).
15+
Most examples use OpenAPI v3.0, but they work with v3.1. See the key differences [here](https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0).
1616
</Note>
1717

18-
## Specifying the URL for your API
18+
## Base URLs
1919

20-
In an OpenAPI document, different API endpoints are specified by their paths, like `/users/{id}`, or maybe simply `/`. To specify the base URL to which these paths should be appended, OpenAPI provides the `servers` field. This field is necessary to use some Mintlify features like the API Playground. Read how to configure the `servers` field in the [Swagger documentation](https://swagger.io/docs/specification/api-host-and-base-path/).
20+
Set your API's base URL using the `servers` field. This enables features like the API Playground. Multiple servers will show as a dropdown in the playground. Without a server URL, the playground runs in simple mode.
2121

22-
The API Playground will use these server URLs to determine where to send requests. If multiple servers are specified, a dropdown will appear to allow toggling between servers. If no server is supplied, the API Playground will use simple mode, as there is no way to send a request.
22+
Need different URLs for specific endpoints? You can override the server URL at the path or operation level.
2323

24-
If different endpoints within your API exist at different URLs, you can [override the server field](https://swagger.io/docs/specification/api-host-and-base-path/#:~:text=%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%20%2D%20southeastasia-,Overriding%20Servers,-The%20global%20servers) for a given path or operation.
24+
## Authentication
2525

26-
## Specifying authentication
26+
Configure API authentication using `securitySchemes` and `security` fields. OpenAPI supports:
27+
- Basic auth
28+
- Bearer tokens
29+
- API keys
2730

28-
Nearly all APIs require some method of authentication. OpenAPI provides the `securitySchemes` field for defining the methods of authentication used throughout your API, with simple configuration for the most common authentication types - [Basic](https://swagger.io/docs/specification/authentication/basic-authentication/), [Bearer](https://swagger.io/docs/specification/authentication/bearer-authentication/), and [API Keys](https://swagger.io/docs/specification/authentication/api-keys/). To apply these authentication methods to your endpoints, OpenAPI uses the `security` field. The syntax for defining and applying authentication is a bit unintuitive, so definitely check out [Swagger's documentation and examples](https://swagger.io/docs/specification/authentication/) on the topic.
31+
The API Playground automatically adds auth fields based on your security config. You can set different auth methods for specific endpoints by overriding the security field at the operation level.
2932

30-
The API descriptions and API Playground will add authentication fields based on the security configurations in your OpenAPI document.
31-
32-
If different endpoints within your API require different methods of authentication, you can [override the security field](https://swagger.io/docs/specification/authentication/#:~:text=you%20can%20apply%20them%20to%20the%20whole%20API%20or%20individual%20operations%20by%20adding%20the%20security%20section%20on%20the%20root%20level%20or%20operation%20level%2C%20respectively.) for a given operation.
33+
Check out [Swagger's auth docs](https://swagger.io/docs/specification/authentication/) for examples.

integrations/analytics/amplitude.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
title: "Amplitude"
33
---
44

5-
Add the following to your `mint.json` file to send analytics to Amplitude.
5+
To track user analytics with Amplitude:
6+
7+
1. Add your Amplitude API key to `mint.json`:
68

79
<CodeGroup>
810

@@ -14,7 +16,7 @@ Add the following to your `mint.json` file to send analytics to Amplitude.
1416
}
1517
```
1618

17-
```json Example
19+
```json Example with API key
1820
"analytics": {
1921
"amplitude": {
2022
"apiKey": "76bb138bf3fbf58186XXX00000"
@@ -23,3 +25,5 @@ Add the following to your `mint.json` file to send analytics to Amplitude.
2325
```
2426

2527
</CodeGroup>
28+
29+
That's it! Your docs will now send page views to Amplitude.

0 commit comments

Comments
 (0)