# Best Practices for Working with Texts & Documents

> Optimize Copyleaks scan performance with data compression, feature management, and submission strategies for the text and document APIs.

Copyleaks is designed for **scalability and high performance**, handling large workloads efficiently. To get the best results from your integration, follow these best practices to **optimize speed, reduce bottlenecks, and maximize efficiency**. 

This guide covers best practices for **text and document scanning** using the Authenticity, Grammar Checker, Text Moderation and AI Text Detector APIs. For image-specific optimization, see the [Image Detection Best Practices](/concepts/performance/image-best-practices) guide.

## Use Network Data Compression

Transmitting large amounts of data over the internet **slows down** performance. **Compressing data** can reduce payload size by **up to 70%**, speeding up processing times.  

### Enable Request Compression  
Compress the data before sending it to Copyleaks and add this header:  
```http
Content-Encoding: gzip
```
This is **especially useful** when submitting large files.  

### Enable Response Compression
To receive compressed responses from Copyleaks, include this header in your request:  
```http
Accept-Encoding: gzip
```
This ensures faster data transfer between your system and Copyleaks.  

## Disable Unused Features

Copyleaks offers **many configurable features**, but enabling unnecessary ones can **slow down** scans. Only enable what you need.  

Some features to **disable if not needed**:  

| Feature | Description | Recommendation |
|---------|------------|---------------|
| `properties.includeHtml` | Includes results in **HTML format** | Disable if plain text is enough. |
| `properties.pdf.create` | Generates a **PDF report** | Turn off if you don’t need a PDF. |
| `properties.expiration` | Defines how long scan data is stored | Use **7 days or less** for optimal speed. |
| `properties.filters` | Narrows search results | Customize filters to **improve scan efficiency**. |

<Note>
Check the [Authenticity API methods](/reference/actions/authenticity/overview) for the full list of features you can toggle.  
</Note>
## Submit Scans at an Optimal Rate

Copyleaks runs on cloud infrastructure, dynamically scaling resources based on demand. However, submitting too many requests at once can reduce efficiency.  

### Avoid Overloading the System
- Instead of submitting all documents at once, send them gradually at a controlled rate (`N` calls per second).  
- If handling large volumes (e.g., 1M+ files), adjust to the maximum allowed rate limit (see [Rate Limit Policy](/reference/data-types/authenticity/technical-specifications)).  

### Prevent Slow Start Issues
- Don’t flood the system with a sudden burst of requests.  
- Instead, start with a low rate and gradually increase to maintain stable performance.  

<Note>
Custom plans are available for large-scale users who need higher limits. Contact [support@copyleaks.com](mailto:support@copyleaks.com) to discuss options.
</Note>
## Adjust Sensitivity for Speed vs. Accuracy

Copyleaks supports different **sensitivity levels**, balancing **speed** and **comprehensiveness** based on your needs.  

Set the **`properties.sensitivityLevel`** value based on priority:  

| Level | Focus | Best For |
|-------|-------|---------|
| `1` | **Speed** | Quicker scans, less comprehensive. |
| `3` *(default)* | **Balanced** | Recommended for most use cases. |
| `5` | **Comprehensive** | Deep analysis, high accuracy. |

<Note>
We recommend level `3` for most users, but feel free to adjust as needed.  
</Note>
## Reuse Your Authentication Token

Each **JWT token** generated during login is **valid for 48 hours**.  

<Tip>
Avoid unnecessary login calls, reuse your token for multiple requests within its validity period.  
</Tip>
For more information on obtaining a new token, refer to the **[Login API](/reference/actions/account/login)**.  

## Next Steps

<CardGroup cols={2}>
  <Card title="Image Detection Best Practices" icon="image" href="/concepts/performance/image-best-practices/">Learn optimization strategies specific to AI Image Detection API.</Card>
  <Card title="Authenticity API Overview" icon="code" href="/reference/actions/authenticity/overview/">Explore the full list of features and options available for configuring your scans.</Card>
  <Card title="Technical Specifications" icon="gauge-high" href="/reference/data-types/authenticity/technical-specifications/">Understand the rate limit policy and other technical specifications for optimal API usage.</Card>
  <Card title="Login API" icon="key" href="/reference/actions/account/login/">Learn how to obtain and manage your authentication token for API access.</Card>
</CardGroup>
