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

# Quickstart

> Getting started with our API for deepfake detection

<Warning>
  **Note:** The Reality Defender team now recommends leveraging the [Reality Defender SDKs](../sdks/quickstart) for building most integrations. Consider checking if your preferred language is included in Reality Defender's suite of SDKs.
</Warning>

## Welcome

It's easy to get started with the Reality Defender API. With a couple simple lines of code, you can upload files to Reality Defender!

## Authentication

The Reality Defender API uses a secure and straightforward authentication mechanism via the X-API-KEY header.
Every API request must include your unique API key in this header to authenticate and authorize your access to the platform's features and resources.

You will need access to the Reality Defender web platform to generate an API key.
Navigate to our [API key settings](https://app.realitydefender.ai/settings/manage-api-keys) to create a key.

<Note>
  API keys are linked to a user. Organization administrators can view uploads from all users, but only uploads for a given user show up by default in the [Dashboard](https://app.realitydefender.ai/dashboard).
</Note>

## Request a signed URL

You must request a signed URL to which you will upload your file.

<CodeGroup>
  ```curl curl theme={null}
  curl --location 'https://api.prd.realitydefender.xyz/api/files/aws-presigned' \
  --header 'X-API-KEY: your-api-key-here' \
  --header 'Content-Type: application/json' \
  --data '{
      "fileName": "your-file-path-here"
  }'
  ```

  ```python python theme={null}
  import requests 

  file_path = "your-file-path-here"
  url = "https://api.prd.realitydefender.xyz/api/files/aws-presigned"
  payload = {
      "fileName": file_path
  }
  headers = {
      "X-API-KEY": "your-api-key-here",
      "Content-Type": "application/json"
  }
  response = requests.post(url, json=payload, headers=headers)  
  signed_url = response.json().get("response", {}).get("signedUrl") 
  print(signed_url)
  ```
</CodeGroup>

## Upload a file to the signed URL

Next, upload a file to the signed URL that you received in the prior step.

<Tip>
  When uploading the file, you should only pass in the file itself. You do not need to include any other headers or metadata.
</Tip>

<CodeGroup>
  ```curl curl theme={null}
  # The @ prefix is required to upload the file content (works on all platforms: macOS, Linux, Windows)
  # For filenames with spaces or special characters, wrap the entire @filename in quotes
  curl --location --request PUT "your-signed-url-here" \
  --data-binary '@your-file.mp4'
  ```

  ```python python theme={null}
  import requests

  file_path = "your-file-path-here"
  signed_url = "your-signed-url-here"
  with open(file_path, 'rb') as file:
          file_data = file.read()
  response = requests.put(signed_url, data=file_data, timeout=20)
  print(response)
  ```
</CodeGroup>

## Request a result

Finally, now that you've uploaded a file, you can request a result. You will need the `request_id` that is returned from the prior step.

<Warning>
  Larger files may take longer to analyze. You need to poll the API until the results returns, or set up a webhook.
</Warning>

<CodeGroup>
  ```curl curl theme={null}
  curl --location 'https://api.prd.realitydefender.xyz/api/media/users/{request_id}' \
  --header 'X-API-KEY: your-api-key-here' \
  --header 'Content-Type: application/json'
  ```

  ```python python theme={null}
  import requests 

  url = "https://api.prd.realitydefender.xyz/api/media/users/{request_id}"             
  headers = {
      "X-API-KEY": "your-api-key-here",
      "Content-Type": "application/json"
  }
  response = requests.get(url, headers=headers).json()
  print(response)
  ```
</CodeGroup>

## Interpreting the results

The Reality Defender API returns a lot of detailed information about our deepfake detection results. However, it's recommended to focus specifically on the ensemble results. View our [Media Detail](api-reference/endpoint/get_media_detail) documentation for more detail.
