# Upload Connector File

Source: https://recoupable.dev/docs/api-reference/connectors/upload-file

Stage an image into Connector file storage so it can be attached to a connector action that accepts a file_uploadable field. The returned descriptor is embedded in a file_uploadable array on [Execute Connector Action](/api-reference/connectors/execute-action).

## POST /api/connectors/files

Full OpenAPI specification: https://recoupable.dev/docs/spec/social.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 - Social",
    "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/connectors/files": {
      "post": {
        "security": [
          {
            "apiKeyAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "description": "Stage an image into Connector file storage so it can be attached to a connector action that accepts a file_uploadable field. The returned descriptor is embedded in a file_uploadable array on [Execute Connector Action](/api-reference/connectors/execute-action).",
        "requestBody": {
          "description": "The image URL to stage and the action it will be attached to.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadConnectorFileRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image staged. Returns the Connector file descriptor to embed in the action's file_uploadable array.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadConnectorFileResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — missing or invalid `url` (must be a reachable URL) or `toolSlug`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure staging the file into Connector storage (the image fetch failed or Connector errored).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "UploadConnectorFileRequest": {
        "type": "object",
        "required": [
          "url",
          "toolSlug"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Publicly reachable URL of the image to stage. Fetched server-side and uploaded to Connector storage. Required."
          },
          "toolSlug": {
            "type": "string",
            "description": "The action slug the image will be attached to, UPPERCASE_SNAKE_CASE (e.g. `LINKEDIN_CREATE_LINKED_IN_POST`). Scopes the upload to that tool/toolkit. Required."
          }
        }
      },
      "UploadConnectorFileResponse": {
        "type": "object",
        "required": [
          "success",
          "name",
          "mimetype",
          "s3key"
        ],
        "properties": {
          "success": {
            "type": "boolean"
          },
          "name": {
            "type": "string",
            "description": "Stored filename."
          },
          "mimetype": {
            "type": "string",
            "description": "Detected MIME type of the stored file."
          },
          "s3key": {
            "type": "string",
            "description": "Connector storage key. Pass this together with `name` and `mimetype` in the action's file_uploadable array."
          }
        }
      },
      "Error": {
        "required": [
          "error",
          "message"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "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"
      }
    }
  }
}
```
