# createConnectSession

```graphql
mutation CreateConnectSession($projectReference: ID!, $name: String!, $input: CreateConnectSessionInput!) {
  createConnectSession(projectReference: $projectReference, name: $name, input: $input) {
    sessionToken
    connectUrl
    expiresAt
  }
}
```

Create connect session.

## Arguments

| Name                | Type                       | Required | Description                                                                                                                                                                                                                                                                                                                                                               |
| ------------------- | -------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `projectReference`  | ID!                        | Yes      | Project ID or slug. A missing or inaccessible project, including a denied scope-dependent project access check, returns not\_found.                                                                                                                                                                                                                                       |
| `name`              | String!                    | Yes      | Integration name, for example github.                                                                                                                                                                                                                                                                                                                                     |
| `input`             | CreateConnectSessionInput! | Yes      |                                                                                                                                                                                                                                                                                                                                                                           |
| `input.scope`       | ConnectionScope!           | Yes      | Connection owner. Project scope needs the editor role; user scope connects your own account and needs viewer access to the project. API keys also need the integrations write scope and are refused user scope with forbidden. Verified user-session or API-key credentials are required; MCP OAuth grants and runtime credentials are refused. One of `user`, `project`. |
| `input.redirectUri` | String!                    | Yes      | Trusted web or native URI the browser returns to after consent.                                                                                                                                                                                                                                                                                                           |

## Variables

```json
{
  "projectReference": "string",
  "name": "string",
  "input": {
    "scope": "user",
    "redirectUri": "string"
  }
}
```

## Responses

| Status | Description                                       |
| ------ | ------------------------------------------------- |
| 200    | The ConnectSession! in data.createConnectSession. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation CreateConnectSession($projectReference: ID!, $name: String!, $input: CreateConnectSessionInput!) {\n  createConnectSession(projectReference: $projectReference, name: $name, input: $input) {\n    sessionToken\n    connectUrl\n    expiresAt\n  }\n}",
  "variables": {
    "projectReference": "string",
    "name": "string",
    "input": {
      "scope": "user",
      "redirectUri": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "createConnectSession": {
      "sessionToken": "string",
      "connectUrl": "https://example.com",
      "expiresAt": "2026-01-01T00:00:00Z"
    }
  }
}
```
