---
title: "Discussion on \"How to set a cookie using NextJS 13 API routes\" | Hashnode"
description: "Discussion on \"How to set a cookie using NextJS 13 API routes\". It seems that there is a correct sequence for creating a Response object with a set-cookie header and a JSON body in Next.js 13.\nI'm not sure if this is limited to the beta app directory version and typescript.\nProblem: typescript is confused?\nIf you..."
url: "https://hashnode.com/posts/how-to-set-a-cookie-using-nextjs-13-api-routes/6430d3654e5c7c16c485fec8"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to set a cookie using NextJS 13 API routes](https://codethenporrada.xyz/how-to-set-a-cookie-using-nextjs-13-api-routes?utm_source=hashnode&utm_medium=feed)

It seems that there is a correct sequence for creating a Response object with a set-cookie header and a JSON body in Next.js 13. I'm not sure if this is limited to the beta app directory version and typescript. Problem: typescript is confused? If you...

Apr 8, 2023 · 1 min read · codethenporrada.xyz  
Updated Oct 9, 2023  
Read the article

-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#next-dev](https://hashnode.com/tag/next-dev)
-   [#cookies](https://hashnode.com/tag/cookies)
-   [#frontend-development](https://hashnode.com/tag/frontend-development)

## Written by

[dahlia](https://hashnode.com/@dahliasan)

@dahliasan

  
[View profile](https://hashnode.com/@dahliasan)

Learning to code and training jiu jitsu. Sometimes researching seals.

A generalist specialised in marine predator foraging ecology. Currently learning solidity and how to become a better writer. Code by day, train jiu jitsu by night.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
