openapi: 3.2.0 info: title: Harbor Robot API description: These APIs provide services for manipulating Harbor project. version: '2.0' servers: - url: http://localhost/api/v2.0 - url: https://localhost/api/v2.0 security: - basic: [] - {} tags: - name: Robot paths: /robots: get: summary: Get robot account description: List the robot accounts with the specified level and project. tags: - Robot operationId: ListRobot parameters: - $ref: '#/components/parameters/requestId' - $ref: '#/components/parameters/query' - $ref: '#/components/parameters/sort' - $ref: '#/components/parameters/page' - $ref: '#/components/parameters/pageSize' responses: '200': description: Success headers: X-Total-Count: description: The total count of robot accounts schema: type: integer Link: description: Link refers to the previous page and next page schema: type: string content: application/json: schema: type: array items: $ref: '#/components/schemas/Robot' '400': $ref: '#/components/responses/400' '404': $ref: '#/components/responses/404' '500': $ref: '#/components/responses/500' post: summary: Create a robot account tags: - Robot operationId: CreateRobot parameters: - $ref: '#/components/parameters/requestId' responses: '201': description: Created headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string Location: description: The location of the resource schema: type: string content: application/json: schema: $ref: '#/components/schemas/RobotCreated' '400': $ref: '#/components/responses/400' '401': $ref: '#/components/responses/401' '403': $ref: '#/components/responses/403' '404': $ref: '#/components/responses/404' '500': $ref: '#/components/responses/500' requestBody: content: application/json: schema: $ref: '#/components/schemas/RobotCreate' description: The JSON object of a robot account. required: true /robots/{robot_id}: get: summary: Get a robot account description: This endpoint returns specific robot account information by robot ID. tags: - Robot operationId: GetRobotByID parameters: - $ref: '#/components/parameters/requestId' - $ref: '#/components/parameters/robotId' responses: '200': description: Return matched robot information. content: application/json: schema: $ref: '#/components/schemas/Robot' '401': $ref: '#/components/responses/401' '403': $ref: '#/components/responses/403' '404': $ref: '#/components/responses/404' '500': $ref: '#/components/responses/500' put: summary: Update a robot account description: This endpoint updates specific robot account information by robot ID. tags: - Robot operationId: UpdateRobot parameters: - $ref: '#/components/parameters/requestId' - $ref: '#/components/parameters/robotId' responses: '200': $ref: '#/components/responses/200' '400': $ref: '#/components/responses/400' '401': $ref: '#/components/responses/401' '403': $ref: '#/components/responses/403' '404': $ref: '#/components/responses/404' '409': $ref: '#/components/responses/409' '500': $ref: '#/components/responses/500' requestBody: content: application/json: schema: $ref: '#/components/schemas/Robot' description: The JSON object of a robot account. required: true patch: summary: Refresh the robot secret tags: - Robot operationId: RefreshSec parameters: - $ref: '#/components/parameters/requestId' - $ref: '#/components/parameters/robotId' responses: '200': description: Return refreshed robot sec. content: application/json: schema: $ref: '#/components/schemas/RobotSec' '400': $ref: '#/components/responses/400' '401': $ref: '#/components/responses/401' '404': $ref: '#/components/responses/404' '403': $ref: '#/components/responses/403' '500': $ref: '#/components/responses/500' requestBody: content: application/json: schema: $ref: '#/components/schemas/RobotSec' description: The JSON object of a robot account. required: true delete: summary: Delete a robot account description: This endpoint deletes specific robot account information by robot ID. tags: - Robot operationId: DeleteRobot parameters: - $ref: '#/components/parameters/requestId' - $ref: '#/components/parameters/robotId' responses: '200': $ref: '#/components/responses/200' '400': $ref: '#/components/responses/400' '401': $ref: '#/components/responses/401' '403': $ref: '#/components/responses/403' '404': $ref: '#/components/responses/404' '500': $ref: '#/components/responses/500' components: responses: '500': description: Internal server error. Inspect the `errors` array in the response body for details. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '403': description: Forbidden. The caller does not have sufficient permission to perform the requested operation. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '200': description: Success headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string '409': description: Conflict. The resource already exists or the current state prevents the operation. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '401': description: Unauthorized. Authentication is required to access this resource. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '404': description: Not found. The requested resource does not exist. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' '400': description: Bad request. The request body or query parameters are invalid. Inspect the `errors` array in the response body for details. headers: X-Request-Id: description: The ID of the corresponding request for the response schema: type: string content: application/json: schema: $ref: '#/components/schemas/Errors' parameters: sort: name: sort description: Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending order and field2 in descending order with "sort=field1,-field2" in: query required: false schema: type: string requestId: name: X-Request-Id description: An unique ID for the request in: header required: false schema: type: string minLength: 1 pageSize: name: page_size in: query required: false description: The size of per page schema: type: integer format: int64 default: 10 maximum: 100 page: name: page in: query required: false description: The page number schema: type: integer format: int64 default: 1 query: name: q description: Query string to query resources. Supported query patterns are "exact match(k=v)", "fuzzy match(k=~v)", "range(k=[min~max])", "list with union releationship(k={v1 v2 v3})" and "list with intersetion relationship(k=(v1 v2 v3))". The value of range and list can be string(enclosed by " or '), integer or time(in format "2020-04-09 02:36:00"). All of these query patterns should be put in the query string "q=xxx" and splitted by ",". e.g. q=k1=v1,k2=~v2,k3=[min~max] in: query required: false schema: type: string robotId: name: robot_id in: path description: Robot ID required: true schema: type: integer format: int64 schemas: Error: description: a model for all the error response coming from harbor type: object properties: code: type: string description: The error code message: type: string description: The error message example: code: NOT_FOUND message: artifact library/hello-world:latest not found Robot: type: object properties: id: type: integer format: int64 description: The ID of the robot name: type: string description: The name of the robot description: type: string description: The description of the robot secret: type: string description: The secret of the robot level: type: string description: The level of the robot, project or system duration: type: - integer - 'null' format: int64 description: The duration of the robot in days, duration must be either -1(Never) or a positive integer editable: type: boolean x-omitempty: false description: The editable status of the robot disable: type: boolean x-omitempty: false description: The disable status of the robot expires_at: type: integer format: int64 description: The expiration date of the robot permissions: type: array items: $ref: '#/components/schemas/RobotPermission' creator_type: type: string description: The type of the robot creator, like local(harbor_user) or robot. creator_ref: type: integer format: int64 description: The reference of the robot creator, like the id of harbor user. creation_time: type: string format: date-time description: The creation time of the robot. update_time: type: string format: date-time description: The update time of the robot. RobotPermission: type: object properties: kind: type: string description: The kind of the permission namespace: type: string description: The namespace of the permission access: type: array items: $ref: '#/components/schemas/Access' Errors: description: The error array that describe the errors got during the handling of request type: object properties: errors: type: array items: $ref: '#/components/schemas/Error' RobotSec: type: object description: The response for refresh/update robot account secret. properties: secret: type: string description: The secret of the robot Access: type: object properties: resource: type: string description: The resource of the access. Possible resources are listed here for system and project level https://github.com/goharbor/harbor/blob/main/src/common/rbac/const.go action: type: string description: The action of the access. Possible actions are *, pull, push, create, read, update, delete, list, operate, scanner-pull and stop. effect: type: string description: The effect of the access RobotCreated: type: object description: The response for robot account creation. properties: id: type: integer format: int64 description: The ID of the robot name: type: string description: The name of the robot secret: type: string description: The secret of the robot creation_time: type: string format: date-time description: The creation time of the robot. expires_at: type: integer format: int64 description: The expiration date of the robot RobotCreate: type: object description: The request for robot account creation. properties: name: type: string description: The name of the robot description: type: string description: The description of the robot secret: type: string description: The secret of the robot level: type: string description: The level of the robot, project or system disable: type: boolean description: The disable status of the robot duration: type: integer format: int64 description: The duration of the robot in days, duration must be either -1(Never) or a positive integer permissions: type: array items: $ref: '#/components/schemas/RobotPermission' securitySchemes: basic: type: http scheme: basic