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

# Create or refresh chat share link

> Creates a share link for the chat, or refreshes it when the chat already has one. A refresh takes a new snapshot of the conversation, applies the requested `scope`, and switches the link back on if it was off. The share ID and URL stay the same.

A share link shows the conversation as it was when it was created or last refreshed. Call this endpoint again to bring it up to date.

The API key acts as its user: the chat must be in the key's workspace and that user must have access to it. Any user with access may manage the chat's share link, whoever created it. Keys created before June 2025 have no user and are refused with 403.

With `scope` set to `public`, anyone with the link can open it without signing in. They can read the conversation, including tool inputs, tool outputs and reasoning, and download the files the chat produced.




## OpenAPI

````yaml POST /chats/{chatId}/share
openapi: 3.1.0
info:
  title: TeamAI API
  version: '1.0'
  description: >
    REST API for TeamAI. Run agents and chat completions, and manage projects,
    files, and skills programmatically.
servers:
  - url: https://app.teamai.com/api/v1
security:
  - apiKey: []
tags:
  - name: Chat
  - name: Agents
  - name: Projects
  - name: Skills
paths:
  /chats/{chatId}/share:
    post:
      tags:
        - Chat
      summary: Create or refresh chat share link
      description: >
        Creates a share link for the chat, or refreshes it when the chat already
        has one. A refresh takes a new snapshot of the conversation, applies the
        requested `scope`, and switches the link back on if it was off. The
        share ID and URL stay the same.


        A share link shows the conversation as it was when it was created or
        last refreshed. Call this endpoint again to bring it up to date.


        The API key acts as its user: the chat must be in the key's workspace
        and that user must have access to it. Any user with access may manage
        the chat's share link, whoever created it. Keys created before June 2025
        have no user and are refused with 403.


        With `scope` set to `public`, anyone with the link can open it without
        signing in. They can read the conversation, including tool inputs, tool
        outputs and reasoning, and download the files the chat produced.
      parameters:
        - $ref: '#/components/parameters/chatId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - scope
              properties:
                scope:
                  type: string
                  enum:
                    - workspace
                    - organization
                    - public
                  description: >
                    Who can open the link. `workspace`: signed-in members of the
                    chat's workspace. `organization`: signed-in members of any
                    workspace in its organization. `public`: anyone with the
                    link.
      responses:
        '200':
          description: The created or refreshed share link.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ChatShare'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/NotAuthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    chatId:
      name: chatId
      in: path
      required: true
      schema:
        type: string
      description: >
        Chat ID. Must be a chat in the API key's workspace that the key's user
        can access. Organization API keys are bound to the organization's own
        workspace, so chats in its member workspaces return 404; use a workspace
        key.
  schemas:
    ChatShare:
      type: object
      properties:
        id:
          type: string
          description: Share ID.
        title:
          type: string
        shareUrl:
          type: string
          format: uri
          description: Link to give to the people who should open the chat.
        isActive:
          type: boolean
          description: >
            Whether the link currently opens. An inactive link shows "not found"
            until it is switched back on in the app.
        viewCount:
          type: integer
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        scope:
          type: string
          enum:
            - workspace
            - organization
            - public
    Error:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable error code.
          example: bad_request
        message:
          type: string
          description: Human-readable error description.
        details:
          type: object
          additionalProperties: true
          description: Additional error context.
  responses:
    BadRequest:
      description: Request body or parameters failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotAuthenticated:
      description: >
        API key missing or invalid (`not_authenticated`), or valid but not
        permitted to access this resource (`unauthorized`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >
        The API key is not tied to a user, so it cannot perform this action. Use
        a key created by a user.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Requested resource does not exist or is not visible to this key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: >
        Another request is creating this chat's share link right now. Retry the
        request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-teamai-api-key
      description: >
        Secret API key created in Workspace Settings → API Keys (workspace keys)
        or Organization Admin → API Keys (organization keys).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.