---
title: "Codify a single cloud asset to Infrastructure as Code"
method: POST
path: "/api/codify"
tags: ["Codification"]
---

# Codify a single cloud asset to Infrastructure as Code

`POST /api/codify`

Generate IaC code (Terraform HCL) for a specific cloud asset

## Request body

- CodifyAssetRequest
  - `assetType` string, required — The Terraform asset type (e.g., aws_s3_bucket)
  - `assetId` string, required — The unique identifier of the cloud asset (e.g., ARN)
  - `iacType` 'terraform' | 'tfcdk' | 'cloudformation' | 'pulumi', required — The Infrastructure as Code type
  - `provider` string, required — The cloud provider (e.g., aws, azure, gcp)
  - `accountNumber` string, required — The cloud account number/ID
  - `ignoreEscaping` boolean — If true, returns raw HCL without escaping newlines

## Response `200`

Successfully codified asset

- CodifyAssetResponse
  - `codifiedResult` string — The generated IaC code
  - `importBlocks` string — Terraform import blocks (semicolon-separated)
  - `importCommand` string — Terraform import commands (semicolon-separated)
  - `providerBlock` string — The Terraform provider block

## Other responses

- `400` — Bad Request Error
- `401` — Unauthorized Error
- `403` — Insufficient permissions
- `500` — Internal Server Error

---

[API](https://skmtc.net/firefly/apis/api-gateway.md) · [All operations](https://skmtc.net/firefly/apis/api-gateway/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/firefly/api-gateway/revisions/eea119b4113f/schema)
