{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-firebase/json-schema/google-firebase-backend-schema.json",
  "title": "Backend",
  "description": "A backend is the primary resource of App Hosting.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-firebase-firebaseapphosting-projects-api-openapi.yml#/components/schemas/Backend",
  "type": "object",
  "properties": {
    "codebase": {
      "$ref": "#/$defs/Codebase",
      "description": "Optional. If specified, the connection to an external source repository to watch for event-driven updates to the backend."
    },
    "displayName": {
      "description": "Optional. Human-readable name. 63 character limit.",
      "type": "string"
    },
    "appId": {
      "description": "Optional. The [ID of a Web App](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.webApps#WebApp.FIELDS.app_id) associated with the backend.",
      "type": "string"
    },
    "name": {
      "type": "string",
      "description": "Identifier. The resource name of the backend. Format: `projects/{project}/locations/{locationId}/backends/{backendId}`."
    },
    "requestLogsDisabled": {
      "type": "boolean",
      "description": "Optional. A field that, if true, indicates that incoming request logs are disabled for this backend. Incoming request logs are enabled by default."
    },
    "environment": {
      "type": "string",
      "description": "Optional. The environment name of the backend, used to load environment variables from environment specific configuration."
    },
    "serviceAccount": {
      "description": "Required. The name of the service account used for Cloud Build and Cloud Run. Should have the role roles/firebaseapphosting.computeRunner or equivalent permissions.",
      "type": "string"
    },
    "uid": {
      "type": "string",
      "readOnly": true,
      "description": "Output only. System-assigned, unique identifier."
    },
    "mode": {
      "type": "string",
      "description": "Optional. Deprecated: Use `environment` instead.",
      "deprecated": true
    },
    "updateTime": {
      "readOnly": true,
      "format": "google-datetime",
      "description": "Output only. Time at which the backend was last updated.",
      "type": "string"
    },
    "annotations": {
      "description": "Optional. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "reconciling": {
      "description": "Output only. A field that, if true, indicates that the system is working to make adjustments to the backend during a LRO.",
      "readOnly": true,
      "type": "boolean"
    },
    "createTime": {
      "format": "google-datetime",
      "description": "Output only. Time at which the backend was created.",
      "readOnly": true,
      "type": "string"
    },
    "etag": {
      "type": "string",
      "description": "Output only. Server-computed checksum based on other values; may be sent on update or delete to ensure operation is done on expected resource.",
      "readOnly": true
    },
    "labels": {
      "additionalProperties": {
        "type": "string"
      },
      "description": "Optional. Unstructured key value map that can be used to organize and categorize objects.",
      "type": "object"
    },
    "uri": {
      "readOnly": true,
      "description": "Output only. The primary URI to communicate with the backend.",
      "type": "string"
    },
    "servingLocality": {
      "enum": [
        "SERVING_LOCALITY_UNSPECIFIED",
        "REGIONAL_STRICT",
        "GLOBAL_ACCESS"
      ],
      "description": "Required. Immutable. Specifies how App Hosting will serve the content for this backend. It will either be contained to a single region (REGIONAL_STRICT) or allowed to use App Hosting's global-replicated serving infrastructure (GLOBAL_ACCESS).",
      "type": "string"
    },
    "managedResources": {
      "readOnly": true,
      "type": "array",
      "items": {
        "$ref": "#/$defs/ManagedResource"
      },
      "description": "Output only. A list of the resources managed by this backend."
    },
    "deleteTime": {
      "type": "string",
      "format": "google-datetime",
      "description": "Output only. Time at which the backend was deleted.",
      "readOnly": true
    }
  },
  "$defs": {
    "Codebase": {
      "properties": {
        "repository": {
          "description": "Required. The resource name for the Developer Connect [`gitRepositoryLink`](https://cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks) connected to this backend, in the format: `projects/{project}/locations/{location}/connections/{connection}/gitRepositoryLinks/{repositoryLink}` The connection for the `gitRepositoryLink` must made be using the Firebase App Hosting GitHub App via the Firebase Console.",
          "type": "string"
        },
        "rootDirectory": {
          "type": "string",
          "description": "Optional. If `repository` is provided, the directory relative to the root of the repository to use as the root for the deployed web app. Defaults to use the root of the repository if not provided. If deploying a [monorepo](https://firebase.google.com/docs/app-hosting/monorepos), this should be the directory that contains the `package.json` or `apphosting.yaml` file."
        }
      },
      "type": "object",
      "description": "The connection to an external source repository to watch for event-driven updates to the backend."
    },
    "ManagedResource": {
      "type": "object",
      "description": "An external resource managed by App Hosting on the project.",
      "properties": {
        "runService": {
          "$ref": "#/$defs/RunService",
          "description": "A Cloud Run [`service`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#resource:-service), managed by App Hosting."
        }
      }
    },
    "RunService": {
      "type": "object",
      "properties": {
        "service": {
          "description": "Optional. The name of the Cloud Run [`service`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#resource:-service), in the format: `projects/{project}/locations/{location}/services/{serviceId}`",
          "type": "string"
        }
      },
      "description": "A managed Cloud Run [`service`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#resource:-service)."
    }
  }
}