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

# Upload Object



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/storage.yaml put /api/storage/buckets/{bucketName}/objects/{objectKey}
openapi: 3.0.3
info:
  title: Insforge Storage API
  version: 2.0.0
  description: Bucket-based storage system similar to S3
servers: []
security: []
paths:
  /api/storage/buckets/{bucketName}/objects/{objectKey}:
    put:
      tags:
        - Client
      summary: Upload Object
      parameters:
        - name: bucketName
          in: path
          required: true
          schema:
            type: string
            pattern: ^[a-zA-Z0-9_-]+$
          example: avatars
        - name: objectKey
          in: path
          required: true
          schema:
            type: string
          example: user123.jpg
          description: Object key (can include forward slashes for pseudo-folders)
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: File to upload
              required:
                - file
      responses:
        '201':
          description: Object uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoredFile'
              example:
                bucket: avatars
                key: user123.jpg
                size: 102400
                mimeType: image/jpeg
                uploadedAt: '2024-01-21T10:30:00Z'
                url: /api/storage/buckets/avatars/objects/user123.jpg
        '400':
          description: Invalid bucket name, key, or file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: INVALID_FILE
                message: No file provided in the request
                statusCode: 400
                nextActions: Include a file in the multipart form data
        '404':
          description: Bucket not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: BUCKET_NOT_FOUND
                message: Bucket 'nonexistent' does not exist
                statusCode: 404
                nextActions: Create the bucket first
      security:
        - apiKey: []
components:
  schemas:
    StoredFile:
      type: object
      properties:
        bucket:
          type: string
          example: avatars
          description: Name of the bucket containing the object
        key:
          type: string
          example: user123.jpg
          description: Unique key identifying the object within the bucket
        size:
          type: integer
          example: 102400
          description: Size of the file in bytes
        mimeType:
          type: string
          example: image/jpeg
          description: MIME type of the file
        uploadedAt:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00Z'
          description: ISO timestamp when the file was uploaded
        url:
          type: string
          example: /api/storage/buckets/avatars/objects/user123.jpg
          description: URL to download the file
      required:
        - bucket
        - key
        - size
        - uploadedAt
        - url
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          description: Error code for programmatic handling
          example: VALIDATION_ERROR
        message:
          type: string
          description: Human-readable error message
          example: Invalid request
        statusCode:
          type: integer
          description: HTTP status code
          example: 400
        nextActions:
          type: string
          description: Suggested action to resolve the error
          example: Check your request parameters
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````