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

# End a play session

> `ended`: the game closed or the player stopped it. `exited`: Patch, or the page, closed while it ran. `crashed`: the game or its launch failed, with what was seen in `detail`. The first end stands; a session whose heartbeats stop ends by itself as `timed_out`.



## OpenAPI

````yaml /api-reference/openapi.json post /me/play-sessions/{id}/end
openapi: 3.1.0
info:
  title: Patch API
  version: 1.0.0
  description: >-
    The public API behind patch.gg, the desktop app and pch. Changes within v1
    are additive only. Errors are { error: { code, message, details } }; branch
    on code.
servers:
  - url: https://patch.gg/api/v1
security: []
paths:
  /me/play-sessions/{id}/end:
    post:
      tags:
        - Play
      summary: End a play session
      description: >-
        `ended`: the game closed or the player stopped it. `exited`: Patch, or
        the page, closed while it ran. `crashed`: the game or its launch failed,
        with what was seen in `detail`. The first end stands; a session whose
        heartbeats stop ends by itself as `timed_out`.
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                end:
                  type: string
                  enum:
                    - ended
                    - exited
                    - crashed
                detail:
                  type: string
                  maxLength: 500
              required:
                - end
      responses:
        '200':
          description: Ended
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlaySession'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Not signed in
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearer: []
components:
  schemas:
    PlaySession:
      type: object
      properties:
        id:
          type: string
          format: uuid
        project:
          type: string
          example: mira/lantern-run
        version:
          type: string
        client:
          type: string
          example: desktop
        started_at:
          type: string
        last_seen_at:
          type: string
        ended_at:
          type:
            - string
            - 'null'
        end:
          type:
            - string
            - 'null'
          enum:
            - ended
            - exited
            - crashed
            - timed_out
            - null
        heartbeat_s:
          type: integer
          description: Send a heartbeat this often
      required:
        - id
        - project
        - version
        - client
        - started_at
        - last_seen_at
        - ended_at
        - end
        - heartbeat_s
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: version_exists
            message:
              type: string
            details: {}
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: An API key (pch_...) or the token from pch login.

````

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