Base URL
Production:http://localhost:8000/api
All REST endpoints are prefixed with /api.
Interactive Documentation
- Swagger UI:
http://localhost:8000/api/docs - ReDoc:
http://localhost:8000/api/redoc - OpenAPI Spec: Available at
/home/daytona/workspace/source/schema/openapi.json
Authentication
REST endpoints support the same authentication methods as GraphQL: JWT Token:Artifacts
Get Artifact
Retrieve a generated artifact by ID. Endpoint:GET /api/artifact/{artifact_id}
Parameters:
artifact_id(path, required) - Artifact identifierbranch(query, optional) - Branch nameat(query, optional) - Timestamp for time-travel query
Generate Artifact
Trigger artifact generation for an artifact definition. Endpoint:POST /api/artifact/generate/{artifact_definition_id}
Parameters:
artifact_definition_id(path, required) - Artifact definition IDbranch(query, optional) - Branch nameat(query, optional) - Timestamp
Authentication
Login
Authenticate with username and password. Endpoint:POST /api/auth/login
Request Body:
Refresh Token
Obtain a new access token using a refresh token. Endpoint:POST /api/auth/refresh
Headers:
Authorization: Bearer <refresh_token>
Logout
Invalidate the current session and refresh token. Endpoint:POST /api/auth/logout
Example:
Diff Operations
Get Diff Files
Retrieve file diffs for a branch. Endpoint:GET /api/diff/files
Parameters:
branch(query, optional) - Branch nametime_from(query, optional) - Start timestamptime_to(query, optional) - End timestampbranch_only(query, optional) - Only show branch changes (default: true)
Get Diff Artifacts
Retrieve artifact diffs for a branch. Endpoint:GET /api/diff/artifacts
Parameters:
branch(query, optional) - Branch name
File Operations
Get File
Retrieve a file from a Git repository. Endpoint:GET /api/file/{repository_id}/{file_path}
Parameters:
repository_id(path, required) - Repository identifierfile_path(path, required) - Path to file in repositorycommit(query, optional) - Specific commit hashbranch(query, optional) - Branch nameat(query, optional) - Timestamp
Configuration
Get Config
Retrieve Infrahub configuration settings. Endpoint:GET /api/config
Response:
/home/daytona/workspace/source/backend/infrahub/api/internal.py:44 for implementation.
Get Info
Retrieve Infrahub deployment information. Endpoint:GET /api/info
Response:
Menu
Get Menu
Retrieve the navigation menu structure. Endpoint:GET /api/menu
Parameters:
branch(query, optional) - Branch nameat(query, optional) - Timestamp
GraphQL Query Execution
Execute Stored Query (POST)
Execute a stored GraphQL query by ID or name. Endpoint:POST /api/query/{query_id}
Parameters:
query_id(path, required) - Query ID or namebranch(query, optional) - Branch nameat(query, optional) - Timestampsubscribers(query, optional) - List of subscriber IDsupdate_group(query, optional) - Create/update CoreGraphQLQueryGroup (default: false)
Execute Stored Query (GET)
Execute a stored GraphQL query via GET request. Endpoint:GET /api/query/{query_id}
Example:
Schema Operations
Get Schema
Retrieve the Infrahub schema definition. Endpoint:GET /api/schema
Parameters:
branch(query, optional) - Branch namenamespaces(query, optional) - Array of namespace filters
Get Schema Summary
Retrieve schema hash and summary information. Endpoint:GET /api/schema/summary
Parameters:
branch(query, optional) - Branch name
Get Schema by Kind
Retrieve schema definition for a specific kind. Endpoint:GET /api/schema/{schema_kind}
Parameters:
schema_kind(path, required) - Schema kind (e.g., “InfraDevice”)branch(query, optional) - Branch name
OAuth 2.0 / OIDC
OAuth 2.0 Authorization
Initiate OAuth 2.0 authorization flow. Endpoint:GET /api/oauth2/{provider_name}/authorize
Parameters:
provider_name(path, required) - Provider name (e.g., “google”)final_url(query, optional) - Redirect URL after authentication
OAuth 2.0 Token Exchange
Exchange authorization code for tokens. Endpoint:GET /api/oauth2/{provider_name}/token
Parameters:
provider_name(path, required) - Provider namestate(query, required) - State parameter from authorizationcode(query, required) - Authorization code
OIDC Authorization
Initiate OIDC authorization flow. Endpoint:GET /api/oidc/{provider_name}/authorize
Parameters:
provider_name(path, required) - Provider namefinal_url(query, optional) - Redirect URL after authentication
OIDC Token Exchange
Exchange authorization code for tokens. Endpoint:GET /api/oidc/{provider_name}/token
Parameters:
provider_name(path, required) - Provider namestate(query, required) - State parametercode(query, required) - Authorization code
Error Responses
400 Bad Request
401 Unauthorized
404 Not Found
/home/daytona/workspace/source/backend/infrahub/api/__init__.py:75 for the catch-all 404 handler.
422 Validation Error
Transformation Endpoints
Get Python Transform
Retrieve a Python transformation by ID. Endpoint:GET /api/transform/python/{transform_id}
Parameters:
transform_id(path, required) - Transform identifier
Get Jinja2 Transform
Retrieve a Jinja2 transformation template by ID. Endpoint:GET /api/transform/jinja2/{transform_id}
Parameters:
transform_id(path, required) - Transform identifier
Common Query Parameters
Many endpoints support these common parameters: Branch Selection:branch- Name of the branch to use (defaults to main)
at- Timestamp in absolute or relative format- Absolute:
2024-01-15T10:30:00Z - Relative:
-1h,-7d,-30m
- Absolute: