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

# closeOffer

> Finalize an offering after its end date, releasing the raise or entering rollback.

Prepares unsigned transactions for finalizing a Security Token Offering (STO). Use `POST /prepare-transactions` with `method=closeOffer`.

Finalizing is what unlocks [`claimTokens`](https://docs.brickken.com/api-reference/endpoint/prepare-claimTokens): until it runs, investors can neither receive their tokens nor be refunded.

## The end date has to have passed

> [!WARNING]
>
> An offering cannot be closed early. The escrow refuses to finalize an offering that has not
> started, and refuses to finalize one whose `endDate` has not yet passed — returning
> `0xffac9d14` `IssuanceNotEnded(address,uint256)`. There is no administrative or time override,
> in Sandbox or in production.

An offering therefore runs for its full configured window. Since there is no minimum duration, give
test offerings a short `endDate` so you can exercise close and claim quickly.

## Success or rollback

What finalization does depends on whether the raise reached `minRaiseUSD`, the offering's soft cap:

| Outcome | Condition | Effect |
| - | - | - |
| Successful | Amount raised reached the soft cap | The raise is withdrawn to the issuer, and investors can claim their tokens |
| Rollback | Amount raised fell short of the soft cap | Investors are refunded their payment token instead of receiving tokens |

> [!NOTE]
>
> Waiting for the end date does not by itself produce a successful offering. An offering that ends
> under its soft cap finalizes into rollback, and `claimTokens` then refunds. To demonstrate a
> successful claim, size the soft cap so the offering can actually reach it.

## Notes

* Only the issuer of the offering can close it.
* Existing investments remain valid throughout; nothing is lost by waiting for the window to end.
* Finalization is irreversible once the transaction is confirmed.

## Next step

Preparing does not touch the chain. The response gives you `txId` and an array of unsigned `transactions` — you still have to sign and submit them.

**1. Sign every returned transaction**

Sign each entry locally with the wallet that sends the transaction — `signerAddress`, or `investorAddress` for `newInvest` and `claimTokens`. It must be whitelisted by Brickken, and it needs native gas on the target chain.

**2. Submit the signed payloads**

`POST` them to [`/send-transactions`](https://docs.brickken.com/api-reference/endpoint/send) as `{ txId, signedTransactions }` and Brickken broadcasts for you.

If you would rather broadcast yourself, prepare with `executionMode: "client-broadcast"` and confirm afterwards with `{ txId, txHash }` instead.

**3. Poll until it confirms**

Call [`GET /get-transaction-status`](https://docs.brickken.com/api-reference/endpoint/get-transaction-status) with the `txId`. A `pending` status means it is broadcast but not yet mined — do not resubmit.

Full walkthrough: [Tokenize an asset and run an STO](https://docs.brickken.com/api-reference/guides/tokenize-and-run-an-sto.md).


## OpenAPI

````yaml api-reference/prepare/closeOffer.json POST /prepare-transactions
openapi: 3.1.0
info:
  title: Brickken API V2 - prepare closeOffer
  description: >-
    Method-scoped view of `POST /prepare-transactions` for `method=closeOffer`.
    The full endpoint, with every supported method and the common request body
    parameters, is documented in `api-reference/openapi.json`.
  version: 2.0.0
servers:
  - url: https://api.sandbox.brickken.com
    description: Sandbox Environment
  - url: https://api.brickken.com
    description: Production Environment
security: []
paths:
  /prepare-transactions:
    post:
      summary: Prepare an STO closure
      description: >-
        Prepares the unsigned transaction that closes an ongoing Security Token
        Offering.
      operationId: prepare_closeOffer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - method
                - chainId
                - signerAddress
                - tokenizerEmail
                - tokenSymbol
              properties:
                method:
                  type: string
                  example: closeOffer
                  enum:
                    - closeOffer
                  description: >-
                    Required. Operation to prepare. Must be `closeOffer` for
                    this endpoint.
                  default: closeOffer
                chainId:
                  type: string
                  description: >-
                    Required. Blockchain network identifier. Hex format is
                    recommended, for example Sepolia `aa36a7`.
                  example: aa36a7
                signerAddress:
                  type: string
                  description: >-
                    Required. Tokenizer wallet that signs the closure. On V2
                    tokens it also receives the withdrawn funds.
                  example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                tokenizerEmail:
                  type: string
                  description: Required. Email of the tokenizer that owns the offering.
                  example: tokenizer@example.com
                  format: email
                tokenSymbol:
                  type: string
                  description: >-
                    Required. Symbol of the token whose ongoing offering is
                    closed.
                  example: EXMPL
              example:
                method: closeOffer
                chainId: aa36a7
                signerAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                tokenizerEmail: tokenizer@example.com
                tokenSymbol: EXMPL
            example:
              method: closeOffer
              chainId: aa36a7
              signerAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
              tokenizerEmail: tokenizer@example.com
              tokenSymbol: EXMPL
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transactions:
                    type: array
                    description: Array of unsigned transaction objects ready for signing
                    items:
                      type: object
                      properties:
                        from:
                          type: string
                          description: Sender address
                          example: '0x1234567890abcdef1234567890abcdef12345678'
                        to:
                          type: string
                          description: Recipient address
                          example: '0xabcdef1234567890abcdef1234567890abcdef12'
                        value:
                          type: string
                          description: Transaction value in hex
                          example: '0x00'
                        nonce:
                          type: integer
                          description: Transaction nonce
                          example: 3792
                        chainId:
                          type: integer
                          description: Blockchain network chain ID
                          example: 11155111
                        data:
                          type: string
                          description: Transaction data payload
                          example: >-
                            0xd362e8a70000000000000000000000000000000000000000000000000000000000000040...
                        type:
                          type: integer
                          description: Transaction type (EIP-1559)
                          example: 2
                        maxPriorityFeePerGas:
                          type: string
                          description: Maximum priority fee per gas
                          example: '1150000'
                        maxFeePerGas:
                          type: string
                          description: Maximum fee per gas
                          example: '1156037'
                        gasLimit:
                          type: string
                          description: Gas limit in hex
                          example: '0xccef'
                  info:
                    type: object
                    description: Metadata about the operation
                    properties:
                      tokenizerEmail:
                        type: string
                        description: Email of the tokenizer
                        example: tokenizer@example.com
                      tokenSymbol:
                        type: string
                        description: Symbol of the token
                        example: EXMPL
                      investorEmail:
                        type: string
                        description: Email of the investor (when applicable)
                        example: investor@example.com
                  txId:
                    type: string
                    description: >-
                      Unique identifier for this transaction batch (required for
                      /send-transactions). This is NOT a blockchain transaction
                      hash.
                    example: >-
                      0x46adea7bdf49c576a760102e0d6bc9ecd650b3998588cd3d7f576a7973426aad
                required:
                  - transactions
                  - txId
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.