Skip to content

GitHub: Create a snapshot of dependencies for a repository

GitHub dependencyGraph.dependencyGraphCreateRepositorySnapshot: arguments, response, policy and SDK examples.

← Dependency graph operations · Get started

Operation github.dependency_graph_create_repository_snapshot

Provider route: POST /repos/{owner}/{repo}/dependency-graph/snapshots. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/github with npm, or alter-sdk-github with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { GitHubIntegration } from "@alter-ai/github";
async function execute(input: Parameters<GitHubIntegration["dependencyGraph"]["dependencyGraphCreateRepositorySnapshot"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new GitHubIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.dependencyGraph.dependencyGraphCreateRepositorySnapshot(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_github import GitHubIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = GitHubIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.dependency_graph.dependency_graph_create_repository_snapshot(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.ownerstringRequired within parent
path.repostringRequired within parent
bodyModelRequired within parentExpand Create a snapshot of dependencies for a repository — request body — body

Referenced models: Create a snapshot of dependencies for a repository — request body — body

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$objectRoot
created_atstringRequired within parentThe time at which the snapshot was created.
idJSONRequired within parent
id (anyOf 1)integerAlternativeID of the created snapshot.
id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
messagestringRequired within parentA message providing further details about the result, such as why the dependencies were not updated.
resultstringRequired within parentEither “SUCCESS”, “ACCEPTED”, or “INVALID”. “SUCCESS” indicates that the snapshot was successfully created and the repository’s dependencies were updated. “ACCEPTED” indicates that the snapshot was successfully created, but the repository’s dependencies were not updated. “INVALID” indicates that the snapshot was malformed.
Create a snapshot of dependencies for a repository — request body — body
FieldTypePresenceDescription and constraints
$objectRootCreate a new snapshot of a repository's dependencies.
Additional keys: not allowed
detectorobjectRequired within parentA description of the detector used.
Additional keys: not allowed
detector.namestringRequired within parentThe name of the detector used.
detector.urlstringRequired within parentThe url of the detector used.
detector.versionstringRequired within parentThe version of the detector used.
jobobjectRequired within parentAdditional keys: not allowed
job.correlatorstringRequired within parentCorrelator provides a key that is used to group snapshots submitted over time. Only the "latest" submitted snapshot for a given combination of `job.correlator` and `detector.name` will be considered when calculating a repository's current dependencies. Correlator should be as unique as it takes to distinguish all detection runs for a given "wave" of CI workflow you run. If you're using GitHub Actions, a good default value for this could be the environment variables GITHUB_WORKFLOW and GITHUB_JOB concatenated together. If you're using a build matrix, then you'll also need to add additional key(s) to distinguish between each submission inside a matrix variation.
job.html_urlstringOptionalThe url for the job.
job.idstringRequired within parentThe external ID of the job.
manifestsobjectOptionalA collection of package manifests, which are a collection of related dependencies declared in a file or representing a logical group of dependencies.
Additional keys: see wildcard field
manifests.*ModelAdditional keysExpand Create a snapshot of dependencies for a repository — request body — body manifests value
metadataModelOptionalExpand Create a snapshot of dependencies for a repository — request body — body metadata
refstringRequired within parentThe repository branch that triggered this snapshot.
Pattern: ^refs/
scannedstringRequired within parentThe time at which the snapshot was scanned.
Format: date-time
shastringRequired within parentThe commit SHA associated with this dependency snapshot. Maximum length: 64 characters.
Maximum length: 64
Minimum length: 40
versionintegerRequired within parentThe version of the repository snapshot submission.

Referenced models: Create a snapshot of dependencies for a repository — request body — body manifests value, Create a snapshot of dependencies for a repository — request body — body metadata

Create a snapshot of dependencies for a repository — request body — body manifests value
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
fileobjectOptionalAdditional keys: not allowed
file.source_locationstringOptionalThe path of the manifest file relative to the root of the Git repository.
metadataModelOptionalExpand Create a snapshot of dependencies for a repository — request body — body metadata
namestringRequired within parentThe name of the manifest.
resolvedobjectOptionalA collection of resolved package dependencies.
Additional keys: see wildcard field
resolved.*ModelAdditional keysExpand Create a snapshot of dependencies for a repository — request body — body manifests value resolved value

Referenced models: Create a snapshot of dependencies for a repository — request body — body manifests value resolved value, Create a snapshot of dependencies for a repository — request body — body metadata

Create a snapshot of dependencies for a repository — request body — body metadata
FieldTypePresenceDescription and constraints
$objectRootUser-defined metadata to store domain-specific information limited to 8 keys with scalar values.
Maximum fields: 8
Additional keys: see wildcard field
$.*JSONAdditional keys
$.* (anyOf 1)JSONAlternative
$.* (anyOf 1) (anyOf 1)stringAlternative
$.* (anyOf 1) (anyOf 2)numberAlternative
$.* (anyOf 1) (anyOf 3)booleanAlternative
$.* (anyOf 2)nullAlternative
Create a snapshot of dependencies for a repository — request body — body manifests value resolved value
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
dependenciesarrayOptionalArray of package-url (PURLs) of direct child dependencies.
dependencies[]stringEach item
metadataModelOptionalExpand Create a snapshot of dependencies for a repository — request body — body metadata
package_urlstringOptionalPackage-url (PURL) of dependency. See https://github.com/package-url/purl-spec for more details.
Pattern: ^pkg
relationshipstringOptionalA notation of whether a dependency is requested directly by this manifest or is a dependency of another dependency.
One of: direct, indirect
scopestringOptionalA notation of whether the dependency is required for the primary build artifact (runtime) or is only used for development. Future versions of this specification may allow for more granular scopes.
One of: runtime, development

Referenced models: Create a snapshot of dependencies for a repository — request body — body metadata

SDK function policy ID: github.dependency_graph_create_repository_snapshot. Catalog operation: dependency-graph/create-repository-snapshot. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Pinned headers: {"X-GitHub-Api-Version": "2026-03-10", "User-Agent": "Alter", "Accept": "application/vnd.github+json"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.