# Quickstart

> Integrate with the Copyleaks API in about five minutes. This guide covers authenticating, submitting a document, and reading your first AI detection result.

This guide walks you through your first integration with the [Copyleaks API](https://copyleaks.com/api): authenticating, submitting text, and interpreting an AI detection result. It takes about five minutes.

<Steps>

  <Step title="Create your account">
    To follow this guide you will need:
    - An active Copyleaks account. If you don't have one, **[sign up for free](https://api.copyleaks.com/signup)**.
    - Your API key, available on the **[API Dashboard](https://api.copyleaks.com/dashboard)**.
  </Step>

  <Step title="Install your tools">
    <InstallSDKs />
  </Step>

  <Step title="Authenticate">
    Every request must be authorized with an access token. Generate one by calling the [login](/reference/actions/account/login) endpoint with your email and API key, both available on the [API Dashboard](https://api.copyleaks.com/dashboard).

    The token is returned in the response and must be sent on every subsequent request via the `Authorization: Bearer <ACCESS_TOKEN>` header. It remains valid for 48 hours.

    <CodeGroup>
        ```http title="HTTP" icon="globe"
        POST https://id.copyleaks.com/v3/account/login/api
        Content-Type: application/json

        {
          "email": "your@email.address",
          "key": "00000000-0000-0000-0000-000000000000"
        }
        ```
        ```bash title="cURL" icon="terminal"
        export COPYLEAKS_EMAIL="your@email.address"
        export COPYLEAKS_API_KEY="your-api-key-here"

        curl --request POST \
          --url https://id.copyleaks.com/v3/account/login/api \
          --header 'Accept: application/json' \
          --header 'Content-Type: application/json' \
          --data "{
            \"email\": \"${COPYLEAKS_EMAIL}\",
            \"key\": \"${COPYLEAKS_API_KEY}\"
          }"
        ```
        ```python title="Python" icon="python"
        from copyleaks.copyleaks import Copyleaks

        EMAIL_ADDRESS = "your@email.address"
        API_KEY = "your-api-key-here"

        auth_token = Copyleaks.login(EMAIL_ADDRESS, API_KEY)
        print("Access token:", auth_token)
        ```
        ```javascript title="JavaScript" icon="square-js"
        const { Copyleaks } = require("plagiarism-checker");

        const EMAIL_ADDRESS = "your@email.address";
        const API_KEY = "your-api-key-here";
        const copyleaks = new Copyleaks();

        const auth = await copyleaks.loginAsync(EMAIL_ADDRESS, API_KEY);
        console.log("Access token:", auth.access_token);
        ```
        ```java title="Java" icon="java"
        import com.copyleaks.sdk.api.Copyleaks;

        String EMAIL_ADDRESS = "your@email.address";
        String API_KEY = "00000000-0000-0000-0000-000000000000";

        try {
            String authToken = Copyleaks.login(EMAIL_ADDRESS, API_KEY);
            System.out.println("Access token: " + authToken);
        } catch (CommandException e) {
            System.out.println("Login failed: " + e.getMessage());
            System.exit(1);
        }
        ```
    </CodeGroup>

    A successful request returns the token and its lifetime:

    ```json Response
    {
      "access_token": "<ACCESS_TOKEN>",
      ".issued": "2025-07-31T10:19:40.0690015Z",
      ".expires": "2025-08-02T10:19:40.0690016Z"
    }
    ```

    <Note>
    Store the token securely and reuse it for the next 48 hours rather than logging in before every request.
    </Note>
  </Step>

  <Step title="Detect AI-generated text">
    Submit text to the [AI Content Detector](/reference/actions/writer-detector/check). The examples below run in **sandbox mode** (`"sandbox": true`), which returns simulated results so you can test your integration for free. Set `sandbox` to `false` for real detection, which consumes credits.

    Replace `<ACCESS_TOKEN>` with the token from the previous step. The text must be at least 255 characters, and each scan requires a unique [scan ID](/concepts/management/choosing-scan-id) (`my-first-scan` below).

    <CodeGroup>
        ```http title="HTTP" icon="globe"
        POST https://api.copyleaks.com/v2/writer-detector/my-first-scan/check
        Authorization: Bearer <ACCESS_TOKEN>
        Content-Type: application/json

        {
          "text": "Artificial intelligence has revolutionized numerous industries by automating complex tasks and providing data-driven insights. Machine learning algorithms can analyze vast datasets to identify patterns that humans might miss. In healthcare, AI assists with diagnosis and drug discovery.",
          "sandbox": true
        }
        ```
        ```bash title="cURL" icon="terminal"
        curl --request POST \
          --url "https://api.copyleaks.com/v2/writer-detector/my-first-scan/check" \
          --header "Authorization: Bearer <ACCESS_TOKEN>" \
          --header "Content-Type: application/json" \
          --data '{
            "text": "Artificial intelligence has revolutionized numerous industries by automating complex tasks and providing data-driven insights. Machine learning algorithms can analyze vast datasets to identify patterns that humans might miss. In healthcare, AI assists with diagnosis and drug discovery.",
            "sandbox": true
          }'
        ```
        ```python title="Python" icon="python"
        from copyleaks.models.submit.ai_detection_document import NaturalLanguageDocument

        scan_id = "my-first-scan"
        sample_text = (
            "Artificial intelligence has revolutionized numerous industries by automating "
            "complex tasks and providing data-driven insights. Machine learning algorithms "
            "can analyze vast datasets to identify patterns that humans might miss. In "
            "healthcare, AI assists with diagnosis and drug discovery."
        )

        document = NaturalLanguageDocument(sample_text)
        document.set_sandbox(True)

        response = Copyleaks.AiDetectionClient.submit_natural_language(auth_token, scan_id, document)
        print("AI score:", response["summary"]["ai"] * 100, "%")
        ```
        ```javascript title="JavaScript" icon="square-js"
        const { CopyleaksNaturalLanguageSubmissionModel } = require("plagiarism-checker");

        const scanId = "my-first-scan";
        const sampleText =
          "Artificial intelligence has revolutionized numerous industries by automating complex tasks and providing data-driven insights. Machine learning algorithms can analyze vast datasets to identify patterns that humans might miss. In healthcare, AI assists with diagnosis and drug discovery.";

        const submission = new CopyleaksNaturalLanguageSubmissionModel(sampleText);
        submission.sandbox = true;

        const response = await copyleaks.aiDetectionClient.submitNaturalTextAsync(auth, scanId, submission);
        console.log("AI score:", response.summary.ai * 100, "%");
        ```
        ```java title="Java" icon="java"
        import com.copyleaks.sdk.api.models.AiDetectionDocument;
        import com.copyleaks.sdk.api.models.AiDetectionResponse;

        String scanId = "my-first-scan";
        String sampleText = "Artificial intelligence has revolutionized numerous industries by automating complex tasks and providing data-driven insights. Machine learning algorithms can analyze vast datasets to identify patterns that humans might miss. In healthcare, AI assists with diagnosis and drug discovery.";

        AiDetectionDocument submission = new AiDetectionDocument(sampleText);
        submission.setSandbox(true);

        try {
            AiDetectionResponse response = Copyleaks.aiDetectionClient.submitNaturalLanguage(authToken, scanId, submission);
            System.out.println("AI score: " + response.getSummary().getAi());
        } catch (CommandException e) {
            System.out.println("Error: " + e.getMessage());
        }
        ```
    </CodeGroup>

    The response classifies the text and reports an overall AI probability:

    ```json Response
    {
      "modelVersion": "v5",
      "results": [
        { "classification": 2, "probability": 0.99 }
      ],
      "summary": { "ai": 0.99, "human": 0.01 }
    }
    ```

    `summary.ai` is the overall probability that the text is AI-generated, from `0` to `1`. Each entry in `results` classifies a section of the text: a `classification` of `2` indicates AI-generated and `1` indicates human-written, with `probability` as the confidence for that section.
  </Step>

</Steps>

## Recap

You have completed your first integration. In this guide you:

- Authenticated with the Copyleaks API and received a 48-hour access token.
- Submitted text to the AI Content Detector in sandbox mode.
- Interpreted the classification and AI probability in the response.

To run against live detection, set `sandbox` to `false`. Note that production scans consume credits.

## Next steps

<CardGroup cols={2}>
  <Card title="Check for Plagiarism" icon="magnifying-glass" href="/guides/authenticity/detect-plagiarism-text">
    Detect plagiarism in text documents using the Copyleaks API. Search billions of sources to find unoriginal content.
  </Card>
  <Card title="Detect AI-Generated Content" icon="robot" href="/guides/ai-detector/ai-text-detection">
    Detect AI-generated text via sync or async API calls. This guide covers sync detection; see the Authenticity API guide for async.
  </Card>
  <Card title="Assess Grammar and Writing Quality" icon="spell-check" href="/guides/writing/check-grammar">
    Get writing and grammar suggestions via API. Authenticate, submit text, and access full details in the docs.
  </Card>
  <Card title="Moderate Text" icon="shield-halved" href="/guides/moderation/moderate-text">
    Scan and moderate text content for unsafe or policy-relevant material across 10+ categories.
  </Card>
</CardGroup>

<Card title="Ready to scale beyond the basics?" icon="calendar-days" href="https://copyleaks.com/book-a-demo" cta="Book a demo" arrow="true">
  Get a personalized demo and discover how to process thousands of documents seamlessly, integrate Copyleaks into your existing systems, and achieve enterprise-grade accuracy for your specific use case.
</Card>
