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

# Upload Background or Foreground

> Uploads an image to show behind your avatars (a background) or over them (a foreground). It goes through a content safety check first, which takes a few seconds, and one it flags is refused. Stored as PNG, private to your account: only your own sessions can use it, by its id, as a session token's, a static video's or an Auto session's background_id / foreground_id, or in a streaming session's BG_ / FG_ message.



## OpenAPI

````yaml https://api.simli.ai/openapi.yaml post /assets/{kind}
openapi: 3.1.0
info:
  title: Simli
  version: 1.0.0
servers:
  - url: https://api.simli.ai/
    description: API server
security:
  - ApiKeyAuth: []
paths:
  /assets/{kind}:
    post:
      summary: Upload Background or Foreground
      description: >-
        Uploads an image to show behind your avatars (a background) or over them
        (a foreground). It goes through a content safety check first, which
        takes a few seconds, and one it flags is refused. Stored as PNG, private
        to your account: only your own sessions can use it, by its id, as a
        session token's, a static video's or an Auto session's background_id /
        foreground_id, or in a streaming session's BG_ / FG_ message.
      operationId: uploadAsset_assets__kind__post
      parameters:
        - name: kind
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AssetKind'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_uploadAsset_assets__kind__post'
      responses:
        '201':
          description: Stored
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Asset'
        '400':
          description: >-
            The image can't be used: not a JPEG, PNG or WEBP, not 16:9, 9:16 or
            1:1, outside the size limits, a foreground without transparency, or
            flagged by the content safety check. detail says which.
        '401':
          description: Unauthorized
        '413':
          description: The image is 5MB or more
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: >-
            The content safety check is unavailable, so nothing was stored. Try
            again.
components:
  schemas:
    AssetKind:
      type: string
      enum:
        - backgrounds
        - foregrounds
      title: AssetKind
    Body_uploadAsset_assets__kind__post:
      properties:
        image:
          type: string
          format: binary
          title: Image
          description: >-
            JPEG, PNG or WEBP, under 5MB, in one of the streaming canvases'
            shapes: 16:9, 9:16 or 1:1 and no other, at least 512 pixels on its
            shorter side and at most 1920x1080, 1080x1920 or 1080x1080. A
            foreground needs transparency (a PNG or WEBP with an alpha channel).
            EXIF orientation is applied; metadata is dropped.
      type: object
      required:
        - image
      title: Body_uploadAsset_assets__kind__post
    Asset:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: What background_id / foreground_id and BG_ / FG_ take.
        name:
          type: string
          title: Name
          description: The uploaded file's name.
        width:
          type: integer
          title: Width
        height:
          type: integer
          title: Height
        size_bytes:
          type: integer
          title: Size Bytes
          description: The stored PNG's size.
        created_at:
          type: integer
          title: Created At
          description: Unix time, in seconds.
      type: object
      required:
        - id
        - name
        - width
        - height
        - size_bytes
        - created_at
      title: Asset
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-simli-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.