# npm
npm install trpc-postman
# yarn
yarn install trpc-postman
# pnpm
pnpm install trpc-postman
import { trpcToPostmanCollection } from "trpc-postman";
// generate Postman Collection JSON
const postmanCollection = trpcToPostmanCollection({
collectionName: "My API",
router: trpcRouter,
});
You can update your Postman Collection using your Postman API key and Collection ID
You can generate a Postman API key here.
If you don't already have a collection to publish to, create a collection manually.
Then, you can see your Collection ID by clicking the i
button on the right-hand side:
WARNING!! This will ERASE your entire collection with the generated Postman Collection.
import { trpcToPostmanCollection } from "trpc-postman";
// generate Postman Collection JSON
const postmanCollection = trpcToPostmanCollection({
collectionName: "My API",
router: trpcRouter,
});
// overwrite collection in postman
await updateRemotePostmanCollection({
apiKey: POSTMAN_API_KEY,
collectionId: YOUR_COLLECTION_ID,
collection: postmanCollection,
});