Skip to main content
Artifacts in Infrahub are generated configuration files or documents based on artifact definitions. Use these endpoints to retrieve artifacts and trigger artifact generation.

Get Artifact

Retrieve a specific artifact by its ID.
GET /api/artifact/{artifact_id}

Path Parameters

artifact_id
string
required
The unique identifier of the artifact to retrieve

Query Parameters

branch
string
Name of the branch to use for the query. If not specified, uses the default branch.
at
string
Time to use for the query, in absolute or relative format (e.g., “2024-01-01T00:00:00Z” or “-1d”)

Response

Returns the artifact content with the appropriate Content-Type header based on the artifact’s content type.
content
binary
The artifact content in its native format

Example

curl -X GET "https://infrahub.example.com/api/artifact/abc123" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Accept: application/json"

Generate Artifact

Trigger the generation of artifacts for a specific artifact definition.
POST /api/artifact/generate/{artifact_definition_id}

Path Parameters

artifact_definition_id
string
required
The unique identifier of the artifact definition to generate artifacts from

Query Parameters

branch
string
Name of the branch to use for the query. If not specified, uses the default branch.
at
string
Time to use for the query, in absolute or relative format (e.g., “2024-01-01T00:00:00Z” or “-1d”)

Request Body

nodes
array
default:"[]"
List of node IDs to limit the scope of the generation. If empty, generates for all applicable nodes.

Response

Returns 200 on successful submission of the generation workflow. The generation happens asynchronously.

Example

curl -X POST "https://infrahub.example.com/api/artifact/generate/def456" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "nodes": ["node-123", "node-456"]
  }'

Generate for All Nodes

curl -X POST "https://infrahub.example.com/api/artifact/generate/def456" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "nodes": []
  }'

Authentication

All artifact endpoints require authentication using either:
  • Bearer Token: Include Authorization: Bearer YOUR_ACCESS_TOKEN header
  • API Key: Include X-API-KEY: YOUR_API_KEY header

Permissions

Generating artifacts requires the following permissions:
  • Core:Artifact:create - Permission to create artifacts
  • Core:Artifact:update - Permission to update artifacts
Permissions are evaluated based on the target branch (default vs. other branches).

Build docs developers (and LLMs) love