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

# Find segments

> Find start and end times for all non-noise events in a sample. If you have multiple datastreams and OptionalDatastreamIndexParameter is not passed in, the first datastream is used.



## OpenAPI

````yaml /.assets/openapi.yaml post /api/{projectId}/raw-data/{sampleId}/find-segments
openapi: 3.0.0
info:
  title: Edge Impulse API
  version: 1.0.0
servers:
  - url: https://studio.edgeimpulse.com/v1
security:
  - ApiKeyAuthentication: []
  - JWTAuthentication: []
  - JWTHttpHeaderAuthentication: []
  - OAuth2: []
paths:
  /api/{projectId}/raw-data/{sampleId}/find-segments:
    post:
      tags:
        - Raw data
      summary: Find segments
      description: >-
        Find start and end times for all non-noise events in a sample. If you
        have multiple datastreams and OptionalDatastreamIndexParameter is not
        passed in, the first datastream is used.
      operationId: findSegmentsInSample
      parameters:
        - $ref: '#/components/parameters/ProjectIdParameter'
        - $ref: '#/components/parameters/SampleIdParameter'
        - $ref: '#/components/parameters/OptionalDatastreamIndexParameter'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FindSegmentSampleRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FindSegmentSampleResponse'
components:
  parameters:
    ProjectIdParameter:
      name: projectId
      in: path
      required: true
      description: Project ID
      schema:
        type: integer
    SampleIdParameter:
      name: sampleId
      in: path
      required: true
      description: Sample ID
      schema:
        type: integer
    OptionalDatastreamIndexParameter:
      name: datastreamIndex
      in: query
      required: false
      description: Datastream index (defaults to 0)
      schema:
        type: integer
  schemas:
    FindSegmentSampleRequest:
      type: object
      required:
        - shiftSegments
        - segmentLengthMs
      properties:
        shiftSegments:
          type: boolean
          description: >-
            If set, the segments are automatically shifted randomly, to make the
            dataset distribution more uniform.
        segmentLengthMs:
          type: integer
    FindSegmentSampleResponse:
      allOf:
        - $ref: '#/components/schemas/GenericApiResponse'
        - type: object
          required:
            - segments
          properties:
            segments:
              type: array
              items:
                type: object
                required:
                  - startMs
                  - endMs
                properties:
                  startMs:
                    type: integer
                  endMs:
                    type: integer
    GenericApiResponse:
      type: object
      required:
        - success
      properties:
        success:
          type: boolean
          description: Whether the operation succeeded
        error:
          type: string
          description: Optional error description (set if 'success' was false)
  securitySchemes:
    ApiKeyAuthentication:
      type: apiKey
      in: header
      name: x-api-key
    JWTAuthentication:
      type: apiKey
      in: cookie
      name: jwt
    JWTHttpHeaderAuthentication:
      type: apiKey
      in: header
      name: x-jwt-token
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: /v1/oauth/authorize
          tokenUrl: /v1/oauth/token
          scopes:
            openid: Access to basic profile information
            email: Access to email address
            profile: Access to full profile information
        implicit:
          authorizationUrl: /v1/oauth/authorize
          scopes:
            openid: Access to basic profile information
            email: Access to email address
            profile: Access to full profile information
        password:
          tokenUrl: /v1/oauth/token
          scopes:
            openid: Access to basic profile information
            email: Access to email address
            profile: Access to full profile information
        clientCredentials:
          tokenUrl: /v1/oauth/token
          scopes:
            openid: Access to basic profile information
            email: Access to email address
            profile: Access to full profile information

````