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

# Legacy Report Testing

> Generate single-use test reports using the legacy CodeRabbit API. Learn how to create API keys and make test sample report requests programmatically.

export const ProPlanBadge = ({tip = "This feature is available as part of the Pro, Pro+ and Enterprise plans. Please refer to our pricing page for more information about our plans and features.", title = "Pro Plan", cta = "Read more", href = "https://coderabbit.ai/pricing", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="shield-check" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

export const DeprecatedBadge = ({tip = "This feature is deprecated and may be removed in a future release.", title = "Deprecated", cta = "View alternatives", href, disabled = false}) => {
  return <Tooltip tip={tip} cta={href ? cta : undefined} href={href}>
        <Badge icon="clock-alert" color="orange" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

<ProPlanBadge />

<DeprecatedBadge href="/guides/scheduled-reports" />

<Accordion title="All instructions for generating test sample reports">
  ## Overview

  Generate single-use reports instantly using the CodeRabbit API. API generated reports are ideal for testing report formats or getting quick insights without setting up recurring schedules.

  <Tip>
    For a conceptual overview of reports in CodeRabbit, see [Generate
    reports](/management/reports).
  </Tip>

  ## API access

  CodeRabbit offers a way to generate api reports using the [CodeRabbit API](/api-reference/report-generate). You will need an API Key to access the CodeRabbit API and generate an api report.

  ## Create an API key

  <Steps>
    <Step title="Navigate to API Keys">
      Sign in to your CodeRabbit account and navigate to the [**API
      Keys**](https://app.coderabbit.ai/settings/api-keys) page under
      'Organization Settings' in the left sidebar
    </Step>

    <Step title="Create new key">
      Click on the **Create API Key** button and enter a name for the API Key
    </Step>

    <Step title="Save your key">
      Copy the API key, and keep it safe as it won't be visible again
    </Step>
  </Steps>

  <img src="https://mintcdn.com/coderabbit/D_rqUjBaYiE185JH/images/guides/assets/images/api_keys-b7e09b7dc03a5d8ceb09d1db0a8dc12c.png?fit=max&auto=format&n=D_rqUjBaYiE185JH&q=85&s=61f3c9bbc600d194a56437f27715f3a2" alt="API Keys" width="1920" height="1080" data-path="images/guides/assets/images/api_keys-b7e09b7dc03a5d8ceb09d1db0a8dc12c.png" />

  ## Generate an api report

  Once you have the API key, pass it in the `x-coderabbitai-api-key` header when calling the API:

  ```bash theme={null}
  curl -X 'POST' \
    'https://api.coderabbit.ai/api/v1/report.generate' \
    -H 'accept: application/json' \
    -H 'x-coderabbitai-api-key: cr-xxxxxxxxxxxxx' \
    -H 'Content-Type: application/json' \
    -d '{
      "from": "2024-05-01",
      "to": "2024-05-15"
    }'
  ```

  ### Sample response

  ```json JSON wrap icon="code" theme={null}
  [
  	{
  		"group": "Developer Activity",
  		"report": "*Developer Activity*:\n\n 🟢 **Update README.md** [#10](https://gitlab.com/master-group123/sub-group/project1/-/merge_requests/10)\n• Summary: The change updates the project description and modifies a section header for clearer instructions.\n• Last activity: 1 day ago, mergeable\n• Insights:\n - :magnifying_glass: @user2 Suggested updating the wording to make it clearer"
  	}
  ]
  ```

  <Info>
    If you get a 401 UNAUTHORIZED error, check if you're passing the right API key
    in the `x-coderabbitai-api-key` header
  </Info>

  ### API schema

  The on-demand report generation endpoints take in inputs as per the schema shown below:

  <Card title="API Reference" icon="code" href="/api-reference/report-generate">
    View complete API documentation and request/response schemas
  </Card>
</Accordion>

## What's next

<CardGroup cols={1}>
  <Card title="Customize reports" icon="paintbrush" href="/guides/custom-reports" horizontal>
    Learn how to create custom report formats and prompts
  </Card>

  <Card title="Scheduled reports" icon="calendar" href="/guides/scheduled-reports" horizontal>
    Set up automated recurring reports for regular monitoring
  </Card>
</CardGroup>
