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

# Create a report

> Generates a report. You can create reports with historical data for all report types. [Balance reports](#balance-reports) can be snapshots of historical or current data.

Reports provide batches of historic information about your profile in various human and machine readable forms.

<Info>
  A report is generated when resources are available. You can poll the report resource endpoint at `/reports/{report_id}` for its status. When status is `ready`, the final report is uploaded and available at `{file_url}`.
</Info>

## API Key Permissions

This endpoint requires either the "view" or "trade" permission.

## Expired reports

Reports are only available for download for a few days after being created. Once a report expires, the report is no longer available for download and is deleted.

## Balance Reports

Balance statements represent historical or current point-in-time “snapshots” in native and fiat converted units. Balance statement reports:

* Can be generated for a **specific portfolio (API and [UI](https://exchange.coinbase.com/profile/statements)) or all portfolios (UI only)**. In the UI, all portfolios can be **grouped by portfolio or asset** (with balances totaled across portfolios).

* Include **balances for crypto and fiat assets** supported on the Exchange (USD, EUR, GBP).

* Include balances in both **native units** (e.g., 1 BTC) **as well as fiat-converted units assets** (e.g., \$20000 USD worth of BTC) where price data is available.

* Are generated for **all assets (crypto and fiat) in the user’s account** as of the requested timestamp. They cannot be generated for a specific asset (as is possible with the account and fill reports).

<Warning>
  API calls are tied to a specific portfolio but you can group by all portfolios in the UI.
</Warning>

### Timestamps

* **Range:** Timestamps are UTC-exclusive. For example, to generate a balance as of December 31st, 2022 EOD UTC (11:59:59 PM UTC), input January 1st, 2023 12:00:00 AM UTC.

* **Granularity**: The API is the most granular and lets you specify a timestamp to the very second. The UI lets you specify the day and hour.

### Fiat Conversion

* **For fiat balances** (USD, EUR, GBP), the conversion price is 1:1 and is reported in that specific fiat currency. EUR/GBP is not converted to USD balance.

* **For crypto balances** the conversion price is the volume weighted average of closing prices in USD (when available). It is calculated by fetching 1 hour [candles](/api-reference/exchange-api/rest-api/products/get-product-candles) between \[t-24 hours to t] and taking a volume weighted average of the closing price of the candles (when available).

  * Requested timestamp = t; Start range = t - 24 hours; End range = t
  * Candles may not be available; e.g., delisted assets may not have candles at the requested timestamp.
  * If a USD pair is not listed for trading at the requested timestamp, fiat conversion is not possible.

### Request Details

The Balance Report API:

* Leverages the existing `/reports` endpoint.
* Adds a new report type of `balance`.
* Adds a `balance` object to the request with `datetime` (and `group_by_portfolio_id` for the UI only).
* Keeps the same response schema (with the possibility that `"type"="balance"`).

*Example of Balance Report API Request*

```json lines wrap theme={null}
// Create balance statement for the portfolio tied to the API key
{
  "balance": {
    "datetime": "2022-02-25T05:00:00.000Z"
  },
  "email": "user1@example.com",
  "format": "csv",
  "type": "balance"
}
```


## OpenAPI

````yaml POST /reports
openapi: 3.0.1
info:
  title: REST API
  description: >-
    # Welcome to Coinbase Exchange API

    ## Introduction

    The Exchange Trading APIs allow institutions to place orders and access
    account information. The following API pages detail various REST API
    endpoints we offer for lower-frequency trading and general requests.

    ## Getting Started

    To get started, please visit one of the following pages:

    - [Authentication](/exchange/docs/rest-auth)

    - [Rate Limits](/exchange/docs/rest-rate-limits)

    - [Pagination](/exchange/docs/rest-pagination)

    - [Status Codes](/exchange/docs/rest-requests)

    - [Quickstart](/exchange/docs/getting-started)

    ## FIX API

    - [FIX API reference](/exchange/docs/fix-connectivity)

    ## WebSocket API

    - [WebSocket API reference](/exchange/docs/websocket-overview)
  version: '1.0'
servers:
  - url: https://api.exchange.coinbase.com/
security:
  - ApiKeyAuthKey: []
    ApiKeyAuthPassphrase: []
    ApiKeyAuthSign: []
    ApiKeyAuthTimestamp: []
paths:
  /reports:
    post:
      tags:
        - Reports
      summary: Create a report
      description: >-
        Generates a report. You can create reports with historical data for all
        report types. [Balance reports](#balance-reports) can be snapshots of
        historical or current data.
      operationId: ExchangeRESTAPI_PostReports
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/apiPostReportsRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiReportCreateResult'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiUnauthorizedResponse'
        '500':
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiErrorResponse'
components:
  schemas:
    apiPostReportsRequest:
      required:
        - type
      type: object
      properties:
        type:
          type: string
          description: >-
            Type of report to generate. Possible values: [`account`, `balance`,
            `fills`, `otc-fills`, `rfq-fills`, `tax-invoice`,
            `1099k-transaction-history`]
        year:
          type: string
          description: required for `1099k-transaction-history`-type reports
        format:
          $ref: '#/components/schemas/apiReportFormat'
        email:
          type: string
          description: Email to send generated report notification to
        profile_id:
          type: string
          description: >-
            If this field is specified, it must be the `profile_id` that is
            linked to the API key.
        balance:
          $ref: '#/components/schemas/apiBalanceReport'
        fills:
          $ref: '#/components/schemas/apiFillsReport'
        account:
          $ref: '#/components/schemas/apiAccountReport'
        otc_fills:
          $ref: '#/components/schemas/apiOtcFillsReport'
        tax_invoice:
          $ref: '#/components/schemas/apiTaxInvoiceReport'
        rfq_fills:
          $ref: '#/components/schemas/apiRfqFillsReport'
      example:
        type: account
        format: pdf
        email: user1@example.com
        profile_id: 8058d771-2d88-4f0f-ab6e-299c153d4308
        account:
          start_date: '2020-02-25T03:11:42.164Z'
          end_date: '2020-03-26T02:11:42.164Z'
          account_id: ALL
    apiReportCreateResult:
      required:
        - id
        - status
        - type
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        status:
          $ref: '#/components/schemas/apiReportCreateResultReportStatus'
    apiUnauthorizedResponse:
      type: object
      properties:
        message:
          title: message
          pattern: ^[a-zA-Z0-9]{1, 32}$
          type: string
      description: >-
        UnauthorizedResponse is the response message for endpoints in
        rest-gateway that requires authentication.

        This message is used to generate the Exchange REST API documentation
        using OpenAPI format.
    apiErrorResponse:
      type: object
      properties:
        message:
          title: message
          pattern: ^[a-zA-Z0-9]{1, 32}$
          type: string
    apiReportFormat:
      type: string
      default: pdf
      enum:
        - pdf
        - csv
    apiBalanceReport:
      type: object
      properties:
        datetime:
          type: string
          description: >-
            Designated date and time of the balance statement. Timezone is
            always UTC. If this field is empty, a report of the user’s current
            balance will be generated.
        group_by_profile:
          type: boolean
          description: >-
            Not applicable if generating report through an API key; only
            available through report generation via the Exchange user interface
            (UI).
    apiFillsReport:
      type: object
      properties:
        start_date:
          type: string
          description: Start date for items to be included in report.
          default: <30 days ago from end_date>
        end_date:
          type: string
          description: End date for items to be included in report
          default: <today>
        product_id:
          type: string
          description: Product - Which product to generate the report for
    apiAccountReport:
      type: object
      properties:
        start_date:
          type: string
          description: Start date for items to be included in report.
          default: <30 days ago from end_date>
        end_date:
          type: string
          description: End date for items to be included in report
          default: <today>
        account_id:
          type: string
          description: Account - Which account to generate the report for
    apiOtcFillsReport:
      type: object
      properties:
        start_date:
          type: string
          description: Start date for items to be included in report.
          default: <30 days ago from end_date>
        end_date:
          type: string
          description: End date for items to be included in report
          default: <today>
        product_id:
          type: string
          description: Product - Which product to generate the report for
    apiTaxInvoiceReport:
      type: object
      properties:
        start_date:
          type: string
          description: Start date for items to be included in report.
          default: <30 days ago from end_date>
        end_date:
          type: string
          description: End date for items to be included in report
          default: <today>
        product_id:
          type: string
          description: Product - Which product to generate the report for
    apiRfqFillsReport:
      type: object
      properties:
        start_date:
          type: string
          description: Start date for items to be included in report.
          default: <30 days ago from end_date>
        end_date:
          type: string
          description: End date for items to be included in report
          default: <today>
        product_id:
          type: string
          description: Product - Which product to generate the report for
    apiReportCreateResultReportStatus:
      type: string
      default: pending
      enum:
        - pending
  securitySchemes:
    ApiKeyAuthKey:
      type: apiKey
      name: cb-access-key
      in: header
    ApiKeyAuthPassphrase:
      type: apiKey
      name: cb-access-passphrase
      in: header
    ApiKeyAuthSign:
      type: apiKey
      name: cb-access-sign
      in: header
    ApiKeyAuthTimestamp:
      type: apiKey
      name: cb-access-timestamp
      in: header

````