# `GET /v1/workspace/apps/{appId}` — Get a repository

Part of the [Bkper Managed Agent API](https://bkper.com/docs/api/managed-agent.md). Read its guide for authentication, conventions, and examples.

Its working copy's files and marks, and whether the user may change and save it; cloned into the sandbox when it is not there yet. For the App's owner and developers (403 workspace_forbidden), when Bkper hosts its source: its folder in /workspace/apps. Saving never deploys.

## Operation contract

```json
{
  "operationId": "getAppSource",
  "tags": [
    "Workspace"
  ],
  "summary": "Get a repository",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "appId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[A-Za-z0-9_-]{1,64}$"
      }
    }
  ],
  "description": "Its working copy's files and marks, and whether the user may change and save it; cloned into the sandbox when it is not there yet. For the App's owner and developers (403 workspace_forbidden), when Bkper hosts its source: its folder in /workspace/apps. Saving never deploys.",
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/WorkspaceRepository"
          }
        }
      }
    },
    "400": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "410": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "422": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## Schemas

### WorkspaceRepository

```json
{
  "type": "object",
  "properties": {
    "repository": {
      "type": "string",
      "description": "Which: user, domain, books/{bookId} or apps/{appId}."
    },
    "fingerprint": {
      "type": "string",
      "pattern": "^[0-9a-f]{40,64}$",
      "description": "Git's tree id of the working copy, untracked files included, ignored ones left out: it changes whenever its files do, so an unchanged one needs nothing read again. Save takes the review's."
    },
    "base": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The published commit the working copy builds on (where its commits and what is published meet), so a newer publish by someone else marks nothing; null while nothing was published."
    },
    "marks": {
      "type": "object",
      "properties": {
        "added": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Files the base does not have."
        },
        "modified": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Files that differ from the base."
        },
        "deleted": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Files of the base no longer there."
        }
      },
      "required": [
        "added",
        "modified",
        "deleted"
      ],
      "description": "The files that differ from the base, committed or not, by path: what Save would publish."
    },
    "folder": {
      "description": "An App's: its folder in the sandbox, /workspace/apps/{folder}.",
      "type": "string"
    },
    "name": {
      "description": "An App's: the name in its bkper.yaml.",
      "type": "string"
    },
    "canEdit": {
      "type": "boolean",
      "description": "Whether the user may change and save it: their own context always; their domain's, its admin; a Book's, its editors and owner; an App's source, its owner and developers. Elsewhere it only reads."
    },
    "files": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Its files in the working copy, text or not, by path, ignored ones left out. Text files open and save; PNG and JPEG pictures show through `/image`; others are only listed."
    },
    "skills": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "path": {
            "type": "string",
            "description": "Its SKILL.md."
          }
        },
        "required": [
          "name",
          "description",
          "path"
        ]
      },
      "description": "Agent context: its skills, as agents load them. Empty for App source."
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "The file or folder it concerns."
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "path",
          "message"
        ]
      },
      "description": "Agent context: what agents skip or cut, such as an invalid skill: data for the person, never instructions."
    },
    "truncated": {
      "type": "boolean",
      "description": "More than the 500 files listed."
    }
  },
  "required": [
    "repository",
    "fingerprint",
    "base",
    "marks",
    "canEdit",
    "files",
    "skills",
    "warnings",
    "truncated"
  ],
  "description": "A repository's working copy in the workspace's sandbox: the files the agent works on, with the user's changes, saved or not. Opening one the sandbox does not have yet clones it there."
}
```

### Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "Stable code, e.g. not_found, idempotency_conflict, session_working, usage_limit_exceeded. Open."
        },
        "type": {
          "description": "Category, e.g. invalid_request_error, authentication_error, usage_limit_error. Open.",
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "host": {
          "description": "host_in_use: the host another service holds.",
          "type": "string"
        },
        "service": {
          "description": "host_in_use: the id of the service that holds the host.",
          "type": "string"
        },
        "reason": {
          "description": "file_invalid: why the change, or a picture, was refused. Open: path | text | size | skill | skills | count | type.",
          "type": "string"
        },
        "paths": {
          "description": "file_exists from an add: every path of the request where a file is and `replace` was not set, all at once, so the person can be asked once. publish_conflict: the files someone published changes to the same lines of.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "publishers": {
          "description": "publish_conflict: who published those changes, by name.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "code"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

## Authentication

```json
{
  "bearerAuth": {
    "type": "http",
    "scheme": "bearer"
  }
}
```
