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

# Queue report export

> Queue a Superadmin CSV report. The returned temporary export can be polled and downloaded for 24 hours, allowing the portal to resume after a browser refresh without maintaining permanent report history.



## OpenAPI

````yaml /api/superadmin.openapi.yaml post /generate-reports/async
openapi: 3.1.0
info:
  title: YouNegotiate Superadmin API
  version: '2.0'
  description: Stateless API endpoints for the Superadmin portal.
servers:
  - url: https://api.hub.younegotiate.com
    description: Production
security: []
tags:
  - name: System
    description: Public superadmin domain system and health endpoints.
  - name: Authentication
    description: Superadmin login, logout, password reset, and password change endpoints.
  - name: Profile
    description: Authenticated superadmin profile endpoints.
  - name: Admin Configuration
    description: Platform configuration values and feature flag controls.
  - name: MailHub Users
    description: Superadmin management for EcoMail Hub / EcoPortal users.
  - name: Super Admin Users
    description: Superadmin management for platform operations users.
  - name: Consumers
    description: Superadmin consumer account list, detail, filter, and export endpoints.
  - name: Creditors
    description: Superadmin creditor account list and account access endpoints.
  - name: Sub Accounts
    description: Superadmin sub account list and export endpoints.
  - name: Reseller Partners
    description: Superadmin reseller partner list and report-history endpoints.
  - name: Special Plan Inquiries
    description: >-
      Superadmin special membership inquiry list, detail, resolve, and close
      endpoints.
  - name: Plans
    description: >-
      Superadmin membership plan list, create, update, reorder, visibility, and
      delete endpoints.
  - name: Failed - Canceled
    description: Superadmin failed or cancelled membership list and custom email endpoints.
  - name: Merchant Requests
    description: >-
      Superadmin merchant API request list, export, email, forwarding, progress,
      and approval endpoints.
  - name: Bill Pay Donations
    description: Superadmin Bill Pay gift donation list, export, and receipt endpoints.
  - name: Export & Reporting
    description: Superadmin generated report options and CSV download endpoints.
  - name: Communications / Templates
    description: >-
      Superadmin email and SMS template management for manual communications and
      campaigns.
  - name: Communications / Groups
    description: >-
      Superadmin communication group management for dynamic consumer targeting
      and campaign selection.
  - name: Communications / Schedule Campaign
    description: >-
      Superadmin email and SMS campaign scheduling, immediate send, and delivery
      queue endpoints.
  - name: Communications / Campaign Tracker
    description: >-
      Superadmin campaign tracker snapshots, refresh actions, and consumer
      exports.
  - name: Automated Communications
    description: >-
      Superadmin automated email/SMS templates, trigger configuration, and
      delivery history endpoints.
paths:
  /generate-reports/async:
    post:
      tags:
        - Export & Reporting
      summary: Queue report export
      description: >-
        Queue a Superadmin CSV report. The returned temporary export can be
        polled and downloaded for 24 hours, allowing the portal to resume after
        a browser refresh without maintaining permanent report history.
      operationId: superadminQueueReportExport
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SuperadminGenerateReportRequest'
            example:
              request_id: 1f4297dd-1466-4d50-812d-d7db59987836
              report_type: super_admin_all_accounts
              company_id: all_members
              start_date: '2026-06-01'
              end_date: '2026-07-28'
      responses:
        '202':
          description: Report export queued, or the existing idempotent export returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuperadminReportExportResponse'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '422':
          $ref: '#/components/responses/ValidationError'
      security:
        - bearerAuth: []
components:
  schemas:
    SuperadminGenerateReportRequest:
      type: object
      additionalProperties: false
      required:
        - report_type
        - start_date
        - end_date
      properties:
        request_id:
          type: string
          format: uuid
          nullable: true
          description: >-
            Optional idempotency key. Reusing it for the same Superadmin returns
            the original temporary export.
          example: 1f4297dd-1466-4d50-812d-d7db59987836
        report_type:
          type: string
          enum:
            - bill_pay_donations_dfa
            - invoicing
            - cogs
            - partner_summary_total
            - partner_members
            - younegotiate_revenue
            - compliance_consumer_pii_opt_out
            - compliance_consumer_disputes_no_pay
            - compliance_auto_expired_deleted_accounts
            - consumer_payments
            - super_admin_all_accounts
          example: bill_pay_donations_dfa
        company_id:
          oneOf:
            - type: string
              enum:
                - all_members
            - type: integer
          nullable: true
          description: >-
            Use `all_members`, omit the field, or pass a company ID from the
            options endpoint.
          example: all_members
        start_date:
          type: string
          format: date
          description: >-
            Start date in YYYY-MM-DD format. The request cannot span more than
            two months.
          example: '2026-06-01'
        end_date:
          type: string
          format: date
          description: >-
            End date in YYYY-MM-DD format. Must be on or after `start_date` and
            not in the future.
          example: '2026-06-30'
    SuperadminReportExportResponse:
      type: object
      additionalProperties: false
      required:
        - data
      properties:
        message:
          type: string
          example: Your report is being prepared.
        data:
          $ref: '#/components/schemas/SuperadminReportExport'
    SuperadminReportExport:
      type: object
      additionalProperties: false
      required:
        - id
        - request_id
        - created_at
        - expires_at
        - report_type
        - company_scope
        - status
        - records
        - download_available
      properties:
        id:
          type: integer
          example: 42
        request_id:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        completed_at:
          type: string
          format: date-time
          nullable: true
        expires_at:
          type: string
          format: date-time
          description: The database state and private CSV are removed after this timestamp.
        report_type:
          type: object
          required:
            - value
            - label
          properties:
            value:
              type: string
            label:
              type: string
        company_scope:
          $ref: '#/components/schemas/SuperadminReportCompanyOption'
        start_date:
          type: string
          format: date
          nullable: true
        end_date:
          type: string
          format: date
          nullable: true
        status:
          type: object
          required:
            - value
            - label
          properties:
            value:
              type: integer
              enum:
                - 0
                - 1
                - 2
              description: 0 Pending, 1 Success, 2 Failed.
            label:
              type: string
              enum:
                - Pending
                - Success
                - Failed
        records:
          type: integer
          example: 150149
        file_name:
          type: string
          nullable: true
        failure_message:
          type: string
          nullable: true
        download_available:
          type: boolean
          example: false
    MessageResponse:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    ValidationErrorResponse:
      type: object
      required:
        - message
        - errors
      properties:
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    SuperadminReportCompanyOption:
      type: object
      additionalProperties: false
      required:
        - value
        - label
      properties:
        value:
          oneOf:
            - type: string
              enum:
                - all_members
            - type: integer
          example: all_members
        label:
          type: string
          example: All Members
  responses:
    Unauthenticated:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageResponse'
    ValidationError:
      description: Request validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Sanctum token

````