> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trusset.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy Stock Token

> Deploy a new ERC-3643 compliant stock token contract

Returns everything needed to deploy a new ERC-3643 stock token: the shared implementation address, the minimal proxy bytecode to deploy, and the ABI-encoded `initialize` call to run against the new proxy.

You deploy the proxy from your own wallet, then call [Log Deploy](/endpoints/stock-tokenization/log-deploy) with the resulting address and transaction hash to register the token against your instance.

## Request Body

<ParamField body="name" type="string" required>
  Token name. Maximum 100 characters.
</ParamField>

<ParamField body="symbol" type="string" required>
  Token ticker symbol. Maximum 20 characters.
</ParamField>

<ParamField body="isin" type="string" required>
  ISIN identifier for the underlying security.
</ParamField>

<ParamField body="issuerAddress" type="string" required>
  Ethereum address of the token issuer. Must be a valid checksummed address.
</ParamField>

<ParamField body="metadataURI" type="string">
  URI pointing to off-chain token metadata (e.g., IPFS or HTTPS link).
</ParamField>

<ParamField body="legalOperatorAddress" type="string">
  Ethereum address of the legal operator, if separate from the issuer. Must be a valid address when provided.
</ParamField>

<ParamField body="allowSubIssuers" type="boolean" default="false">
  When `true`, enables the sub-issuer role on this token, allowing delegated issuance.
</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="success" type="boolean">Deployment payload was built successfully.</ResponseField>

    <ResponseField name="deployData" type="object">
      <Expandable>
        <ResponseField name="implementationAddress" type="string">Shared stock token implementation the proxy delegates to.</ResponseField>
        <ResponseField name="proxyBytecode" type="string">Minimal proxy creation bytecode. Deploy this to create the token.</ResponseField>
        <ResponseField name="initData" type="string">Encoded `initialize` call. Send it to the deployed proxy to set the name, symbol, ISIN, metadata URI, identity registry, issuer, and legal operator.</ResponseField>
        <ResponseField name="identityRegistry" type="string">Identity registry the token enforces transfers against.</ResponseField>
        <ResponseField name="complianceModule" type="string">Compliance module address, or null when the instance has none configured.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<Warning>
  The token exists on-chain the moment you deploy the proxy, but Trusset knows nothing about it until you call [Log Deploy](/endpoints/stock-tokenization/log-deploy). A token that is never logged will not appear in holder queries, balance lookups, or webhook events.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.trusset.org/stocks/api/tokenization/deploy" \
    -H "Content-Type: application/json" \
    -H "X-API-Key: trusset_abc123xy_secret..." \
    -d '{
      "name": "Acme Corp Equity",
      "symbol": "ACME",
      "isin": "DE000A0D9PT0",
      "issuerAddress": "0xAbC123dEf456789012345678901234567890AbCd",
      "metadataURI": "ipfs://QmXyz...",
      "allowSubIssuers": false
    }'
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch(
    'https://api.trusset.org/stocks/api/tokenization/deploy',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': 'trusset_abc123xy_secret...'
      },
      body: JSON.stringify({
        name: 'Acme Corp Equity',
        symbol: 'ACME',
        isin: 'DE000A0D9PT0',
        issuerAddress: '0xAbC123dEf456789012345678901234567890AbCd',
        metadataURI: 'ipfs://QmXyz...',
        allowSubIssuers: false
      })
    }
  );
  const { data } = await response.json();
  const { implementationAddress, proxyBytecode, initData } = data.deployData;

  const factory = new ethers.ContractFactory([], proxyBytecode, wallet);
  const proxy = await factory.deploy();
  const receipt = await proxy.deployTransaction.wait();

  await wallet.sendTransaction({ to: proxy.address, data: initData });
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "success": true,
      "deployData": {
        "implementationAddress": "0x9F8a4c2B1e7D3f5A6b8C0d2E4f6A8b0C2d4E6f8A",
        "proxyBytecode": "0x3d602d80600a3d3981f3363d3d373d3d3d363d73...",
        "initData": "0xc4d66de8...",
        "identityRegistry": "0x5B3c9D1e7F2a4B6c8D0e2F4a6B8c0D2e4F6a8B0c",
        "complianceModule": "0x7A1b3C5d7E9f1A3b5C7d9E1f3A5b7C9d1E3f5A7b"
      }
    },
    "metadata": {
      "requestId": "550e8400-e29b-41d4-a716-446655440000",
      "timestamp": "2025-06-15T12:00:00.000Z",
      "instanceId": "inst_abc123"
    }
  }
  ```

  ```json Error - Missing Fields theme={null}
  {
    "success": false,
    "error": {
      "code": "MISSING_FIELDS",
      "message": "name, symbol, and isin are required"
    },
    "metadata": {
      "requestId": "550e8400-e29b-41d4-a716-446655440000",
      "timestamp": "2025-06-15T12:00:00.000Z",
      "instanceId": "inst_abc123"
    }
  }
  ```
</ResponseExample>
