---
title: "Ensure per-app GitHub repo exists (idempotent)"
method: POST
path: "/v1/cloud/apps/{app_id}/repo/ensure"
tags: ["v1", "Cloud Infrastructure"]
---

# Ensure per-app GitHub repo exists (idempotent)

`POST /v1/cloud/apps/{app_id}/repo/ensure`

## Request

- Base URL: `https://memory.papr.ai`
- URL: `https://memory.papr.ai/v1/cloud/apps/{app_id}/repo/ensure`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

## Path parameters

- `app_id` string, required

## Request body

- CloudActingUserFields: Optional acting user — same semantics as memory add external_user_id.
  - `external_user_id` string, nullable: Parse _User.objectId of the acting user (desktop OAuth). Used for ownership-scoped cloud operations instead of the API key user.

## Response `200`

Successful Response

- AppRepoRecordResponse
  - `appId` string, required
  - `namespaceId` string, required
  - `orgId` string, nullable
  - `githubOrg` string, required
  - `repoName` string, required
  - `shardId` string, required
  - `cloneUrl` string, required
  - `repoUrl` string, required
  - `createdAt` string, required
  - `updatedAt` string, nullable
  - `ownerUserId` string, nullable
  - `legacyNamespaceRepo` string, nullable
  - `callerCanWriteMain` boolean, nullable
  - `callerRole` string, nullable

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-17** `85b2953e02c4`: 2 info
  - added the optional property `callerCanWriteMain` to the response with the `200` status
  - added the optional property `callerRole` to the response with the `200` status
- **2026-10-16** `0e7a5c0d125d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/papr-ai/apis/papr-memory-api/changes/v1/cloud/apps/:app_id/repo/ensure/post.md)

---

[API](https://skmtc.dev/papr-ai/apis/papr-memory-api.md) - [All operations](https://skmtc.dev/papr-ai/apis/papr-memory-api/llms.txt) - [OpenAPI document](https://skmtc.dev/papr-ai/apis/papr-memory-api/revisions/6fc381dc78b3?raw)
