{
  "id": "environment-1",
  "title": "How do I set up an IndyKite environment: project, application and credentials?",
  "description": "Create the foundational IndyKite environment components required before using any IndyKite product. This includes creating a project, application, application agent, credentials, and token introspect configuration.",
  "category": "Environment",
  "tags": [
    "Environment Setup",
    "Project Creation",
    "Application Agent",
    "Credentials",
    "Token Introspect"
  ],
  "api": "Environment",
  "language": "Json",
  "lastUpdated": "2026-09-17",
  "openApiEndpoints": [
    "/configs/v1/projects",
    "/configs/v1/applications",
    "/configs/v1/application-agents",
    "/configs/v1/application-agent-credentials",
    "/configs/v1/token-introspects"
  ],
  "relatedGuides": [
    "/guides/guide-environment",
    "/guides/guide-credentials",
    "/guides/guide-sandbox"
  ],
  "commonErrors": [
    {
      "code": "401",
      "message": "UNAUTHENTICATED",
      "solution": "Verify ServiceAccount credentials are valid and included as Bearer token in Authorization header"
    },
    {
      "code": "403",
      "message": "PERMISSION_DENIED",
      "solution": "Ensure ServiceAccount has sufficient permissions at the Organization level"
    },
    {
      "code": "404",
      "message": "NOT_FOUND",
      "solution": "Check that the parent resource ID (organization, project, or application) exists"
    }
  ],
  "summary": "This guide walks through the complete environment setup process:\n1. Create a Project - the top-level container for your IndyKite resources\n2. Create an Application - represents your software that will interact with IndyKite\n3. Create an Application Agent - the identity used for API authentication\n4. Generate Application Agent Credentials - the API key for authentication\n5. Configure Token Introspect - enables token validation for your application\nComplete these steps before using any other IndyKite feature (IKG, ContX IQ, KBAC, etc.).",
  "usecase": "Scenario: You are setting up a new application that needs to:\n- Store identity and resource data in the IndyKite Knowledge Graph (IKG)\n- Use ContX IQ for authorized data queries\n- Use KBAC for access control decisions\n\nBefore any of these features work, you must create the environment hierarchy:\nOrganization (already exists) -> Project -> Application -> Application Agent -> Credentials",
  "requirements": "Prerequisites:\n- ServiceAccount credentials: Created in IndyKite Hub or via REST API for your Organization\n- Organization ID: Your IndyKite organization identifier\n\nRequired API access:\n- POST /configs/v1/projects (create project)\n- POST /configs/v1/applications (create application)\n- POST /configs/v1/application-agents (create agent)\n- POST /configs/v1/application-agent-credentials (generate credentials)\n- POST /configs/v1/token-introspects (configure token validation)",
  "steps": "Step 1: Create a Project\n- Authentication: ServiceAccount credential as Bearer token in Authorization header\n- Action: POST to /configs/v1/projects with project name and configuration\n- Input: Organization ID, project display name, optional BYODB (Bring Your Own Database) configuration\n- Result: Project ID returned for use in subsequent steps\n\nStep 2: Create an Application\n- Authentication: ServiceAccount credential as Bearer token\n- Action: POST to /configs/v1/applications\n- Input: Project ID from Step 1, application display name\n- Result: Application ID returned\n\nStep 3: Create an Application Agent\n- Authentication: ServiceAccount credential as Bearer token\n- Action: POST to /configs/v1/application-agents\n- Input: Application ID from Step 2, agent display name\n- Result: Application Agent ID returned\n\nStep 4: Generate Application Agent Credentials\n- Authentication: ServiceAccount credential as Bearer token\n- Action: POST to /configs/v1/application-agent-credentials\n- Input: Application Agent ID from Step 3\n- Result: Credential JSON containing the API key (X-IK-ClientKey value)\n- Important: Save these credentials securely - they cannot be retrieved again\n\nStep 5: Download Credentials\n- Action: Save the credential JSON from Step 4 to a secure location\n- Use: This credential is used as the X-IK-ClientKey header for data ingestion and query execution\n\nStep 6: Configure Token Introspect\n- Authentication: ServiceAccount credential as Bearer token\n- Action: POST to /configs/v1/token-introspects\n- Input: Application Agent ID, token validation settings\n- Result: Token introspect configuration ID returned",
  "code": [
    {
      "step": "Step 1",
      "description": "POST request to create a new project. The project is the container for applications and their data. Optionally configure BYODB (Bring Your Own Database) for custom storage.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/projects",
      "language": "Json",
      "ingest": {
        "db_connection": {
          "password": "example-password",
          "url": "neo4j+s://xxxxxxxx.databases.neo4j.io",
          "username": "neo4j"
        },
        "description": "Project description",
        "display_name": "Project name",
        "ikg_size": "2GB",
        "name": "project-name",
        "organization_id": "gid-of-organization",
        "region": "us-east1"
      }
    },
    {
      "step": "Step 1 (alternative)",
      "description": "Use this request instead of the preceding Step 1 request to create the project with its IKG schema version pinned; sending both creates the same project name twice and the second is refused. ikg_schema_version is optional and defaults to v1; it cannot be changed after the project is created, and a read of the project returns it. v1 is the only value accepted today.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/projects",
      "language": "Json",
      "ingest": {
        "db_connection": {
          "password": "example-password",
          "url": "neo4j+s://xxxxxxxx.databases.neo4j.io",
          "username": "neo4j"
        },
        "description": "Project description",
        "display_name": "Project name",
        "ikg_size": "2GB",
        "ikg_schema_version": "v1",
        "name": "project-name",
        "organization_id": "gid-of-organization",
        "region": "us-east1"
      }
    },
    {
      "description": "422: v2 is declared but not supported yet, so a body with \"ikg_schema_version\": \"v2\" is refused.",
      "language": "Json",
      "code": "\nHTTP/2 422\n\n{\n  \"message\": \"Unprocessable Entity\",\n  \"errors\": [\n    \"unsupported ikg_schema_version: only V1 can be set\"\n  ]\n}"
    },
    {
      "step": "Step 2",
      "description": "POST request to create an application within the project. The application represents your software system that will use IndyKite services.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/applications",
      "language": "Json",
      "ingest": {
        "description": "Application description",
        "display_name": "Application name",
        "name": "app-name",
        "project_id": "gid-of-project"
      }
    },
    {
      "step": "Step 3",
      "description": "POST request to create an application agent. The agent is the authenticated identity that your application uses to call IndyKite APIs. api_permissions lists the APIs it may call: Authorization (AuthZEN decisions and searches), Capture, ContXIQ (execute and whoami), EntityMatching, ReadAuthZConfigs (GET /access/v1/policies), ReadDataSchema. Drop any you don't need. The former IKGRead value is retired: it is accepted and silently dropped if still sent.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/application-agents",
      "language": "Json",
      "ingest": {
        "api_permissions": [
          "Authorization",
          "Capture",
          "ContXIQ",
          "EntityMatching",
          "ReadAuthZConfigs",
          "ReadDataSchema"
        ],
        "application_id": "gid-of-application",
        "description": "App Agent description",
        "display_name": "App Agent name",
        "name": "app-agent-name"
      }
    },
    {
      "step": "Step 4",
      "description": "POST request to generate credentials for the application agent. The response contains the API key to use in the X-IK-ClientKey header. Save this securely - it cannot be retrieved again.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/application-agent-credentials",
      "language": "Json",
      "ingest": {
        "application_agent_id": "gid-of-app-agent",
        "display_name": "AppAgent Credentials name",
        "expire_time": "2026-12-31T12:34:56-01:00"
      }
    },
    {
      "step": "Step 6",
      "description": "POST request to create a token introspect configuration. This enables your application to validate tokens and extract identity information.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/token-introspects",
      "language": "Json",
      "ingest": {
        "claims_mapping": {
          "email": {
            "selector": "email"
          },
          "name": {
            "selector": "full_name"
          }
        },
        "description": "Token introspect description",
        "display_name": "Token introspect name",
        "ikg_node_type": "Person",
        "jwt_matcher": {
          "audience": "audience-id",
          "issuer": "https://example.com"
        },
        "name": "rest-token-introspect",
        "online_validation": {
          "cache_ttl": 600
        },
        "perform_upsert": true,
        "project_id": "gid-of-project"
      }
    }
  ],
  "links": {
    "html": "/resources/environment-1",
    "markdown": "/resources/environment-1.md",
    "openApi": "https://openapi.indykite.com/"
  }
}