# Edit Content

Source: https://recoupable.dev/docs/api-reference/content/edit

Apply ffmpeg edits to a video — trim, crop, resize, or overlay text. Pass a `template` for a preset edit pipeline, or build your own with an `operations` array.

## PATCH /api/content

Full OpenAPI specification: https://recoupable.dev/docs/spec/content.json

## Authentication

This operation requires one of the security alternatives in the specification below. Security scheme definitions are included where present in the published specification.

[Authentication guide](https://recoupable.dev/docs/authentication)

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Recoup API - Content",
    "description": "API documentation for the Recoup platform - an AI agent platform for the music industry",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.recoupable.dev"
    }
  ],
  "paths": {
    "/api/content": {
      "patch": {
        "description": "Apply ffmpeg edits to a video — trim, crop, resize, or overlay text. Pass a `template` for a preset edit pipeline, or build your own with an `operations` array.",
        "security": [
          {
            "apiKeyAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Edit parameters",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContentCreateEditRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Edit task triggered successfully. Poll via [GET /api/tasks/runs](/api-reference/tasks/runs) using the returned `runId`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContentCreateEditResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed — invalid or missing request body fields",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContentErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContentErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContentErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ContentCreateEditRequest": {
        "type": "object",
        "required": [
          "video_url"
        ],
        "description": "Requires a video URL. Operations are applied sequentially via ffmpeg.",
        "properties": {
          "video_url": {
            "type": "string",
            "format": "uri",
            "description": "Input video URL (required)"
          },
          "template": {
            "type": "string",
            "description": "Template name for deterministic edit config. If provided, operations are read from the template. See [GET /api/content/templates](/api-reference/content/templates) for available options."
          },
          "operations": {
            "type": "array",
            "description": "Array of edit operations to apply in order. Required if template is not provided.",
            "items": {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "trim",
                    "crop",
                    "resize",
                    "overlay_text"
                  ],
                  "description": "Operation type"
                },
                "start": {
                  "type": "number",
                  "description": "Start time in seconds (trim)"
                },
                "duration": {
                  "type": "number",
                  "description": "Duration in seconds (trim)"
                },
                "aspect": {
                  "type": "string",
                  "description": "Aspect ratio e.g. 9:16 (crop)"
                },
                "width": {
                  "type": "integer",
                  "description": "Width in pixels (crop/resize)"
                },
                "height": {
                  "type": "integer",
                  "description": "Height in pixels (crop/resize)"
                },
                "content": {
                  "type": "string",
                  "description": "Text content (overlay_text)"
                },
                "font": {
                  "type": "string",
                  "description": "Font name (overlay_text)"
                },
                "color": {
                  "type": "string",
                  "description": "Text color (overlay_text)"
                },
                "stroke_color": {
                  "type": "string",
                  "description": "Text stroke color (overlay_text)"
                },
                "max_font_size": {
                  "type": "number",
                  "description": "Maximum font size (overlay_text)"
                },
                "position": {
                  "type": "string",
                  "enum": [
                    "top",
                    "center",
                    "bottom"
                  ],
                  "description": "Text position (overlay_text)"
                }
              }
            }
          },
          "output_format": {
            "type": "string",
            "enum": [
              "mp4",
              "webm",
              "mov"
            ],
            "default": "mp4",
            "description": "Output format"
          }
        }
      },
      "ContentCreateEditResponse": {
        "type": "object",
        "required": [
          "runId",
          "status"
        ],
        "properties": {
          "runId": {
            "type": "string",
            "description": "Background task run ID. Poll via [GET /api/tasks/runs](/api-reference/tasks/runs) to check progress."
          },
          "status": {
            "type": "string",
            "enum": [
              "triggered"
            ],
            "description": "Status of the edit task"
          }
        }
      },
      "ContentErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Error message describing what went wrong",
            "example": "Unauthorized"
          }
        }
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Your Recoup API key. [Learn more](/quickstart#api-keys)."
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
```
