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

# Create clip

> CreateClip

 Creates a new clip from the provided input. The clip will be
 available for downloading once the process is complete.

 The clip will be stored in the project's storage and the length
 of the clip will be determined by the `trim_in` and `trim_out` fields.
 The length of the clip cannot be neither longer than the source nor
 longer than 2 minutes.

 The request happens asynchronously and the response will contain
 the clip's ID. The client can use the ID to query the clip's status
 by calling the GetClip method.



## OpenAPI

````yaml post /streaming/clips/v1
openapi: 3.0.3
info:
  title: Studio API - Motto
  version: 0.0.0
servers:
  - url: https://api.mottostreaming.com
    description: Production server
security:
  - BearerAuth: []
tags:
  - name: AccountService
    description: Account management service
  - name: ActionConfigurationService
    description: Action configuration service definition
  - name: ActionSecretService
    description: Action type service definition
  - name: ActionService
    description: Action service definition
  - name: ActionTypeService
    description: Action type service definition
  - name: ActivityService
    description: Activity service definition
  - name: AdService
    description: Ad management service.
  - name: AnnotationService
    description: Annotation service definition
  - name: AnnotationSetService
    description: Annotation service definition
  - name: AnnotationTypeService
    description: Annotation service definition
  - name: AssetService
    description: Asset management service.
  - name: AuthService
    description: Auth service definition
  - name: BannerService
    description: Banner service definition
  - name: BannerV2Service_v2
    description: Banner service definition
  - name: CleengService
    description: CleengService service definition
  - name: ClipService
    description: ClipService is the service that handles Clip operations.
  - name: ConfigurationService
    description: >-
      Configuration management service. These configurations allow modifying the
      behavior of streams, uploads, simulcasts, etc.
  - name: ContentTypeService
    description: ContentType service definition
  - name: CreativeWorkService
    description: CreativeWork service definition
  - name: EntitlementService
    description: Entitlement service definition
  - name: EntityService
    description: Entity service definition
  - name: EventService
    description: Event service definition
  - name: FileService
    description: OTT files management.
  - name: IngestService
    description: Ingest management service.
  - name: IngestService_v2
    description: Ingest management service.
  - name: LiveStreamService
    description: LiveStream management service.
  - name: LiveStreamService_v2
    description: LiveStream management service.
  - name: OfferService
    description: Offer service definition
  - name: OrganizationService
    description: Organization management service.
  - name: PageService
    description: Page service definition
  - name: PlatformService
    description: Platform service definition
  - name: PlaylistService
    description: Playlist management service.
  - name: ProjectService
    description: Project management service.
  - name: SimulcastService
    description: Simulcast management service.
  - name: SlugService
    description: Slug service definition
  - name: SpiideoService
    description: SpiideoService service definition
  - name: StandingService
    description: Standing service definition
  - name: StitcherService
    description: StitcherService is the service that handles stitching operations.
  - name: StripeService
    description: StripeService service definition
  - name: SubscriptionService
    description: Subscription service definition
  - name: SubtitleService
    description: SubtitleService is the service that handles Subtitle operations.
  - name: TransactionService
    description: Transaction service definition
  - name: UploadService
    description: Upload management service.
  - name: UsageService
    description: The UsageService provides methods to retrieve usage data for SKUs.
  - name: UserService
    description: User management service
  - name: VODService
    description: VODService is the service that handles VOD operations.
  - name: VODService_v2
    description: VODService is the service that handles VOD operations.
  - name: VideoProtectionService
    description: VideoProtection management service.
  - name: VideoProtectionService_v2
    description: VideoProtection management service.
  - name: VideoService
    description: Video management service.
paths:
  /streaming/clips/v1:
    post:
      tags:
        - ClipService
      description: |-
        CreateClip

         Creates a new clip from the provided input. The clip will be
         available for downloading once the process is complete.

         The clip will be stored in the project's storage and the length
         of the clip will be determined by the `trim_in` and `trim_out` fields.
         The length of the clip cannot be neither longer than the source nor
         longer than 2 minutes.

         The request happens asynchronously and the response will contain
         the clip's ID. The client can use the ID to query the clip's status
         by calling the GetClip method.
      operationId: ClipService_CreateClip
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/motto.streaming.clip.v1.CreateClipRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/motto.streaming.clip.v1.CreateClipResponse
        default:
          description: Default error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/google.rpc.Status'
