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

# Post slices



## OpenAPI

````yaml /openapi.yml post /slices/
openapi: 3.0.0
info:
  title: Avala API
  description: >

    # Authentication


    ## Generating an API Key


    The Avala SDK uses API keys to authenticate requests. You can create and
    manage your API keys from the

    Settings page of Mission Control.


    Follow these steps to generate a new API key:


    1. Open your settings page by clicking on your user avatar located at the
    top right-hand corner of any
        Mission Control screen, and select `Settings`.
    2. From the left-hand sub-menu, select `Security & Identity`.

    3. Click on `New API Key`, enter a name for the key, and then click `Create
    key`.


    The new key will be automatically copied to your clipboard. Please note, for
    security reasons, the key

    will not be accessible once you close the window. Ensure you store it in a
    safe location before closing

    the pop-up modal.


    ### Video walkthrough of API key generation


    <iframe class="embedly-embed"
    src="//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2F
        www.youtube.com%2Fembed%2FTYdLhkAAbLA%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2F
        www.youtube.com%2Fwatch%3Fv%3DTYdLhkAAbLA&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTYdLhkAAbLA%2F
        hqdefault.jpg&key=7788cb384c9f4d5dbbdbeffd9fe4b92f&type=text%2Fhtml&schema=youtube" width="854"
        height="480" scrolling="no" title="YouTube embed" frameborder="0" allow="autoplay;
        fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"></iframe>


    ## Authenticating with an API Key


    This is the easiest part! Just add a header named `X-Avala-Api-Key` to your
    requests and set the

    previously generated API Key as the value.
  termsOfService: https://avala.ai/legal/terms
  contact:
    email: support@avala.ai
  version: v1
servers:
  - url: https://api.avala.ai/api/v1
security:
  - API_Key: []
  - JWT: []
tags:
  - name: datasets
    description: To be completed...
  - name: projects
    description: To be completed...
  - name: tasks
    description: List and retrieve annotation tasks.
  - name: exports
    description: To be completed...
paths:
  /slices/:
    parameters: []
    post:
      tags:
        - slices
      operationId: slices_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SliceCreate'
        required: true
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Slice'
components:
  schemas:
    SliceCreate:
      required:
        - name
        - visibility
        - sub_slices
      type: object
      properties:
        name:
          title: Name
          type: string
          maxLength: 100
          minLength: 1
        uid:
          title: Uid
          type: string
          format: uuid
          readOnly: true
        organization:
          $ref: '#/components/schemas/Organization'
        visibility:
          title: Visibility
          description: Visibility setting for the slice.
          type: string
          enum:
            - public
            - private
        sub_slices:
          description: >

            An Array of sub slice objects. The available `sub_slice` types are:


            - `dataset_items`: a preselected list of dataset items in a dataset

            ```

            {
                "type": "dataset_items",
                "dataset_uid": <dataset_uid>
                "dataset_item_uids": [
                    <dataset_item_uid>,
                    <dataset_item_uid>
                    ...
                ]
            }

            ```

            - `dataset`: all dataset items in selected dataset

            ```

            {
                "type": "dataset",
                "dataset_uid": <dataset_uid>
            }

            ```

            - `filters`: selects dataset items from dataset by applying filter
            expressions

            ```

            {
                "type": "filters",
                "dataset_uid": <dataset_uid>,
                "filters":
                    <filter_expression>,
            }

            ```
          type: array
          items:
            $ref: '#/components/schemas/SubSliceArray'
        random_selection_count:
          title: Random selection count
          type: integer
          nullable: true
    Slice:
      required:
        - name
        - slug
      type: object
      properties:
        name:
          title: Name
          type: string
          maxLength: 100
          minLength: 1
        slug:
          title: Slug
          type: string
          maxLength: 100
          minLength: 1
        uid:
          title: Uid
          type: string
          format: uuid
          readOnly: true
        owner_name:
          title: Owner name
          description: The name of the slice owner
          type: string
          readOnly: true
          minLength: 1
        organization:
          $ref: '#/components/schemas/Organization'
        visibility:
          title: Visibility
          type: string
          enum:
            - public
            - private
        sub_slices:
          type: array
          items:
            $ref: '#/components/schemas/SubSliceArray'
          readOnly: true
        source_data:
          title: Source data
          type: object
          nullable: true
        status:
          title: Status
          type: string
          enum:
            - pending
            - created
            - failed
        featured_slice_item_urls:
          description: List of the first 4 found slice items' URL
          type: array
          items:
            type: string
            nullable: true
          readOnly: true
        item_count:
          title: Item count
          type: integer
          readOnly: true
    Organization:
      required:
        - name
      type: object
      properties:
        uid:
          title: Uid
          type: string
          format: uuid
          readOnly: true
        name:
          title: Name
          type: string
          maxLength: 1024
          minLength: 1
        slug:
          title: Slug
          type: string
          format: slug
          pattern: ^[-a-zA-Z0-9_]+$
          readOnly: true
          minLength: 1
        description:
          title: Description
          type: string
          maxLength: 1024
        logo:
          title: Logo
          type: string
          readOnly: true
          format: uri
          nullable: true
        website:
          title: Website
          type: string
          format: uri
        public_slug:
          title: Public slug
          description: >-
            Canonical slug for URL rendering. Coworker viewers receive the
            organization's codename; others receive the real slug.
          type: string
          readOnly: true
      nullable: true
    SubSliceArray:
      description: >

        An Array of sub slice objects. The available `sub_slice` types are:


        - `dataset_items`: a preselected list of dataset items in a dataset

        ```

        {
            "type": "dataset_items",
            "dataset_uid": <dataset_uid>
            "dataset_item_uids": [
                <dataset_item_uid>,
                <dataset_item_uid>
                ...
            ]
        }

        ```

        - `dataset`: all dataset items in selected dataset

        ```

        {
            "type": "dataset",
            "dataset_uid": <dataset_uid>
        }

        ```

        - `filters`: selects dataset items from dataset by applying filter
        expressions

        ```

        {
            "type": "filters",
            "dataset_uid": <dataset_uid>,
            "filters":
                <filter_expression>,
        }

        ```
      required:
        - type
      type: object
      properties:
        type:
          title: Type
          description: >

            Type of the sub slice. Depending on the type, certain other
            properties are required. Possible values are:

            - dataset_items

            - dataset

            - filters
          type: string
          enum:
            - dataset_items
            - dataset
            - filters
        dataset_uid:
          title: Dataset uid
          description: The UID of the selected dataset
          type: string
          format: uuid
        dataset_item_uids:
          type: array
          items:
            type: string
            format: uuid
        filters:
          title: Filters
          type: object
          additionalProperties:
            type: array
            items:
              type: string
              minLength: 1
  securitySchemes:
    API_Key:
      type: apiKey
      name: X-Avala-Api-Key
      in: header
      description: >-
        API key for authentication. Generate one in Mission Control Settings >
        Security & Identity.
    JWT:
      type: apiKey
      name: Authorization
      in: header
      description: JWT token with 'JWT' prefix, e.g., 'JWT eyJhbGciOiJIUzI1NiIsInR...'

````