> ## Documentation Index
> Fetch the complete documentation index at: https://docs.serval.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Devin

> Connect a Devin organization to Serval with a service user so workflows can create, read and manage Devin sessions through the Devin API.

## About Devin

Devin is an AI software engineer from Cognition. The Serval integration connects one Devin organization through a Devin service user, a non-human account with its own API key and role. Serval workflows can then call the [Devin API v3](https://docs.devin.ai/api-reference/overview) as that service user: create sessions, send them messages, read their status and output, and manage the organization's playbooks, knowledge, schedules and other resources.

**Authentication:** Service user API key plus the Devin organization ID. Serval stores the key and attaches it to every request; the key is only sent to `api.devin.ai`, and workflow code never sees it.

**Data sync:** On demand only. Workflows call Devin at run time. There is no background sync and there are no pre-built installable workflows.

## What the Devin integration enables

| Capability | Description |
| - | - |
| Start Devin sessions | Create a session with a prompt, optional playbook, tags, repositories and attachments. A service user with the `ImpersonateOrgSessions` permission can set `create_as_user_id` to start the session on behalf of a Devin user. |
| Follow up on sessions | List and read sessions, read their messages, send new messages, and archive or terminate them. |
| Manage organization resources | Read and manage playbooks, knowledge, schedules, secrets metadata, repositories and other resources in the Devin organization, within the service user's role. |

Anything in the organization-scoped part of the Devin API v3 can be called through Serval. Enterprise-wide endpoints (`/v3/enterprise/...`) aren't available because the service user belongs to one organization.

## Get your credentials

You need a Devin organization admin to create a service user and copy the organization ID.

**1. Create a service user**

In Devin, open **Settings**, then **Devin API**, then the **Service users** tab, and create a service user for Serval. Give it a role with the permissions your workflows need. Listing sessions needs `ViewOrgSessions`, creating sessions needs `UseDevinSessions`, and creating sessions on behalf of a user needs `ImpersonateOrgSessions`.

**2. Copy the API key**

Generate an API key for the service user and copy it. It starts with `cog_` and is shown once.

**3. Copy the organization ID**

Copy your Devin organization ID from the top of the **Settings**, **Devin API** page. It starts with `org-`.

## Connect in Serval

**1. Add a Devin connection**

In Serval, open the **Devin** integration and start a new connection.

**2. Enter the organization ID and API key**

Paste the organization ID into **Organization ID** and the service user's key into **Service User API Key**. Serval rejects an organization ID that doesn't start with `org-`.

**3. Submit the form**

Click **Submit**, then run the health checks below.

## Verifying the connection

The integration has two health checks:

* **Verify Devin service user** calls `GET /v3/self`. It fails if the key is invalid, belongs to a person rather than a service user, or belongs to a different organization than the one you entered.
* **List Devin sessions** lists one session in the organization. It fails if the service user's role lacks `ViewOrgSessions`.

## Gotchas and troubleshooting

> [accordion] The key works but session calls return 403
>
> The service user's role decides what it can do. Add the missing permission to its role in Devin. The error message from Devin names the permission it needs.

> [accordion] Sessions show up as created by the service user
>
> Sessions belong to the service user unless the request sets `create_as_user_id` to a Devin user ID, which needs the `ImpersonateOrgSessions` permission.

> [accordion] Rotating the key
>
> When you reopen the connection, the saved key is masked. To rotate it, replace the masked value with the full new key and save. Leaving the field unchanged keeps the stored key.

***

Need help? Contact **[support@serval.com](mailto:support@serval.com)** for assistance with your Devin integration.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.