Open Context Protocol is live! 🚀 Read the launch post
appsGetUserInstallation

appsGetUserInstallation

Get a user installation for the authenticated app

Details

  • Method: GET
  • Path: /users/{username}/installation
  • Operation ID: apps/get-user-installation

Parameters

{
  "username": {
    "description": "The handle for the GitHub user account.",
    "required": true,
    "location": "path",
    "type": "string"
  }
}

Response Schema

{
  "title": "Installation",
  "description": "Installation",
  "type": "object",
  "properties": {
    "id": {
      "description": "The ID of the installation.",
      "type": "integer",
      "example": 1
    },
    "account": {
      "anyOf": [
        {
          "title": "Simple User",
          "description": "A GitHub user.",
          "type": "object",
          "properties": {
            "name": {
              "nullable": true,
              "type": "string"
            },
            "email": {
              "nullable": true,
              "type": "string"
            },
            "login": {
              "type": "string",
              "example": "octocat"
            },
            "id": {
              "type": "integer",
              "format": "int64",
              "example": 1
            },
            "node_id": {
              "type": "string",
              "example": "MDQ6VXNlcjE="
            },
            "avatar_url": {
              "type": "string",
              "format": "uri",
              "example": "https://github.com/images/error/octocat_happy.gif"
            },
            "gravatar_id": {
              "type": "string",
              "example": "41d064eb2195891e12d0413f63227ea7",
              "nullable": true
            },
            "url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat"
            },
            "html_url": {
              "type": "string",
              "format": "uri",
              "example": "https://github.com/octocat"
            },
            "followers_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/followers"
            },
            "following_url": {
              "type": "string",
              "example": "https://api.github.com/users/octocat/following{/other_user}"
            },
            "gists_url": {
              "type": "string",
              "example": "https://api.github.com/users/octocat/gists{/gist_id}"
            },
            "starred_url": {
              "type": "string",
              "example": "https://api.github.com/users/octocat/starred{/owner}{/repo}"
            },
            "subscriptions_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/subscriptions"
            },
            "organizations_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/orgs"
            },
            "repos_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/repos"
            },
            "events_url": {
              "type": "string",
              "example": "https://api.github.com/users/octocat/events{/privacy}"
            },
            "received_events_url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/users/octocat/received_events"
            },
            "type": {
              "type": "string",
              "example": "User"
            },
            "site_admin": {
              "type": "boolean"
            },
            "starred_at": {
              "type": "string",
              "example": "\"2020-07-09T00:17:55Z\""
            },
            "user_view_type": {
              "type": "string",
              "example": "public"
            }
          },
          "required": [
            "avatar_url",
            "events_url",
            "followers_url",
            "following_url",
            "gists_url",
            "gravatar_id",
            "html_url",
            "id",
            "node_id",
            "login",
            "organizations_url",
            "received_events_url",
            "repos_url",
            "site_admin",
            "starred_url",
            "subscriptions_url",
            "type",
            "url"
          ]
        },
        {
          "title": "Enterprise",
          "description": "An enterprise on GitHub.",
          "type": "object",
          "properties": {
            "description": {
              "description": "A short description of the enterprise.",
              "type": "string",
              "nullable": true
            },
            "html_url": {
              "type": "string",
              "format": "uri",
              "example": "https://github.com/enterprises/octo-business"
            },
            "website_url": {
              "description": "The enterprise's website URL.",
              "type": "string",
              "nullable": true,
              "format": "uri"
            },
            "id": {
              "description": "Unique identifier of the enterprise",
              "example": 42,
              "type": "integer"
            },
            "node_id": {
              "type": "string",
              "example": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5"
            },
            "name": {
              "description": "The name of the enterprise.",
              "type": "string",
              "example": "Octo Business"
            },
            "slug": {
              "description": "The slug url identifier for the enterprise.",
              "type": "string",
              "example": "octo-business"
            },
            "created_at": {
              "type": "string",
              "nullable": true,
              "format": "date-time",
              "example": "2019-01-26T19:01:12Z"
            },
            "updated_at": {
              "type": "string",
              "nullable": true,
              "format": "date-time",
              "example": "2019-01-26T19:14:43Z"
            },
            "avatar_url": {
              "type": "string",
              "format": "uri"
            }
          },
          "required": [
            "id",
            "node_id",
            "name",
            "slug",
            "html_url",
            "created_at",
            "updated_at",
            "avatar_url"
          ]
        }
      ],
      "nullable": true
    },
    "repository_selection": {
      "description": "Describe whether all repositories have been selected or there's a selection involved",
      "type": "string",
      "enum": [
        "all",
        "selected"
      ]
    },
    "access_tokens_url": {
      "type": "string",
      "format": "uri",
      "example": "https://api.github.com/app/installations/1/access_tokens"
    },
    "repositories_url": {
      "type": "string",
      "format": "uri",
      "example": "https://api.github.com/installation/repositories"
    },
    "html_url": {
      "type": "string",
      "format": "uri",
      "example": "https://github.com/organizations/github/settings/installations/1"
    },
    "app_id": {
      "type": "integer",
      "example": 1
    },
    "client_id": {
      "type": "string",
      "example": "Iv1.ab1112223334445c"
    },
    "target_id": {
      "description": "The ID of the user or organization this token is being scoped to.",
      "type": "integer"
    },
    "target_type": {
      "type": "string",
      "example": "Organization"
    },
    "permissions": {
      "title": "App Permissions",
      "type": "object",
      "description": "The permissions granted to the user access token.",
      "properties": {
        "actions": {
          "type": "string",
          "description": "The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts.",
          "enum": [
            "read",
            "write"
          ]
        },
        "administration": {
          "type": "string",
          "description": "The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation.",
          "enum": [
            "read",
            "write"
          ]
        },
        "artifact_metadata": {
          "type": "string",
          "description": "The level of permission to grant the access token to create and retrieve build artifact metadata records.",
          "enum": [
            "read",
            "write"
          ]
        },
        "attestations": {
          "type": "string",
          "description": "The level of permission to create and retrieve the access token for repository attestations.",
          "enum": [
            "read",
            "write"
          ]
        },
        "checks": {
          "type": "string",
          "description": "The level of permission to grant the access token for checks on code.",
          "enum": [
            "read",
            "write"
          ]
        },
        "codespaces": {
          "type": "string",
          "description": "The level of permission to grant the access token to create, edit, delete, and list Codespaces.",
          "enum": [
            "read",
            "write"
          ]
        },
        "contents": {
          "type": "string",
          "description": "The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges.",
          "enum": [
            "read",
            "write"
          ]
        },
        "dependabot_secrets": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage Dependabot secrets.",
          "enum": [
            "read",
            "write"
          ]
        },
        "deployments": {
          "type": "string",
          "description": "The level of permission to grant the access token for deployments and deployment statuses.",
          "enum": [
            "read",
            "write"
          ]
        },
        "discussions": {
          "type": "string",
          "description": "The level of permission to grant the access token for discussions and related comments and labels.",
          "enum": [
            "read",
            "write"
          ]
        },
        "environments": {
          "type": "string",
          "description": "The level of permission to grant the access token for managing repository environments.",
          "enum": [
            "read",
            "write"
          ]
        },
        "issues": {
          "type": "string",
          "description": "The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones.",
          "enum": [
            "read",
            "write"
          ]
        },
        "merge_queues": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage the merge queues for a repository.",
          "enum": [
            "read",
            "write"
          ]
        },
        "metadata": {
          "type": "string",
          "description": "The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata.",
          "enum": [
            "read",
            "write"
          ]
        },
        "packages": {
          "type": "string",
          "description": "The level of permission to grant the access token for packages published to GitHub Packages.",
          "enum": [
            "read",
            "write"
          ]
        },
        "pages": {
          "type": "string",
          "description": "The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds.",
          "enum": [
            "read",
            "write"
          ]
        },
        "pull_requests": {
          "type": "string",
          "description": "The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges.",
          "enum": [
            "read",
            "write"
          ]
        },
        "repository_custom_properties": {
          "type": "string",
          "description": "The level of permission to grant the access token to view and edit custom properties for a repository, when allowed by the property.",
          "enum": [
            "read",
            "write"
          ]
        },
        "repository_hooks": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage the post-receive hooks for a repository.",
          "enum": [
            "read",
            "write"
          ]
        },
        "repository_projects": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage repository projects, columns, and cards.",
          "enum": [
            "read",
            "write",
            "admin"
          ]
        },
        "secret_scanning_alerts": {
          "type": "string",
          "description": "The level of permission to grant the access token to view and manage secret scanning alerts.",
          "enum": [
            "read",
            "write"
          ]
        },
        "secrets": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage repository secrets.",
          "enum": [
            "read",
            "write"
          ]
        },
        "security_events": {
          "type": "string",
          "description": "The level of permission to grant the access token to view and manage security events like code scanning alerts.",
          "enum": [
            "read",
            "write"
          ]
        },
        "single_file": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage just a single file.",
          "enum": [
            "read",
            "write"
          ]
        },
        "statuses": {
          "type": "string",
          "description": "The level of permission to grant the access token for commit statuses.",
          "enum": [
            "read",
            "write"
          ]
        },
        "vulnerability_alerts": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage Dependabot alerts.",
          "enum": [
            "read",
            "write"
          ]
        },
        "workflows": {
          "type": "string",
          "description": "The level of permission to grant the access token to update GitHub Actions workflow files.",
          "enum": [
            "write"
          ]
        },
        "custom_properties_for_organizations": {
          "type": "string",
          "description": "The level of permission to grant the access token to view and edit custom properties for an organization, when allowed by the property.",
          "enum": [
            "read",
            "write"
          ]
        },
        "members": {
          "type": "string",
          "description": "The level of permission to grant the access token for organization teams and members.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_administration": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage access to an organization.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_custom_roles": {
          "type": "string",
          "description": "The level of permission to grant the access token for custom repository roles management.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_custom_org_roles": {
          "type": "string",
          "description": "The level of permission to grant the access token for custom organization roles management.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_custom_properties": {
          "type": "string",
          "description": "The level of permission to grant the access token for repository custom properties management at the organization level.",
          "enum": [
            "read",
            "write",
            "admin"
          ]
        },
        "organization_copilot_seat_management": {
          "type": "string",
          "description": "The level of permission to grant the access token for managing access to GitHub Copilot for members of an organization with a Copilot Business subscription. This property is in public preview and is subject to change.",
          "enum": [
            "write"
          ]
        },
        "organization_announcement_banners": {
          "type": "string",
          "description": "The level of permission to grant the access token to view and manage announcement banners for an organization.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_events": {
          "type": "string",
          "description": "The level of permission to grant the access token to view events triggered by an activity in an organization.",
          "enum": [
            "read"
          ]
        },
        "organization_hooks": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage the post-receive hooks for an organization.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_personal_access_tokens": {
          "type": "string",
          "description": "The level of permission to grant the access token for viewing and managing fine-grained personal access token requests to an organization.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_personal_access_token_requests": {
          "type": "string",
          "description": "The level of permission to grant the access token for viewing and managing fine-grained personal access tokens that have been approved by an organization.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_plan": {
          "type": "string",
          "description": "The level of permission to grant the access token for viewing an organization's plan.",
          "enum": [
            "read"
          ]
        },
        "organization_projects": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage organization projects and projects public preview (where available).",
          "enum": [
            "read",
            "write",
            "admin"
          ]
        },
        "organization_packages": {
          "type": "string",
          "description": "The level of permission to grant the access token for organization packages published to GitHub Packages.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_secrets": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage organization secrets.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_self_hosted_runners": {
          "type": "string",
          "description": "The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization.",
          "enum": [
            "read",
            "write"
          ]
        },
        "organization_user_blocking": {
          "type": "string",
          "description": "The level of permission to grant the access token to view and manage users blocked by the organization.",
          "enum": [
            "read",
            "write"
          ]
        },
        "team_discussions": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage team discussions and related comments.",
          "enum": [
            "read",
            "write"
          ]
        },
        "email_addresses": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage the email addresses belonging to a user.",
          "enum": [
            "read",
            "write"
          ]
        },
        "followers": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage the followers belonging to a user.",
          "enum": [
            "read",
            "write"
          ]
        },
        "git_ssh_keys": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage git SSH keys.",
          "enum": [
            "read",
            "write"
          ]
        },
        "gpg_keys": {
          "type": "string",
          "description": "The level of permission to grant the access token to view and manage GPG keys belonging to a user.",
          "enum": [
            "read",
            "write"
          ]
        },
        "interaction_limits": {
          "type": "string",
          "description": "The level of permission to grant the access token to view and manage interaction limits on a repository.",
          "enum": [
            "read",
            "write"
          ]
        },
        "profile": {
          "type": "string",
          "description": "The level of permission to grant the access token to manage the profile settings belonging to a user.",
          "enum": [
            "write"
          ]
        },
        "starring": {
          "type": "string",
          "description": "The level of permission to grant the access token to list and manage repositories a user is starring.",
          "enum": [
            "read",
            "write"
          ]
        },
        "enterprise_custom_properties_for_organizations": {
          "type": "string",
          "description": "The level of permission to grant the access token for organization custom properties management at the enterprise level.",
          "enum": [
            "read",
            "write",
            "admin"
          ]
        }
      },
      "example": {
        "contents": "read",
        "issues": "read",
        "deployments": "write",
        "single_file": "read"
      }
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "single_file_name": {
      "type": "string",
      "example": "config.yaml",
      "nullable": true
    },
    "has_multiple_single_files": {
      "type": "boolean",
      "example": true
    },
    "single_file_paths": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "example": [
        "config.yml",
        ".github/issue_TEMPLATE.md"
      ]
    },
    "app_slug": {
      "type": "string",
      "example": "github-actions"
    },
    "suspended_by": {
      "title": "Simple User",
      "description": "A GitHub user.",
      "type": "object",
      "properties": {
        "name": {
          "nullable": true,
          "type": "string"
        },
        "email": {
          "nullable": true,
          "type": "string"
        },
        "login": {
          "type": "string",
          "example": "octocat"
        },
        "id": {
          "type": "integer",
          "format": "int64",
          "example": 1
        },
        "node_id": {
          "type": "string",
          "example": "MDQ6VXNlcjE="
        },
        "avatar_url": {
          "type": "string",
          "format": "uri",
          "example": "https://github.com/images/error/octocat_happy.gif"
        },
        "gravatar_id": {
          "type": "string",
          "example": "41d064eb2195891e12d0413f63227ea7",
          "nullable": true
        },
        "url": {
          "type": "string",
          "format": "uri",
          "example": "https://api.github.com/users/octocat"
        },
        "html_url": {
          "type": "string",
          "format": "uri",
          "example": "https://github.com/octocat"
        },
        "followers_url": {
          "type": "string",
          "format": "uri",
          "example": "https://api.github.com/users/octocat/followers"
        },
        "following_url": {
          "type": "string",
          "example": "https://api.github.com/users/octocat/following{/other_user}"
        },
        "gists_url": {
          "type": "string",
          "example": "https://api.github.com/users/octocat/gists{/gist_id}"
        },
        "starred_url": {
          "type": "string",
          "example": "https://api.github.com/users/octocat/starred{/owner}{/repo}"
        },
        "subscriptions_url": {
          "type": "string",
          "format": "uri",
          "example": "https://api.github.com/users/octocat/subscriptions"
        },
        "organizations_url": {
          "type": "string",
          "format": "uri",
          "example": "https://api.github.com/users/octocat/orgs"
        },
        "repos_url": {
          "type": "string",
          "format": "uri",
          "example": "https://api.github.com/users/octocat/repos"
        },
        "events_url": {
          "type": "string",
          "example": "https://api.github.com/users/octocat/events{/privacy}"
        },
        "received_events_url": {
          "type": "string",
          "format": "uri",
          "example": "https://api.github.com/users/octocat/received_events"
        },
        "type": {
          "type": "string",
          "example": "User"
        },
        "site_admin": {
          "type": "boolean"
        },
        "starred_at": {
          "type": "string",
          "example": "\"2020-07-09T00:17:55Z\""
        },
        "user_view_type": {
          "type": "string",
          "example": "public"
        }
      },
      "required": [
        "avatar_url",
        "events_url",
        "followers_url",
        "following_url",
        "gists_url",
        "gravatar_id",
        "html_url",
        "id",
        "node_id",
        "login",
        "organizations_url",
        "received_events_url",
        "repos_url",
        "site_admin",
        "starred_url",
        "subscriptions_url",
        "type",
        "url"
      ],
      "nullable": true
    },
    "suspended_at": {
      "type": "string",
      "format": "date-time",
      "nullable": true
    },
    "contact_email": {
      "type": "string",
      "example": "\"test_13f1e99741e3e004@d7e1eb0bc0a1ba12.com\"",
      "nullable": true
    }
  },
  "required": [
    "id",
    "app_id",
    "app_slug",
    "target_id",
    "target_type",
    "single_file_name",
    "repository_selection",
    "access_tokens_url",
    "html_url",
    "repositories_url",
    "events",
    "account",
    "permissions",
    "created_at",
    "updated_at",
    "suspended_by",
    "suspended_at"
  ]
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('github')

# Call this tool
result = await agent.call_tool('appsGetUserInstallation', {
    # Add required parameters here
})