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

# Upload a plugin, or replace it.

> Store an uploaded file listing as the plugin its manifest names, replacing the
whole plugin when it already exists, and require it at this scope.

Uploads a plugin's files to the organization, creating the plugin or replacing it with a new version. Use it to publish a plugin from CI instead of uploading a `.zip` by hand in [Customize](https://docs.devin.ai/product-guides/plugins.md). See [Publish an uploaded plugin from CI](https://docs.devin.ai/product-guides/plugins.md#publish-an-uploaded-plugin-from-ci) for a script that builds the request from a plugin folder.

## Permissions

Requires a [service user](https://docs.devin.ai/api-reference/v3/service-users/members-service-users.md) or [personal access token](https://docs.devin.ai/api-reference/personal-access-tokens.md) with the `ManageOrgPlugins` permission at the organization level. Tokens used by a running Devin session are rejected.

## Behavior

* The request is JSON with a `files` list holding every file of the plugin. Each entry has a `path` relative to the plugin root and its `content`. Send text files as UTF-8 text. For any other file, send the bytes base64-encoded and set `is_binary` to `true`. The whole request is limited to 75 MB.
* The plugin ID comes from the `name` in the [plugin manifest](https://docs.devin.ai/cli/extensibility/plugins/overview.md#manifest), lowercased with every run of other characters turned into `-`. The files must include a manifest. There is no ID in the URL.
* If no plugin with that ID is stored at this scope, the upload creates it. Otherwise the upload becomes the plugin's next version: its files are exactly the files in the request, and earlier versions stay in **Version history**.
* A plugin that the organization's manifest does not list yet is added to it as required, so it is installed for everyone in the organization. A plugin that is already listed keeps its current entry.
* An upload replaces the stored plugin without checking who changed it last. To avoid overwriting a change you have not seen, send `revision_token` with the value a previous upload returned: the upload is then refused with `409` if the plugin has changed since.
* The API does not accept a `.zip`. Unpack the plugin and send its files.
* New sessions load the uploaded version. Running sessions keep what they loaded at start.

## Status codes

* `201`: the upload created a new plugin. A `201` you did not expect usually means the manifest `name` changed.

* `200`: the upload replaced an existing plugin with a new version.

* `400`: a path is unsafe or repeated, binary content is not valid base64, or the files exceed the file-count or total-size limits.

* `403`: the caller lacks the permission or is a session token, uploaded plugins are disabled for the account, or the ID is reserved for Devin.

* `409`: the ID belongs to a plugin that cannot be replaced by an upload, or `revision_token` was sent and the plugin has changed since that revision.


## OpenAPI

````yaml v3-openapi.yaml PUT /v3beta1/organizations/{org_id}/plugins/uploads
openapi: 3.1.0
info:
  description: Devin v3 API with Service User authentication and RBAC
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3beta1/organizations/{org_id}/plugins/uploads:
    put:
      tags:
        - managed-plugins
      summary: Upload a plugin, or replace it.
      description: >-
        Store an uploaded file listing as the plugin its manifest names,
        replacing the

        whole plugin when it already exists, and require it at this scope.
      operationId: >-
        handle_put_org_plugin_upload_v3beta1_organizations__org_id__plugins_uploads_put
      parameters:
        - description: 'Organization ID (prefix: org-)'
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PluginUploadRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PluginUploadResponse'
          description: Successful Response
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PluginUploadResponse'
          description: The upload created the plugin.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Conflict
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Gone
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unprocessable Content
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Too Many Requests
components:
  schemas:
    PluginUploadRequest:
      properties:
        files:
          description: Every file of the plugin, as the plugin's whole tree.
          items:
            $ref: '#/components/schemas/PluginUploadFile'
          maxItems: 100000
          minItems: 1
          title: Files
          type: array
        revision_token:
          anyOf:
            - type: string
            - type: 'null'
          description: Only upload if the plugin is still at this revision.
          title: Revision Token
      required:
        - files
      title: PluginUploadRequest
      type: object
    PluginUploadResponse:
      properties:
        name:
          description: The plugin's display name.
          title: Name
          type: string
        plugin_id:
          description: The plugin's id, from its manifest name.
          title: Plugin Id
          type: string
        revision_token:
          description: Revision the upload was stored as.
          title: Revision Token
          type: string
      required:
        - plugin_id
        - name
        - revision_token
      title: PluginUploadResponse
      type: object
    ProblemDetail:
      description: >-
        RFC 9457 application/problem+json error body for the v3 API.


        detail is retained from the legacy {"detail": ...} body for back-compat;
        the

        other members are additive. errors carries field-level validation
        failures

        (422 only).
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: A human-readable explanation specific to this occurrence.
          title: Detail
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Machine-readable code for blocked-action refusals (e.g.
            "user_frozen", "migrated_session").
          title: Error Code
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: Field-level validation errors (422 responses only).
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: A URI reference (the request path) for this occurrence.
          title: Instance
        status:
          description: The HTTP status code.
          title: Status
          type: integer
        title:
          description: A short, human-readable summary of the problem type.
          title: Title
          type: string
        type:
          default: about:blank
          description: A URI reference identifying the problem type.
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
    PluginUploadFile:
      properties:
        content:
          description: The file as UTF-8 text, or base64 of its bytes when `is_binary`.
          title: Content
          type: string
        is_binary:
          default: false
          description: Whether `content` is base64.
          title: Is Binary
          type: boolean
        path:
          description: Path of the file, relative to the plugin root.
          title: Path
          type: string
      required:
        - path
        - content
      title: PluginUploadFile
      type: object
  securitySchemes:
    bearerAuth:
      description: 'Service User credential (prefix: cog_)'
      scheme: bearer
      type: http

````

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