We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ce99436 commit f1c4cb8Copy full SHA for f1c4cb8
docs/advanced-features/preview-mode.md
@@ -203,6 +203,18 @@ You can pass an object to `setPreviewData` and have it be available in `getStati
203
204
The preview mode works on `getServerSideProps` as well. It will also be available on the `context` object containing `preview` and `previewData`.
205
206
+### Works with API Routes
207
+
208
+API Routes will have access to `preview` and `previewData` under the request object. For example:
209
210
+```js
211
+export default function myApiRoute(req, res) {
212
+ const isPreview = req.preview
213
+ const previewData = req.previewData
214
+ // ...
215
+}
216
+```
217
218
### Unique per `next build`
219
220
Both the bypass cookie value and the private key for encrypting the `previewData` change when `next build` is completed.
0 commit comments