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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.kosli.com/feedback

```json
{
  "path": "/api-reference/snapshots/get-snapshot",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Get snapshot

> Get a snapshot for an environment.

`snapshot_expression` can be specified as follows:
- `N`: the Nth snapshot, counting from 1. Negative values count from the latest snapshot i.e. -1 is the latest snapshot.
    example: 42
- `~N`: the Nth snapshot behind the latest, at the time of the request
    example: ~5
- `@{YYYY-MM-DDTHH:MM:SS}`: the snapshot at specific moment in time in UTC
    example: @{2023-10-02T12:00:00}
- `@{N.<hours|days|weeks|months>.ago}`: the snapshot at a time relative to the time of the request. N is a positive integer.
    example: @{2.hours.ago}
- `@{now}`: the snapshot at the time of the request
    example: @{now}



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json get /snapshots/{org}/{env_name}/{snapshot_expression}
openapi: 3.1.0
info:
  title: Kosli API
  summary: The API for communicating with Kosli
  description: >

    # Authentication 


    When making requests against Kosli API, you can authenticate your requests
    using a bearer token. 

    Set the bearer token in the request Authorization header to a valid API
    key. 

    API Keys can be personal or for service accounts. Check the [service
    accounts
    documentation](https://docs.kosli.com/getting_started/service-accounts/) for
    details. 


    ## Curl example


    ```shell

    curl -H "Authorization: Bearer <<your-api-key>>"
    https://app.kosli.com/api/v2/environments/<<your-org-name>>

    ```
  version: '2.0'
servers:
  - url: https://app.kosli.com/api/v2
    description: EU
  - url: https://app.us.kosli.com/api/v2
    description: US
security:
  - HTTPBearer: []
paths:
  /snapshots/{org}/{env_name}/{snapshot_expression}:
    get:
      tags:
        - Snapshots
      summary: Get snapshot
      description: >-
        Get a snapshot for an environment.


        `snapshot_expression` can be specified as follows:

        - `N`: the Nth snapshot, counting from 1. Negative values count from the
        latest snapshot i.e. -1 is the latest snapshot.
            example: 42
        - `~N`: the Nth snapshot behind the latest, at the time of the request
            example: ~5
        - `@{YYYY-MM-DDTHH:MM:SS}`: the snapshot at specific moment in time in
        UTC
            example: @{2023-10-02T12:00:00}
        - `@{N.<hours|days|weeks|months>.ago}`: the snapshot at a time relative
        to the time of the request. N is a positive integer.
            example: @{2.hours.ago}
        - `@{now}`: the snapshot at the time of the request
            example: @{now}
      operationId: get_snapshot_snapshots__org___env_name___snapshot_expression__get
      parameters:
        - name: env_name
          in: path
          required: true
          schema:
            type: string
            title: Env Name
        - name: snapshot_expression
          in: path
          required: true
          schema:
            type: string
            title: Snapshot Expression
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSnapshotResponse'
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    GetSnapshotResponse:
      properties:
        index:
          type: integer
          title: Index
          description: The index of the snapshot
        is_latest:
          type: boolean
          title: Is Latest
          description: True if this snapshot is the most recent
        next_snapshot_timestamp:
          anyOf:
            - type: number
            - type: 'null'
          title: Next Snapshot Timestamp
          description: The creation timestamp of the next snapshot if one exists
        artifact_compliance_count:
          additionalProperties:
            type: integer
          type: object
          title: Artifact Compliance Count
          description: The number of compliant and non-compliant artifacts in the snapshot
        timestamp:
          type: number
          title: Timestamp
          description: The timestamp of the snapshot creation
        type:
          type: string
          title: Type
          description: The type of the environment
        compliant:
          type: boolean
          title: Compliant
          description: Whether the snapshot is compliant
        html_url:
          type: string
          title: Html Url
          description: The HTML URL to the snapshot
        artifacts:
          items:
            $ref: '#/components/schemas/SnapshotArtifact'
          type: array
          title: Artifacts
          description: The list of artifacts in the snapshot
        applied_policies:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Applied Policies
          description: The list of policies applied to this snapshot
      type: object
      required:
        - index
        - is_latest
        - artifact_compliance_count
        - timestamp
        - type
        - compliant
        - html_url
        - artifacts
        - applied_policies
      title: GetSnapshotResponse
    SnapshotArtifact:
      additionalProperties: true
      type: object
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````