{
  "components": {
    "schemas": {
      "Error": {
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "portalSession": {
        "bearerFormat": "JWT",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "The management API behind the CloudRepo admin portal, at https://api.cloudrepo.io. This version describes the repository operations list, create, get and delete; the group repository operations create a group, list its members, add a member, remove a member and set a member's priority; the webhook operations list, get and delete; and the repository settings operations get a repository's settings, turn Overwrite Protection on, set Snapshot Cleanup and turn Public Access off. Each one takes the session of a signed-in person, sent in the Authorization header with the HTTP bearer scheme (portalSession, a JWT). Without a valid session, each answers 401. Repository tokens are a different credential: your build tools present them to your repository host, {organization}.mycloudrepo.io, and this document does not describe them. Questions about this reference: support@cloudrepo.io.",
    "title": "CloudRepo management API",
    "version": "19e705b2197b0aa2"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/group-repository": {
      "post": {
        "description": "Creates a group repository in your organization: one repository your build tools read from, which serves the files of the repositories you add to it as members. Set repositoryLocation to group. The id follows a repository's rules: 1 to 32 letters, digits, hyphens or underscores, stored in lower case. The type is maven or docker, and maven when it is left out. An id already in use is refused with 409.",
        "operationId": "createGroupRepository",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "repositoryLocation": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "repositoryLocation"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "repositoryId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "repositoryId"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Created."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Create a group repository",
        "tags": [
          "Group repositories"
        ]
      }
    },
    "/api/group-repository/{repository-id}/member/{member-id}": {
      "delete": {
        "description": "Removes the repository member-id from the group repository-id. Only the membership is removed: the member repository and its files stay.",
        "operationId": "removeGroupMember",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "member-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Remove a member from a group",
        "tags": [
          "Group repositories"
        ]
      },
      "post": {
        "description": "Adds the repository member-id to the group repository-id. The member must be a repository of the group's type, and a group cannot be its own member. A repository the group already holds is refused with 409. A new member has no priority until you set one.",
        "operationId": "addGroupMember",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "member-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Added."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Add a member to a group",
        "tags": [
          "Group repositories"
        ]
      }
    },
    "/api/group-repository/{repository-id}/member/{member-id}/priority": {
      "post": {
        "description": "Sets the priority of the member member-id in the group repository-id, a whole number. The group reads its members in priority order: the lowest number first. A repository that is not a member of the group is refused with 404.",
        "operationId": "setGroupMemberPriority",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "member-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "groupPriority": {
                    "type": "integer"
                  }
                },
                "required": [
                  "groupPriority"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Set a member's priority",
        "tags": [
          "Group repositories"
        ]
      }
    },
    "/api/group-repository/{repository-id}/members": {
      "get": {
        "description": "Lists the member repositories of the group repository-id, each with its priority. The group reads its members in priority order: the lowest number first, then the members with no priority, and members of equal priority in order of their ids. A member with no priority has a null groupPriority. A repository that is not a group is refused with 404.",
        "operationId": "listGroupMembers",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "properties": {
                      "groupPriority": {
                        "oneOf": [
                          {
                            "type": "integer"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "repositoryName": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "repositoryName",
                      "groupPriority"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                }
              }
            },
            "description": "The group's members."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "List a group's members",
        "tags": [
          "Group repositories"
        ]
      }
    },
    "/api/repositories": {
      "get": {
        "description": "Lists the repositories in your organization.",
        "operationId": "listRepositories",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "properties": {
                      "fileCount": {
                        "type": "integer"
                      },
                      "public": {
                        "type": "boolean"
                      },
                      "repositoryId": {
                        "type": "string"
                      },
                      "repositoryLocation": {
                        "type": "string"
                      },
                      "repositoryType": {
                        "type": "string"
                      },
                      "totalFileSize": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "repositoryId",
                      "repositoryType"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                }
              }
            },
            "description": "The repositories."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "List repositories",
        "tags": [
          "Repositories"
        ]
      }
    },
    "/api/repository": {
      "post": {
        "description": "Creates a hosted repository in your organization. The id is 1 to 32 letters, digits, hyphens or underscores, stored in lower case, and it names the repository in its URL. The type is maven, npm, pypi or docker, and maven when it is left out. An id already in use is refused with 409.",
        "operationId": "createRepository",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "repositoryId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "repositoryId"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Created."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Create a repository",
        "tags": [
          "Repositories"
        ]
      }
    },
    "/api/repository/{repository-id}": {
      "delete": {
        "description": "Deletes an empty repository. Files in its Trash and a proxy's cached copies count. A repository that still holds any of these is refused with 409: delete it in the admin portal, which asks you to confirm and sign in again.",
        "operationId": "deleteRepository",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Delete a repository",
        "tags": [
          "Repositories"
        ]
      },
      "get": {
        "description": "Lists what is at the top of a repository: its directories, and its files with their sizes in bytes. In a Docker repository, the directories are its images.",
        "operationId": "getRepository",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "directories": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "files": {
                      "items": {
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "size": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "name"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "path": {
                      "type": "string"
                    },
                    "repositoryId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "repositoryId",
                    "path",
                    "directories",
                    "files"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The top level of the repository."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Get a repository's top-level contents",
        "tags": [
          "Repositories"
        ]
      }
    },
    "/api/repository/{repository-id}/disable-public-access": {
      "post": {
        "description": "Turns Public Access off for the repository repository-id, so every read of it needs a credential again. It turns the repository's package pages off too. It only narrows who can read the repository. Turning Public Access on is not in this reference: it takes a confirmation of your identity, which the admin portal asks for. A repository that is not in your organization, or does not exist, is refused with 404, and one that is being deleted with 409. A signed-in person without the Manage Repositories permission is refused with 403.",
        "operationId": "disablePublicAccess",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Turn Public Access off",
        "tags": [
          "Repository settings"
        ]
      }
    },
    "/api/repository/{repository-id}/enable-overwrite-protection": {
      "post": {
        "description": "Turns Overwrite Protection on for the repository repository-id: a publish that would replace a file already stored at the same path is then refused with 409, and the stored file stays. It applies to a hosted Maven, npm or PyPI repository. A Docker repository is refused with 400, since it stores images by content digest, and so is a proxy or group repository and any other type. Turning Overwrite Protection off is not in this reference: it takes a confirmation of your identity, which the admin portal asks for. A repository that is not in your organization, or does not exist, is refused with 404, and one that is being deleted with 409. A signed-in person without the Manage Repositories permission is refused with 403.",
        "operationId": "enableOverwriteProtection",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Turn Overwrite Protection on",
        "tags": [
          "Repository settings"
        ]
      }
    },
    "/api/repository/{repository-id}/update-snapshot-cleaner": {
      "post": {
        "description": "Sets Snapshot Cleanup, a Maven setting, for the repository repository-id. snapshots-to-keep is how many snapshot versions to keep for each GAV, a whole number from 1 to 20, or -1 to turn Snapshot Cleanup off. A body without it, or with a value that is not a whole number (a fraction such as 0.4 included), is 0, is below -1 or is above 20, is refused with 400, and nothing is saved. The repository's settings read it back as snapshotsToKeep. A repository that is not in your organization, or does not exist, is refused with 404, and one that is being deleted with 409. A signed-in person without the Manage Repositories permission is refused with 403.",
        "operationId": "setSnapshotCleanup",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "snapshots-to-keep": {
                    "type": "integer"
                  }
                },
                "required": [
                  "snapshots-to-keep"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Set Snapshot Cleanup",
        "tags": [
          "Repository settings"
        ]
      }
    },
    "/api/settings/repository/{repository-id}": {
      "get": {
        "description": "Gets the settings of the repository repository-id. public says whether Public Access is on. overwriteProtection says whether Overwrite Protection is in force, always true or false: it is on by default on a hosted Maven, npm or PyPI repository, and only those can turn it on. snapshotsToKeep is how many snapshot versions Snapshot Cleanup keeps for each GAV, or -1 when Snapshot Cleanup is off; it is absent when it was never set, which is off too. status is active, or deleting while the repository is being deleted. A repository that is not in your organization, or does not exist, is refused with 404.",
        "operationId": "getRepositorySettings",
        "parameters": [
          {
            "in": "path",
            "name": "repository-id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "overwriteProtection": {
                      "type": "boolean"
                    },
                    "public": {
                      "type": "boolean"
                    },
                    "repositoryId": {
                      "type": "string"
                    },
                    "repositoryLocation": {
                      "type": "string"
                    },
                    "repositoryType": {
                      "type": "string"
                    },
                    "snapshotsToKeep": {
                      "type": "integer"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "repositoryId",
                    "repositoryType",
                    "status",
                    "overwriteProtection"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The repository's settings."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Get a repository's settings",
        "tags": [
          "Repository settings"
        ]
      }
    },
    "/api/webhooks": {
      "get": {
        "description": "Lists every webhook in your organization, across its repositories, in one answer. Each webhook posts the events of one repository to its target. A Slack target is the incoming-webhook URL Slack gave you, and that URL is a secret: anyone who holds it can post to the channel. So the answer shows each target masked: its scheme and host, then an ellipsis, then the last 4 characters of its path, never its query. Deliveries still go to the full URL you stored. A signed-in person without the Manage Webhooks permission is refused with 403.",
        "operationId": "listWebhooks",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "properties": {
                      "fireOnDelete": {
                        "type": "boolean"
                      },
                      "fireOnDownload": {
                        "type": "boolean"
                      },
                      "fireOnUpload": {
                        "type": "boolean"
                      },
                      "repositoryId": {
                        "type": "string"
                      },
                      "target": {
                        "format": "password",
                        "readOnly": true,
                        "type": "string"
                      },
                      "webhookId": {
                        "type": "string"
                      },
                      "webhookType": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "webhookId",
                      "repositoryId",
                      "target",
                      "webhookType",
                      "fireOnUpload",
                      "fireOnDownload",
                      "fireOnDelete"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Your organization's webhooks."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "List webhooks",
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/api/webhooks/{id}": {
      "delete": {
        "description": "Deletes the webhook id. Only the webhook is deleted: its repository and the repository's files stay. An id that is not a UUID is refused with 400, and a webhook that is not in your organization, or does not exist, with 404. A signed-in person without the Manage Webhooks permission is refused with 403.",
        "operationId": "deleteWebhook",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Delete a webhook",
        "tags": [
          "Webhooks"
        ]
      },
      "get": {
        "description": "Gets the webhook id, a webhookId from the list. The answer shows its target masked, as the list does: its scheme and host, then an ellipsis, then the last 4 characters of its path, never its query, since a Slack incoming-webhook URL is a secret. Deliveries still go to the full URL you stored. An id that is not a UUID is refused with 400, and a webhook that is not in your organization, or does not exist, with 404. A signed-in person without the Manage Webhooks permission is refused with 403.",
        "operationId": "getWebhook",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "fireOnDelete": {
                      "type": "boolean"
                    },
                    "fireOnDownload": {
                      "type": "boolean"
                    },
                    "fireOnUpload": {
                      "type": "boolean"
                    },
                    "repositoryId": {
                      "type": "string"
                    },
                    "target": {
                      "format": "password",
                      "readOnly": true,
                      "type": "string"
                    },
                    "webhookId": {
                      "type": "string"
                    },
                    "webhookType": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "webhookId",
                    "repositoryId",
                    "target",
                    "webhookType",
                    "fireOnUpload",
                    "fireOnDownload",
                    "fireOnDelete"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The webhook."
          },
          "401": {
            "description": "There is no session, or the session is not valid."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The request was refused. When the response has a body, its error field says why."
          }
        },
        "security": [
          {
            "portalSession": []
          }
        ],
        "summary": "Get a webhook",
        "tags": [
          "Webhooks"
        ]
      }
    }
  },
  "security": [
    {
      "portalSession": []
    }
  ],
  "servers": [
    {
      "url": "https://api.cloudrepo.io"
    }
  ]
}
