---
search:
  tags:
    - Tenants
    - POST
seo:
  description: >-
    Builds source files and deploys them to a tenant you added to an
    environment.… Reference for the POST /_luna/tenants/{tenant}/deploy endpoint
    in the Luna API.
sidebar:
  label: Deploy source files to a tenant
  badge: POST
title: Deploy source files to a tenant
type: openapi-operation
---
Builds source files and deploys them to a tenant you added to an environment. Luna builds the files inside the tenant's own isolation boundary, previews the change and then deploys it. This is how a platform runs code that its customers write. To deploy to an environment's default tenant, use `POST /_luna/deploy`.

`POST /_luna/tenants/{tenant}/deploy`

**Request body** (`application/json`, required)

- `files` (object, required) — Each file's path, relative and separated by \`/\`, with its contents as UTF-8 text.
- `entry` (string | null) — The entry module's path. When left out, Luna reads the config file or looks for a default entry module.
- `confirm` (boolean) — Deploy even though the preview lists changes that need your say-so.

Request body example:

```json
{
  "files": {
    "property1": "string",
    "property2": "string"
  },
  "entry": "string",
  "confirm": true
}
```

**Responses**

- `200` — The files are deployed.
- `409` — Nothing was deployed. The preview says what blocks the deploy or needs \`confirm\`.
- `default` — The request failed. The status says how and \`error.message\` says why.

Response example, 200:

```json
{
  "deployed": true,
  "version": 0,
  "lunas": [
    {
      "name": "string",
      "visibility": "string",
      "key": [
        "string"
      ],
      "handlers": [
        "string"
      ]
    }
  ],
  "publishableKey": "string",
  "apiToken": "string",
  "preview": {
    "changes": [
      "string"
    ],
    "blocked": [
      "string"
    ],
    "confirm": [
      "string"
    ],
    "deletes": [
      "string"
    ],
    "dryRun": [
      {
        "type": "string",
        "report": {
          "sampled": 0,
          "failures": [
            {
              "key": {},
              "error": "string"
            }
          ],
          "pendingMessages": 0,
          "pendingSchedules": 0
        }
      }
    ],
    "changedHandlers": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    }
  },
  "url": "string"
}
```
