---
title: "Withdraw credits and create retirements"
method: POST
path: "/exchanges/{ExchangeCode}/account/{AccountIdentifier}/program/{RetirementProgramCode}/action/withdraw-and-retire"
tags: ["Exchange"]
---

# Withdraw credits and create retirements

`POST /exchanges/{ExchangeCode}/account/{AccountIdentifier}/program/{RetirementProgramCode}/action/withdraw-and-retire`

## Request

- Base URL: `https://sandbox.preprod.connect.xpansiv.com/app/api/v1`
- URL: `https://sandbox.preprod.connect.xpansiv.com/app/api/v1/exchanges/{ExchangeCode}/account/{AccountIdentifier}/program/{RetirementProgramCode}/action/withdraw-and-retire`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/xpansiv/apis/xpansiv-connect-api/docs/exchanges/:ExchangeCode/account/:AccountIdentifier/program/:RetirementProgramCode/action/withdraw-and-retire/post.ts> (a function with typed inputs; its response is checked against the schema)

Allows the combination of withdrawal of credits and creation of retirements in bulk

## Path parameters

- `ExchangeCode` string, required
- `AccountIdentifier` string, required
- `RetirementProgramCode` string, required: Retirement program code. Ref.Data.RETIREMENT_PROGRAM

## Request body

- object
  - `dryRun` boolean, required: If true it will only do the validation of the request but not to create the retirements
  - `retirements` object[], required
    - `ein` string, required
    - `quantity` integer, required
    - `externalIdentifier` string
  - `attributes` object

## Response `200`

Retirements