components:
  schemas:
    motto.streaming.clip.v1.CreateClipRequest:
      required:
        - project_id
        - name
      type: object
      properties:
        project_id:
          type: string
          description: >-
            The ID of the project that owns the clip and the output will be
            stored.
        name:
          type: string
          description: The name of the clip. It's set to the generated output's name.
        playlist_url:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/motto.streaming.clip.v1.PlaylistUrl'
          description: |-
            playlist url of the media to be clipped.
             Currently only supports HLS(m3u8) playlist.
        trim_in:
          pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
          type: string
          description: |-
            the moment in the source to start the clip
             based on the source's timeline.
             if not set, the clip will start at the beginning of the source.

             For example if the source is 10 minutes long and `trim_in` is set to 5 minutes,
             the clip will start at 5 minutes into the source.

             The unit of the value is`second` and also the value cannot be negative.
             for example: 10s, 3s, and so on.
        trim_out:
          pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
          type: string
          description: |-
            the moment in the source to end the clip
             based on the source's timeline.
             if not set, the clip will end at the end of the source.

             For example, if the source is 10 minutes long and `trim_out` is set to 7 minutes,
             the clip ends at the 7th minute of the source.


             The unit of the value is`second` and also the value cannot be negative.
             for example: 10s, 3s, and so on.
        labels:
          type: array
          items:
            $ref: '#/components/schemas/motto.streaming.clip.v1.Label'
          description: |-
            labels of the clip.
             labels will be assigned to the output asset.
      description: CreateClipRequest is the request message for CreateClip.
    motto.streaming.clip.v1.CreateClipResponse:
      type: object
      properties:
        clip:
          allOf:
            - $ref: '#/components/schemas/motto.streaming.clip.v1.Clip'
          description: The created clip.
      description: CreateClipResponse is the response message for CreateClip.
    google.rpc.Status:
      type: object
      properties:
        code:
          type: integer
          description: >-
            The status code, which should be an enum value of
            [google.rpc.Code][google.rpc.Code].
          format: int32
        message:
          type: string
          description: >-
            A developer-facing error message, which should be in English. Any
            user-facing error message should be localized and sent in the
            [google.rpc.Status.details][google.rpc.Status.details] field, or
            localized by the client.
        details:
          type: array
          items:
            $ref: '#/components/schemas/google.protobuf.Any'
          description: >-
            A list of messages that carry the error details.  There is a common
            set of message types for APIs to use.
      description: >-
        The `Status` type defines a logical error model that is suitable for
        different programming environments, including REST APIs and RPC APIs. It
        is used by [gRPC](https://github.com/grpc). Each `Status` message
        contains three pieces of data: error code, error message, and error
        details. You can find out more about this error model and how to work
        with it in the [API Design
        Guide](https://cloud.google.com/apis/design/errors).
    motto.streaming.clip.v1.PlaylistUrl:
      type: object
      properties:
        playlist_url:
          type: string
          description: |-
            playlist url of the media to be clipped.
             Currently only supports HLS(m3u8) playlist.
        bearer_token:
          type: string
          description: >-
            The Bearer token to include in the authorization header to access
            the playlist.
             Can be left empty if the playlist is publicly accessible.

             For security reasons, this will not appear in the response.
    motto.streaming.clip.v1.Label:
      type: object
      properties:
        key:
          type: string
          description: The key of the label.
        value:
          type: string
          description: The value of the label.
    motto.streaming.clip.v1.Clip:
      type: object
      properties:
        id:
          readOnly: true
          type: string
          description: id of the clip
        project_id:
          readOnly: true
          type: string
          description: project id of the clip
        name:
          readOnly: true
          type: string
          description: The name of the clip. It's set to the generated output's name.
        playlist_url:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/motto.streaming.clip.v1.PlaylistUrl'
          description: |-
            playlist url of the media to be clipped.
             Currently only supports HLS(m3u8) playlist.
        asset_id:
          readOnly: true
          type: string
          description: >-
            asset id of the clip


            Important: at most one of `asset_id`, `reserved_asset_id` may be set
            per request.
        reserved_asset_id:
          readOnly: true
          type: string
          description: >-
            reserved asset id of the clip.
             while the clip is being created, the asset id is reserved.

            Important: at most one of `asset_id`, `reserved_asset_id` may be set
            per request.
        trim_in:
          readOnly: true
          pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
          type: string
          description: |-
            the moment in the source to start the clip
             based on the source's timeline.

             The unit of the value is`second` and also the value cannot be negative.
             for example: 10s, 3s, and so on.
        trim_out:
          readOnly: true
          pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
          type: string
          description: |-
            the moment in the source to end the clip
             based on the source's timeline.

             The unit of the value is`second` and also the value cannot be negative.
             for example: 10s, 3s, and so on.
        state:
          readOnly: true
          enum:
            - STATE_UNSPECIFIED
            - STATE_PROCESSING
            - STATE_FAILED
            - STATE_READY
          type: string
          description: state of the clip
          format: enum
        labels:
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/motto.streaming.clip.v1.Label'
          description: |-
            labels of the clip.
             labels will be assigned to the output asset.
    google.protobuf.Any:
      type: object
      properties:
        '@type':
          type: string
          description: The type of the serialized message.
      additionalProperties: true
      description: >-
        Contains an arbitrary serialized message along with a @type that
        describes the type of the serialized message.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````