---
title: "POST /v1/contract"
method: POST
path: "/v1/contract"
---

# POST /v1/contract

`POST /v1/contract`

Create a new contract project

## Request body

- union
  - object
  - InternalAppApiHttpV1ContractSaveProjectRequest
    - `name` string, required
    - `planSummary` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityContractPlanSummary
      - `description` string
      - `features` string[]
      - `gasOptimizations` string[]
      - `name` string
      - `securityConsiderations` string[]
    - `sessionId` string — For new projects
    - `source` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityContractSource
      - `abi` string — Compiled artifacts (populated after compilation)
      - `bytecode` string — Deployment bytecode
      - `compilerOutput` string — Metadata
      - `constructorAbi` string — Constructor info
      - `contractCode` string — Main contract Solidity source (flattened or with imports)
      - `contractName` string — Main contract (required)
      - `dependencies` object — package → version (e.g., "@openzeppelin/contracts" → "v5.0.0")
      - `deployedCode` string — Runtime bytecode
      - `files` object — Multi-file project support Key: relative path (e.g., "src/interfaces/IERC20.sol") Value: file content
      - `mainContract` string — Path to main contract file (e.g., "src/MyToken.sol")
      - `solVersion` string — Solidity version (e.g., "0.8.20")
      - `summary` string — Non-technical summary generated by AI
      - `testCode` string — Foundry test file source
      - `version` integer — Source version (increments on each edit)
    - `testResults` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityTestResults
      - `autoFixed` boolean
      - `failed` integer
      - `failures` string[]
      - `fixAttempts` integer
      - `log` string
      - `passed` integer
      - `runAt` string
      - `total` integer

## Response `201`

Created

- GetContractProjectSuccessResponse
  - `code` integer
  - `data` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityContractProject
    - `allDeployments` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityDeployResult[]
      - `address` string
      - `blockNumber` integer
      - `chainId` integer
      - `deployedAt` string
      - `deploymentMode` string — standard, create2, or create3
      - `gasUsed` integer
      - `isDeterministic` boolean — Whether CREATE2/CREATE3 was used
      - `networkType` string — mainnet or testnet
      - `predictedAddress` string — Pre-computed address for deterministic deployments
      - `salt` string — CREATE2/CREATE3 salt for deterministic address
      - `txHash` string
      - `verificationStatus` 'pending' | 'verified' | 'failed' — Verification status
      - `verificationUrl` string — URL to view verified contract on block explorer
      - `verified` boolean — Whether contract source is verified on block explorer
    - `auditReport` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityAuditReport
      - `findings` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityAuditFinding[]
        - `acknowledged` boolean
        - `category` string — reentrancy, access-control, etc.
        - `codeSnippet` string
        - `description` string
        - `location` string
        - `recommendation` string
        - `severity` string — critical, high, medium, low, info
        - `title` string
      - `passes` string[]
      - `summary` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityAuditSummary
        - `critical` integer
        - `high` integer
        - `info` integer
        - `low` integer
        - `medium` integer
        - `overallRisk` string — low, medium, high, critical
        - `recommendation` string — deployment recommendation
      - `timestamp` string
    - `autoFixAttempts` integer
    - `compilationFixAttempts` integer
    - `createdAt` string
    - `currentStep` integer
    - `deployments` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityDeployments — Deployments is populated from the contract_deployments table, NOT from a DB column. Kept for backward-compatible JSON serialization in API responses.
    - `externalContractId` string
    - `id` string
    - `name` string
    - `organizationId` string
    - `planSummary` string
    - `sessionId` string
    - `source` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityContractSource
      - `abi` string — Compiled artifacts (populated after compilation)
      - `bytecode` string — Deployment bytecode
      - `compilerOutput` string — Metadata
      - `constructorAbi` string — Constructor info
      - `contractCode` string — Main contract Solidity source (flattened or with imports)
      - `contractName` string — Main contract (required)
      - `dependencies` object — package → version (e.g., "@openzeppelin/contracts" → "v5.0.0")
      - `deployedCode` string — Runtime bytecode
      - `files` object — Multi-file project support Key: relative path (e.g., "src/interfaces/IERC20.sol") Value: file content
      - `mainContract` string — Path to main contract file (e.g., "src/MyToken.sol")
      - `solVersion` string — Solidity version (e.g., "0.8.20")
      - `summary` string — Non-technical summary generated by AI
      - `testCode` string — Foundry test file source
      - `version` integer — Source version (increments on each edit)
    - `status` 'planned' | 'generating' | 'code_generated' | 'testing' | 'tested' | 'auditing' | 'audited' | 'deploying' | 'testnet_deployed' | 'mainnet_deployed' | 'failed'
    - `testResults` GithubComB3FunB3MonoServicesB3osWorkflowInternalPkgEntityTestResults
      - `autoFixed` boolean
      - `failed` integer
      - `failures` string[]
      - `fixAttempts` integer
      - `log` string
      - `passed` integer
      - `runAt` string
      - `total` integer
    - `updatedAt` string
    - `walletId` string
  - `message` string
  - `requestId` string

## Other responses

- `400` — Bad Request
- `500` — Internal Server Error

---

[API](https://skmtc.net/b3-fun/apis/b3os-workflow-api.md) · [All operations](https://skmtc.net/b3-fun/apis/b3os-workflow-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/b3-fun/b3os-workflow-api/versions/5a750a5a9596/schema)
