# Create an access profile

Slice a GitHub, Google Cloud or AWS connection into a named, shareable access profile that issues short-lived credentials for people and agents.

Create an **access profile** on one of your organization's connections, or on a project's own connection, to define a named ceiling of short-lived credentials (GitHub installation tokens, Google Cloud access tokens or AWS session credentials). Organization access profiles can be shared with projects; project access profiles can be granted directly to agents.

To create an access profile, you need Owner, Editor or Connection Admin on the organization or project, plus Owner, Connection Admin or Connection User on the backing connection.

You need a connection first: [Connect GitHub](/guides/secrets/connect-github), [Connect Google Cloud](/guides/secrets/connect-google-cloud) or [Connect AWS](/guides/secrets/connect-aws).

## Create an access profile [#create-an-access-profile]

1. In your organization or project, open **Access** › **Access profiles**.
2. Click **New access profile**.
3. Enter a **Name**, such as `github/api_read` or `aws/deploy_staging`.
4. Under **Connection**, select the connection that issues its credentials.
5. Configure the profile's ceiling for its provider:
   - **GitHub:** select the allowed repositories and per-permission levels (`read`, `write` or `admin`). Tokens last an hour.
   - **Google Cloud:** pick one of the connection's service accounts and token lifetime (10 minutes to an hour).
   - **AWS:** pick one of the connection's IAM roles, optional session policy ARNs or inline policy to narrow permissions, lifetime (15 minutes to an hour) and default region.
6. At organization scope, select which projects to share the profile with (**No projects**, **All projects** or **Selected projects**).
7. Click **Create access profile**.

kosem verifies the ceiling with the provider before saving. Any credential issued directly or through an agent grant can only narrow this ceiling, never widen it.

## Share an organization access profile [#share-an-organization-access-profile]

1. Open the access profile in your organization and click the **Sharing** tab.
2. Click **Change sharing**, select **All projects** or **Selected projects**, and click **Save**.

Each selected project gets a copy immediately under the same alias, inheriting the organization profile's config. Removing a project removes its copy and revokes all agent grants of it immediately.

## Issue a credential through the API [#issue-a-credential-through-the-api]

Agents receive credentials automatically from granted access profiles when they run `git`, `gh`, `aws`, `gcloud` or cloud SDKs in their environment. Your own software can also issue a short-lived credential through the API with Owner, Connection Admin or Access Profile Accessor on the profile:

```sh
export KOSEM_API_KEY='kosem_sk_…'
export KOSEM_PROJECT='prj_01m5r9dh9mf0ps98ktkap3562c'
export KOSEM_PROFILE='acp_01m5rf2kz8e9vbt6g0d4x7qz1q'

curl -s -X POST "https://api.kosem.ai/v1/projects/$KOSEM_PROJECT/accessProfiles/$KOSEM_PROFILE/credentials" \
  -H "Authorization: Bearer $KOSEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"scope": {"repositories": ["api"], "permissions": {"contents": "read"}}}'
```

`scope` is optional and can only narrow the profile's ceiling. A wider scope fails with `CREDENTIAL_REFUSED`. Each issue is recorded in the Data Access audit log with the provider's correlation identifier (GitHub's `hashed_token`, or AWS's `accessKeyId` and `assumedRoleArn`).

## Related [#related]

- [Connections and access profiles](/concepts/connections)
- [Give an agent access](/guides/secrets/give-an-agent-a-secret)
- [Errors](/reference/errors#connections)
