---
title: "Create diff scan from full scan IDs"
method: POST
path: "/orgs/{org_slug}/diff-scans/from-ids"
tags: ["diff-scans"]
---

# Create diff scan from full scan IDs

`POST /orgs/{org_slug}/diff-scans/from-ids`

Create a diff scan from two existing full scan IDs. The full scans must be in the same repository.
Returns metadata about the diff scan. Once the diff scan is created, fetch the diff scan from
the [api_url](/reference/getDiffScanById) URL to get the contents of the diff.

This endpoint consumes 1 unit of your quota.

This endpoint requires the following org token scopes:
      - diff-scans:create
- full-scans:list

## Path parameters

- `org_slug` string, required

## Query parameters

- `before` string, required
- `after` string, required
- `description` string
- `external_href` string
- `merge` boolean
- `on_duplicate` string

## Response `201`

The details of the created diff scan.

- object
  - `diff_scan` object, required
    - `id` string, required — The ID of the diff scan.
    - `organization_id` string, required — The ID of the organization that owns the diff scan.
    - `repository_id` string, required — The ID of the repository the diff scan was run against.
    - `created_at` string, required — ISO 8601 timestamp of when the diff scan was created.
    - `updated_at` string, required — ISO 8601 timestamp of when the diff scan was last updated.
    - `before_full_scan` object, required
      - `id` string, required
      - `created_at` string, required
      - `updated_at` string, required
      - `organization_id` string, required
      - `organization_slug` string, required
      - `repository_id` string, required
      - `repository_slug` string, required
      - `branch` string, nullable, required
      - `commit_message` string, nullable, required
      - `commit_hash` string, nullable, required
      - `pull_request` integer, nullable, required
      - `committers` string[], required
      - `html_url` string, nullable, required
      - `api_url` string, nullable, required
    - `after_full_scan` object, required
      - `id` string, required
      - `created_at` string, required
      - `updated_at` string, required
      - `organization_id` string, required
      - `organization_slug` string, required
      - `repository_id` string, required
      - `repository_slug` string, required
      - `branch` string, nullable, required
      - `commit_message` string, nullable, required
      - `commit_hash` string, nullable, required
      - `pull_request` integer, nullable, required
      - `committers` string[], required
      - `html_url` string, nullable, required
      - `api_url` string, nullable, required
    - `description` string, nullable, required — Human readable description of the diff scan, e.g. the pull request title.
    - `external_href` string, nullable, required — Link to the external resource the diff scan was created for, e.g. the pull request URL.
    - `merge` boolean, required — True when the diff scan was created for a merge event rather than an open pull request.
    - `html_url` string, nullable, required — Link to the diff scan report in the Socket dashboard.
    - `api_url` string, nullable, required — Link to the diff scan resource in the Socket API.

## Other responses

- `302` — Redirects to the existing diff scan when on_duplicate=redirect is set and a duplicate is detected.
- `400` — Bad request
- `401` — Unauthorized
- `403` — Insufficient max_quota for API method
- `404` — Resource not found
- `409` — Resource already exists
- `429` — Insufficient quota for API route

---

[API](https://skmtc.dev/socket-dev/apis/socket.md) · [All operations](https://skmtc.dev/socket-dev/apis/socket/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/socket-dev/socket/revisions/bf994b75d33f/schema)
