|
| 1 | +openapi: 3.1.0 |
| 2 | +info: |
| 3 | + title: Fern Docs MCP API |
| 4 | + version: 1.0.0 |
| 5 | + description: API endpoints for MCP agents to authenticate and search Fern documentation sites. |
| 6 | + |
| 7 | +servers: |
| 8 | + - url: https://docs.example.com |
| 9 | + description: Your documentation domain |
| 10 | + |
| 11 | +paths: |
| 12 | + /api/fern-docs/get-jwt: |
| 13 | + get: |
| 14 | + summary: Exchange an API key for a JWT |
| 15 | + description: Exchange a Fern API key for a JWT token that can be used to access protected documentation endpoints. |
| 16 | + operationId: getJwt |
| 17 | + parameters: |
| 18 | + - name: FERN_API_KEY |
| 19 | + in: header |
| 20 | + required: true |
| 21 | + schema: |
| 22 | + type: string |
| 23 | + description: Your Fern API key |
| 24 | + - name: ROLES |
| 25 | + in: header |
| 26 | + required: false |
| 27 | + schema: |
| 28 | + type: string |
| 29 | + description: Comma-separated list of roles (e.g., "botanist,seedling") |
| 30 | + - name: x-fern-host |
| 31 | + in: header |
| 32 | + required: false |
| 33 | + schema: |
| 34 | + type: string |
| 35 | + description: Documentation domain (required on preview URLs) |
| 36 | + responses: |
| 37 | + '200': |
| 38 | + description: Successfully generated JWT |
| 39 | + content: |
| 40 | + application/json: |
| 41 | + schema: |
| 42 | + type: object |
| 43 | + properties: |
| 44 | + fern_token: |
| 45 | + type: string |
| 46 | + description: JWT token for authenticating subsequent requests |
| 47 | + roles: |
| 48 | + type: array |
| 49 | + items: |
| 50 | + type: string |
| 51 | + description: Roles included in the JWT |
| 52 | + '400': |
| 53 | + description: Bad request (local preview, self-hosted, or SSO environment) |
| 54 | + content: |
| 55 | + application/json: |
| 56 | + schema: |
| 57 | + type: object |
| 58 | + properties: |
| 59 | + error: |
| 60 | + type: string |
| 61 | + '401': |
| 62 | + description: Unauthorized (missing or invalid API key) |
| 63 | + content: |
| 64 | + application/json: |
| 65 | + schema: |
| 66 | + type: object |
| 67 | + properties: |
| 68 | + error: |
| 69 | + type: string |
| 70 | + '403': |
| 71 | + description: Forbidden (API key does not belong to organization) |
| 72 | + content: |
| 73 | + application/json: |
| 74 | + schema: |
| 75 | + type: object |
| 76 | + properties: |
| 77 | + error: |
| 78 | + type: string |
| 79 | + '500': |
| 80 | + description: Internal server error |
| 81 | + content: |
| 82 | + application/json: |
| 83 | + schema: |
| 84 | + type: object |
| 85 | + properties: |
| 86 | + error: |
| 87 | + type: string |
| 88 | + |
| 89 | + /api/fern-docs/search/v2/key: |
| 90 | + get: |
| 91 | + summary: Get search credentials |
| 92 | + description: Retrieve Algolia search credentials for querying documentation. Supports API key or JWT authentication. |
| 93 | + operationId: getSearchKey |
| 94 | + parameters: |
| 95 | + - name: FERN_API_KEY |
| 96 | + in: header |
| 97 | + required: false |
| 98 | + schema: |
| 99 | + type: string |
| 100 | + description: Your Fern API key (Option 1) |
| 101 | + - name: FERN_TOKEN |
| 102 | + in: header |
| 103 | + required: false |
| 104 | + schema: |
| 105 | + type: string |
| 106 | + description: JWT token from /api/fern-docs/get-jwt (Option 2) |
| 107 | + - name: ROLES |
| 108 | + in: header |
| 109 | + required: false |
| 110 | + schema: |
| 111 | + type: string |
| 112 | + description: Comma-separated list of roles (only with FERN_API_KEY) |
| 113 | + - name: X-User-Token |
| 114 | + in: header |
| 115 | + required: false |
| 116 | + schema: |
| 117 | + type: string |
| 118 | + description: Optional user identifier for analytics |
| 119 | + - name: x-fern-host |
| 120 | + in: header |
| 121 | + required: false |
| 122 | + schema: |
| 123 | + type: string |
| 124 | + description: Documentation domain (required on preview URLs) |
| 125 | + responses: |
| 126 | + '200': |
| 127 | + description: Successfully retrieved search credentials |
| 128 | + content: |
| 129 | + application/json: |
| 130 | + schema: |
| 131 | + type: object |
| 132 | + properties: |
| 133 | + appId: |
| 134 | + type: string |
| 135 | + description: Algolia application ID |
| 136 | + apiKey: |
| 137 | + type: string |
| 138 | + description: Short-lived Algolia search API key |
| 139 | + roles: |
| 140 | + type: array |
| 141 | + items: |
| 142 | + type: string |
| 143 | + description: Roles included in the search key (only with FERN_API_KEY auth) |
| 144 | + '400': |
| 145 | + description: Bad request (local preview or unsupported preview URL) |
| 146 | + '401': |
| 147 | + description: Unauthorized (invalid API key) |
| 148 | + '403': |
| 149 | + description: Forbidden (API key does not belong to organization) |
0 commit comments