> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notte.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Session Cookies Set



## OpenAPI

````yaml https://api.notte.cc/openapi.json post /sessions/{session_id}/cookies
openapi: 3.1.0
info:
  title: Notte API
  description: >-
    Notte API is a REST API that allows you to interact with Notte. It is used
    to create cloud browser sessions, scrape webpages, and run web ai agents to
    act on your behalf on the internet.
  version: 1.4.40
  x-logo:
    url: https://www.notte.cc/images/logo/logo-white.png
servers: []
security: []
tags:
  - name: agents
    description: Web AI agents (start, stop, status, replay, etc.)
  - name: sessions
    description: Session management (start, stop, status, etc.)
  - name: debug
    description: Session debugging tools (replay,logs, recording, etc.)
  - name: page
    description: Page operations withing a session (observe, step, scrape, etc.)
  - name: storage
    description: File storage interface (upload, download, list, etc.)
  - name: network
    description: Network requests/responses withing a session (intercept, etc.)
  - name: vaults
    description: >-
      Vault & Credentials management (create/delete vaults, create/delete
      credentials, etc.)
  - name: personas
    description: Persona management (create, delete, list emails, list sms, etc.)
  - name: scrape
    description: >-
      Webpage scraping (scrape, screenshot, etc.) with automatic session
      management.
  - name: health
    description: Health check endpoint.
  - name: usage
    description: Usage logs (usage, logs, etc.)
  - name: functions
    description: Functions management (create, delete, list, etc.)
paths:
  /sessions/{session_id}/cookies:
    post:
      tags:
        - sessions
      summary: Session Cookies Set
      operationId: session_cookies_set
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
        - name: update_metadata
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Update Metadata
        - name: x-notte-request-origin
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Notte-Request-Origin
        - name: x-notte-sdk-version
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Notte-Sdk-Version
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Body_session_cookies_set_sessions__session_id__cookies_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
      x-codeSamples:
        - lang: Python
          source: |-
            import json
            from notte_sdk import NotteClient

            notte = NotteClient()
            # load the cookies from json and inject them in the session
            with open("cookies.json", "r") as f:
                cookies = json.load(f)

            with notte.Session() as session:
                cookies = session.set_cookies(cookies)
          label: python
        - lang: JavaScript
          source: |-
            import { NotteClient } from "notte-sdk";
            import { readFileSync } from "fs";

            const notte = new NotteClient();
            // load the cookies from json and inject them in the session
            const cookies = JSON.parse(readFileSync("cookies.json", "utf-8"));

            await notte.Session().use(async (session) => {
              await session.setCookies(cookies);
            });
          label: node
        - lang: Curl
          source: |-
            curl -X POST "https://api.notte.cc/sessions/$session_id/cookies" \
            -H "Authorization: Bearer $NOTTE_API_KEY" \
            -H "Content-Type: application/json" \
            -d '{
            "cookies": [
            {
            "name": "name",
            "value": "value",
            "domain": ".googl.com",
            "path": "/",
            "httpOnly": false,
            "hostOnly": null,
            "sameSite": "Lax",
            "secure": true,
            "session": null,
            "storeId": null,
            "expires": -1
            }
            ]
            }'
          label: curl
components:
  schemas:
    Body_session_cookies_set_sessions__session_id__cookies_post:
      properties:
        cookies:
          items:
            $ref: '#/components/schemas/Cookie'
          type: array
          title: Cookies
      type: object
      required:
        - cookies
      title: Body_session_cookies_set_sessions__session_id__cookies_post
    ExecutionResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Whether the operation was successful
        message:
          type: string
          title: Message
          description: A message describing the operation
      type: object
      required:
        - success
        - message
      title: ExecutionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Cookie:
      properties:
        name:
          type: string
          title: Name
        value:
          type: string
          title: Value
        domain:
          type: string
          title: Domain
        path:
          type: string
          title: Path
        httpOnly:
          type: boolean
          title: Httponly
        expirationDate:
          anyOf:
            - type: number
            - type: 'null'
          title: Expirationdate
        hostOnly:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Hostonly
        sameSite:
          anyOf:
            - type: string
              enum:
                - Lax
                - None
                - Strict
            - type: 'null'
          title: Samesite
        secure:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Secure
        session:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Session
        storeId:
          anyOf:
            - type: string
            - type: 'null'
          title: Storeid
        expires:
          anyOf:
            - type: number
            - type: 'null'
          title: Expires
        partitionKey:
          anyOf:
            - type: string
            - type: 'null'
          title: Partitionkey
      type: object
      required:
        - name
        - value
        - domain
        - path
        - httpOnly
      title: Cookie
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: token

````