> ## Documentation Index
> Fetch the complete documentation index at: https://magica-adi.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Crop an image

> Blocks until Magica finishes. Exactly one crop rectangle.



## OpenAPI

````yaml /openapi.yaml post /tools/crop_image
openapi: 3.1.0
info:
  title: Galaxy Agent API
  version: 1.0.0
  description: |
    Public REST for agent chats, Magica tools, and run status.
    Authenticate with `Authorization: Bearer gxk_live_…`.
servers:
  - url: https://magica-backend-oda9.onrender.com/api/v1
    description: Production
  - url: http://localhost:4000/api/v1
    description: Local
security:
  - bearerAuth: []
tags:
  - name: Chats
  - name: Messages
  - name: Runs
  - name: Magica
paths:
  /tools/crop_image:
    post:
      tags:
        - Magica
      summary: Crop an image
      description: Blocks until Magica finishes. Exactly one crop rectangle.
      operationId: cropImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - image_url
              properties:
                image_url:
                  type: string
                x_percent:
                  type: number
                y_percent:
                  type: number
                width_percent:
                  type: number
                height_percent:
                  type: number
      responses:
        '200':
          description: Tool result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolResult'
        '504':
          description: Magica poll timed out
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ToolResult:
      type: object
      required:
        - toolName
        - output
        - assets
        - creditCost
        - durationMs
      properties:
        toolName:
          type: string
        output: {}
        assets:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
              mimeType:
                type: string
              filename:
                type: string
        creditCost:
          type: string
        providerRunId:
          type: string
        durationMs:
          type: integer
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        code:
          type: string
          examples:
            - UNAUTHORIZED
            - CHAT_NOT_FOUND
            - RUN_ACTIVE
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key created in the product. Shown once, prefix `gxk_live_`.

````

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