- object
  - `retirements` Retirement[], required
    - `instrument` union, required
      - CarbonInstrument
        - `type` string, required: REC or CARBON. Ref.Data.INSTRUMENT_TYPE
        - `id` integer: Unique Xpansiv Connect identifier.
        - `ein` string, required: Environment Instrument Number. Unique identifier associated with an issuance of credits from a given project, vintage, technology/fuel type and associated certification(s)/eligibility(s). An EIN is associated with a position and a position will never be associated with more than 1 EIN.
        - `description` string: The Xpansiv Connect description associated with the instrument providing information regarding location, vintage, fuel type and certifications.
        - `program` string, required: Ref.Data.PROGRAM
        - `vintage` Vintage, required
          - `year` integer, required: Vintage year.
          - `month` integer: Vintage month.
        - `markets` InstrumentMarket[]: Optional property. Use `include` param.
          - `market` Market
            - `name` string: Name of the market.
            - `apiCode` string: API code for market execution venue.
            - `applicableExecutionVenues` RefExecutionVenue[]
            - `applicablePrograms` RefProgram[]
          - `marketModelInstrument` MarketModelInstrument
            - `ein` string: Environment Instrument Number. Unique identifier associated with an issuance of credits from a given project, vintage, technology/fuel type and associated certification(s)/eligibility(s). An EIN is associated with a position and a position will never be associated with more than 1 EIN.
            - `description` string: Description.
            - `price` MarketModelInstrumentPrice
              - …
        - `creditType` string, required: The type of the credit.
        - `serialNumber` string
        - `issuanceCertifications` IssuanceCertification[]: Optional property. Use `include` param.
          - `code` string: Certification code. Ref.Data.CARBON_CERTIFICATION
          - `vintageYears` integer[]: Vintage years.
        - `projectCertifications` ProjectCertification[]: Optional property. Use `include` param.
          - `code` string: Certification code. Ref.Data.CARBON_CERTIFICATION
          - `projectCertificationDateRanges` object[]
            - `certificationStart` string, date-time: The project certification start date.
            - `certificationEnd` string, date-time: The project certification end date.
        - `reportingPeriodStart` string, date-time: Reporting period start date.
        - `reportingPeriodEnd` string, date-time: Reporting period end date.
        - `project` Project, required
          - `id` integer: The unique XC db identifier for the project or generator.
          - `upn` string: Universal Project Identifier. The unique identifier assigned by Xpansiv Connect to every resource across all registries that have integrated with the Xpansiv Connect platform.
          - `name` string, required: The registry assigned name of the project or generator.
          - `programs` object[], required
            - `program` string, required: Ref.Data.CARBON_PROGRAM
            - `programName` string: Registry name.
            - `registryAssignedId` string, required: ID assigned by the registry.
            - `registryAccountHolderName` string: Name of the registry account holder.
            - `status` string, required: The registry status of the project. Ref.Data.PROJECT_REGISTRY_STATUS
            - `creditType` string, required: The type of the credit. Ref.Data.CARBON_CREDIT_TYPE
            - `projectType` string, required: The project type. Ref.Data.CARBON_PROJECT_TYPE
            - `baselineMethodologies` RefBaselineMethodology[]
            - `creditingPeriodBegin` string, date-time: Begin date for credit reporting.
            - `creditingPeriodEnd` string, date-time: End date for credit reporting.
          - `description` string: The full description from the registry.
          - `status` string: Ref.Data.PROJECT_STATUS
          - `country` string: Ref.Data.COUNTRY
          - `stateProvince` string: State or Province
          - `city` string: City.
          - `location` Location
            - `latitude` number, double: Latitude.
            - `longitude` number, double: Longitude.
          - `annualAverageOffsetQty` integer: Annual average offset quantity.
          - `projectCertifications` ProjectCertification[]: Optional property. Use `include` param.
            - `code` string: Certification code. Ref.Data.CARBON_CERTIFICATION
            - `projectCertificationDateRanges` object[]
              - …
          - `issuanceCertifications` IssuanceCertification[]: Optional property. Use `include` param.
            - `code` string: Certification code. Ref.Data.CARBON_CERTIFICATION
            - `vintageYears` integer[]: Vintage years.
      - RecInstrument
        - `type` string, required: REC or CARBON. Ref.Data.INSTRUMENT_TYPE
        - `id` integer: Unique Xpansiv Connect identifier.
        - `ein` string, required: Environment Instrument Number. Unique identifier associated with an issuance of credits from a given project, vintage, technology/fuel type and associated certification(s)/eligibility(s). An EIN is associated with a position and a position will never be associated with more than 1 EIN.
        - `description` string: The Xpansiv Connect description associated with the instrument providing information regarding location, vintage, fuel type and certifications.
        - `program` string, required: Ref.Data.PROGRAM
        - `vintage` Vintage, required
          - `year` integer, required: Vintage year.
          - `month` integer: Vintage month.
        - `markets` InstrumentMarket[]: Optional property. Use `include` param.
          - `market` Market
            - `name` string: Name of the market.
            - `apiCode` string: API code for market execution venue.
            - `applicableExecutionVenues` RefExecutionVenue[]
            - `applicablePrograms` RefProgram[]
          - `marketModelInstrument` MarketModelInstrument
            - `ein` string: Environment Instrument Number. Unique identifier associated with an issuance of credits from a given project, vintage, technology/fuel type and associated certification(s)/eligibility(s). An EIN is associated with a position and a position will never be associated with more than 1 EIN.
            - `description` string: Description.
            - `price` MarketModelInstrumentPrice
              - …
        - `creditType` string, required: The type of the credit.
        - `fuelType` FuelType
          - `name` string: The fuel type associated with the underlying asset.
          - `type` string: Ref.Data.REC_FUEL_TYPE
          - `fuelSource` string: The registry fuel source associated with the fuel type (registry-dependent).
        - `stateEligibilities` object[]: Optional property. Use `include` param.
          - `name` string: Name of the state eligibility.
          - `type` string: The type of the state eligibility. Ref.Data.REC_STATE_ELIGIBILITY
        - `voluntaryEligibilities` VoluntaryEligibility[]: Optional property. Use `include` param.
          - `name` string: The name of the registry voluntary eligibility.
          - `type` string: The type of the voluntary eligibility. Ref.Data.REC_VOLUNTARY_ELIGIBILITY
          - `effectiveDate` string, date-time: The effective date of the eligibility.
          - `expirationDate` string, date-time: the expiration date of the eligibility.
        - `generator` Generator, required
          - `id` integer: The unique XC db identifier for the project or generator.
          - `upn` string: Universal Project Identifier. The unique identifier assigned by Xpansiv Connect to every resource across all registries that have integrated with the Xpansiv Connect platform.
          - `name` string, required: The registry assigned name of the project or generator.
          - `program` string: Ref.Data.REC_PROGRAM
          - `registryAssignedId` string: The registry assigned identifier for the generator.
          - `status` string: The status of the generator in the registry. Ref.Data.GENERATOR_STATUS
          - `siteCode` string: The Site Code of the generator if provided by the registry.
          - `unitName` string: The Unit Name of the generator in the registry.
          - `controlArea` string: The Control Area that the generator is located in.
          - `parentCompanyName` string: The Parent Company Name of the generator if provided by the registry.
          - `powerCompanyName` string: The Power Company Name of the generator if provided by the registry.
          - `powerCompanyCode` string: The Power Company Code of the generator if provided by the registry.
          - `ownerName` string: The Owner Name of the generator if provided by the registry
          - `ownershipType` string: The Ownership Type of the generator if provided by the registry.
          - `countyName` string: The County Name locatio of the generator if provided by the registry.
          - `stateProvince` string: Ref.Data.STATE_PROVINCE
          - `country` string: Ref.Data.COUNTRY
          - `contactInfo` string: Contact Information for the generator if provided by the registry.
          - `registryAcctHolderName` string: The Registry Account Holder name of the generator if provided by the registry.
          - `commencedDt` string, date-time: The Commenced Operation Date of the generator if provided by the registry.
          - `nameplateCapacity` number, double: The Nameplate Capacity of the generator if provided by the registry.
          - `facNoncompetitiveCertData` string
          - `fuelTypes` object[]: Additional information about a generator if it is multi-fuel. Optional property. Use `include` param.
            - `fuelType` FuelType, required
              - …
            - `stateEligibilities` StateEligibility[]
              - …
            - `voluntaryEligibilities` VoluntaryEligibility[]
              - …
      - ResourceInstrument
        - `type` string, required: REC or CARBON. Ref.Data.INSTRUMENT_TYPE
        - `id` integer: Unique Xpansiv Connect identifier.
        - `ein` string, required: Environment Instrument Number. Unique identifier associated with an issuance of credits from a given project, vintage, technology/fuel type and associated certification(s)/eligibility(s). An EIN is associated with a position and a position will never be associated with more than 1 EIN.
        - `description` string: The Xpansiv Connect description associated with the instrument providing information regarding location, vintage, fuel type and certifications.
        - `program` string, required: Ref.Data.PROGRAM
        - `vintage` Vintage, required
          - `year` integer, required: Vintage year.
          - `month` integer: Vintage month.
        - `markets` InstrumentMarket[]: Optional property. Use `include` param.
          - `market` Market
            - `name` string: Name of the market.
            - `apiCode` string: API code for market execution venue.
            - `applicableExecutionVenues` RefExecutionVenue[]
            - `applicablePrograms` RefProgram[]
          - `marketModelInstrument` MarketModelInstrument
            - `ein` string: Environment Instrument Number. Unique identifier associated with an issuance of credits from a given project, vintage, technology/fuel type and associated certification(s)/eligibility(s). An EIN is associated with a position and a position will never be associated with more than 1 EIN.
            - `description` string: Description.
            - `price` MarketModelInstrumentPrice
              - …
        - `creditType` string, required: The type of the credit.
        - `serialNumber` string
        - `inType` string: Ref.Data.RESOURCE_INPUT_TYPE
        - `outType` string: Ref.Data.RESOURCE_OUTPUT_TYPE
        - `resourceProject` ResourceProject, required
          - `id` integer: The unique XC db identifier for the project or generator.
          - `upn` string: Universal Project Identifier. The unique identifier assigned by Xpansiv Connect to every resource across all registries that have integrated with the Xpansiv Connect platform.
          - `name` string, required: The registry assigned name of the project or generator.
          - `programs` object[], required
            - `program` string, required: Ref.Data.RESOURCE_PROGRAM
            - `programName` string
            - `registryAssignedId` string, required
          - `status` string: Ref.Data.RESOURCE_PROJECT_STATUS
          - `country` string: Ref.Data.COUNTRY
          - `accountName` string
          - `classification1` string
          - `classification2` string
          - `classification3` string
          - `childResourceProject` ChildResourceProject
            - `id` integer: The unique XC db identifier for the project or generator.
            - `upn` string: Universal Project Identifier. The unique identifier assigned by Xpansiv Connect to every resource across all registries that have integrated with the Xpansiv Connect platform.
            - `name` string, required: The registry assigned name of the project or generator.
            - `accountName` string
            - `inOutTypes` object[]
              - …
            - `programs` object[]
              - …
          - `inOutTypes` object[]
            - `inType` string, required: Ref.Data.RESOURCE_INPUT_TYPE
            - `outType` string, required: Ref.Data.RESOURCE_OUTPUT_TYPE
          - `typeName` string
    - `lastUpdatedDate` string, date-time, required: Last updated date.
    - `createdDate` string, date-time, required: Creation date.
    - `quantity` integer, required: Retirement quantity.
    - `status` string, required: Status of the retirement. Ref.Data.RETIREMENT_STATUS
    - `batchIdentifier` string, required: XPC Retirement batch identifier
    - `identifier` string, required: XPC Retirement identifier
    - `externalIdentifier` string: Retirement identifier provided by API client when creating the retirement
    - `registryTransferIdentifier` string: Retirement identifier generated by the program
    - `registryPositionId` string: Id of the retired registry credits
    - `attributes` object
    - `transferTaxLots` object[]: Optional property. Use `include` param.
      - `taxLot` TaxLot, required: A Tax Lot represents the incoming activity that resulted in the creation or increase of a position against an EIN. The types of activities represented by Tax Lots are; imported positions (at account linking); incoming settled bilateral transfers; or credit issuance. Tax Lot is associated with a Position, where 1 or more Tax Lots make up the available quantity for a single Position
        - `id` integer: The unique identifier for the tax lot
        - `name` string: The name of the tax lot, normally made up of tax lot type and established date
        - `establishedDate` string, date-time: The timestamp for when the tax lot was established, meaning when the transaction that created the tax lot was accepted in XC
        - `establishQuantity` integer: The original quantity of credits that created the tax lot. Optional property. Use `include` param.
        - `pricePaid` Price
          - `currency` string, required: Ref.Data.CURRENCY
          - `amount` number, required: The numeric value of the price
        - `availableQuantity` integer: The quantity available of the tax lot for transfer or retirement
        - `encumberedQuantity` integer: The quantity encumbered of the tax lot on an execution venue integrated with XC
        - `unsettledQuantity` integer: The quantity unsettled of the tax lot. This can represent a quantity that is in a bilateral transaction, buy or sell, that is pending and not yet settled in the registry.
        - `estimatedMarketPrice` number: The estimated price associated with the highest value market this tax lot has a certification with where prices have been uploaded from the CBL Exchange. Optional property. Use `include` param.
        - `estimatedMarketValue` number: Using the Estimated Market Price, this represents the estimated market value of the tax lot based on the tax lot position quantity. Optional property. Use `include` param.
        - `estimatedGainLoss` number: Utilizing both Price Paid and Estimated Market Price against tax lot quantity to determine if there was a financial gain or loss for this tax lot. Optional property. Use `include` param.
        - `previousCounterparty` string: The registry name of the counterparty that transferred the credits of this tax lot to the XC client. Optional property. Use `include` param.
        - `externalTradeId` string: An external trade/transaction identifier as provided by the XC client for this position. Optional property. Use `include` param.
        - `dealId` string: A deal Identifier as provided by the XC client for this position if associated with a forward deal delivery. Optional property. Use `include` param.
      - `quantity` integer
  - `batchIdentifier` string, required: EMA retirement batch identifier

## Other responses

- `400`: Bad request
- `401`: Not authorized error
- `500`: Internal server error

---

[API](https://skmtc.dev/xpansiv/apis/xpansiv-connect-api.md) - [All operations](https://skmtc.dev/xpansiv/apis/xpansiv-connect-api/llms.txt) - [OpenAPI document](https://skmtc.dev/xpansiv/apis/xpansiv-connect-api/revisions/01c1f2c4ec1e?raw)
