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

# Evaluate test

> Evaluates a monitoring test for a custom time range. Supports scheduled and manual-only tests. Can target specific pipelines and skip/overwrite existing results.



## OpenAPI

````yaml post /tests/{testId}/evaluate
openapi: 3.0.3
info:
  contact:
    email: support@openlayer.com
    name: Openlayer
    url: https://openlayer.com/
  description: API for interacting with the Openlayer server.
  title: Openlayer API
  version: '1.0'
  x-logo:
    url: https://logo.clearbit.com/openlayer.com
servers:
  - url: https://api.openlayer.com/v1
    description: Our prod backend
security:
  - bearerAuth: []
paths:
  /tests/{testId}/evaluate:
    post:
      tags:
        - Monitoring
      summary: Trigger test evaluation for custom timestamp range
      description: >
        Triggers one-off evaluation of a specific monitoring test for a custom
        timestamp range.

        This allows evaluating tests for historical data or custom time periods
        outside

        the regular evaluation window schedule. It also allows overwriting the
        existing test results.
      parameters:
        - $ref: '#/components/parameters/testId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - startTimestamp
                - endTimestamp
              properties:
                startTimestamp:
                  type: integer
                  format: int64
                  description: Start timestamp in seconds (Unix epoch)
                  example: 1699920000
                endTimestamp:
                  type: integer
                  format: int64
                  description: End timestamp in seconds (Unix epoch)
                  example: 1700006400
                inferencePipelineId:
                  type: string
                  format: uuid
                  description: >-
                    ID of the inference pipeline to evaluate. If not provided,
                    all inference pipelines the test applies to will be
                    evaluated.
                  example: 123e4567-e89b-12d3-a456-426614174000
                overwriteResults:
                  type: boolean
                  description: Whether to overwrite existing test results
                  example: false
                  default: false
      responses:
        '202':
          description: >-
            Evaluation task queued successfully. Timestamps will be aligned to
            evaluation window boundaries during execution.
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - pipelineCount
                  - requestedStartTimestamp
                  - requestedEndTimestamp
                  - tasks
                properties:
                  message:
                    type: string
                    example: Evaluation task queued successfully
                  pipelineCount:
                    type: integer
                    description: >-
                      Number of inference pipelines the test was queued for
                      evaluation on
                    example: 2
                  requestedStartTimestamp:
                    type: integer
                    format: int64
                    description: The start timestamp you requested (in seconds)
                    example: 1699920000
                  requestedEndTimestamp:
                    type: integer
                    format: int64
                    description: The end timestamp you requested (in seconds)
                    example: 1700006400
                  tasks:
                    type: array
                    description: >-
                      Array of background task information for each pipeline
                      evaluation
                    items:
                      type: object
                      required:
                        - taskResultUrl
                        - taskResultId
                        - pipelineId
                      properties:
                        taskResultUrl:
                          type: string
                          description: URL to check the status of this background task
                        taskResultId:
                          type: string
                          format: uuid
                          description: ID of the background task
                        pipelineId:
                          type: string
                          format: uuid
                          description: ID of the inference pipeline this task is for
        default:
          $ref: '#/components/responses/UnexpectedError'
      security:
        - bearerAuth: []
        - apiKey: []
      x-codeSamples:
        - lang: python
          source: |
            import os

            from openlayer import Openlayer

            client = Openlayer(
                api_key=os.environ.get("OPENLAYER_API_KEY"),  # This is the default and can be omitted
            )
            response = client.tests.evaluate(
                test_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                end_timestamp=1700006400,
                start_timestamp=1699920000,
            )
            print(response.message)
        - lang: typescript
          source: >
            import Openlayer from 'openlayer';


            const client = new Openlayer({
              apiKey: process.env['OPENLAYER_API_KEY'], // This is the default and can be omitted
            });

            const response = await
            client.tests.evaluate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
              endTimestamp: 1700006400,
              startTimestamp: 1699920000,
            });

            console.log(response.message);
        - lang: go
          source: |
            package main

            import (
              "context"
              "fmt"
              "github.com/openlayer-ai/openlayer-go"
              "github.com/openlayer-ai/openlayer-go/option"
            )

            func main() {
              client := openlayer.NewClient(
                option.WithAPIKey("My API Key"),
              )
              response, err := client.Tests.Evaluate(
                context.TODO(),
                "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                openlayer.TestEvaluateParams{
                  EndTimestamp: openlayer.F(int64(1700006400)),
                  StartTimestamp: openlayer.F(int64(1699920000)),
                },
              )
              if err != nil {
                panic(err.Error())
              }
              fmt.Printf("%+v\n", response.Message)
            }
        - lang: java
          source: |
            import com.openlayer.api.client.OpenlayerClient;
            import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient;
            import com.openlayer.api.models.tests.TestEvaluateParams;
            import com.openlayer.api.models.tests.TestEvaluateResponse;

            OpenlayerClient client = OpenlayerOkHttpClient.fromEnv();

            TestEvaluateParams params = TestEvaluateParams.builder()
                .testId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
                .endTimestamp(1700006400L)
                .startTimestamp(1699920000L)
                .build();
            TestEvaluateResponse response = client.tests().evaluate(params);
        - lang: curl
          source: |
            curl --request POST \
              --url https://api.openlayer.com/v1/tests/{testId}/evaluate \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --data '{
                "startTimestamp": 1699920000,
                "endTimestamp": 1700006400
              }'
components:
  parameters:
    testId:
      name: testId
      in: path
      description: The test id.
      required: true
      schema:
        type: string
        format: uuid
  responses:
    UnexpectedError:
      description: Unexpected error.
      content:
        application/json:
          schema:
            type: object
            required:
              - code
              - error
            properties:
              code:
                type: integer
                format: int32
              error:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your workspace API key. See [Find your API
        key](https://www.openlayer.com/docs/workspace-and-projects/find-your-api-key)
        for more information.

````