---
title: "Add Email Credentials"
method: POST
path: "/email/v1/emails/credentials"
tags: ["emailService"]
---

# Add Email Credentials

`POST /email/v1/emails/credentials`

Adds new email credentials for IMAP and SMTP access. Only accessible by authorized users.

## Request body

- EmailCredentialsDto
  - `email` string, email, required
  - `password` string, required
  - `imap_host` string, nullable
  - `imap_port` integer, nullable
  - `smtp_host` string, nullable
  - `smtp_port` integer, nullable

## Response `201`

OK

- EmailCredentialsItem
  - `id` integer
  - `added_by` integer
  - `auth_user_id` integer
  - `imap_host` string
  - `imap_port` integer
  - `smtp_host` string, nullable
  - `smtp_port` integer, nullable
  - `email` string
  - `status` 'pending_settings' | 'first_sync' | 'connected' | 'auth_fail'
  - `created_at` integer
  - `updated_at` integer
  - `sync_folders` EmailSyncFolders[]
    - object[]
      - `folder_name` string, required
      - `path` string, required
      - `delimitter` string, required
      - `has_children` boolean, required
      - `is_root` boolean, required
      - `is_inbox` boolean
      - `is_draft` boolean
      - `is_sent` boolean
      - `is_junk` boolean
      - `is_trash` boolean

## Other responses

- `401` — Access token is missing or invalid
- `403` — Forbidden
- `409` — Conflict. Email already exists.
- `422` — Validation error response

---

[API](https://skmtc.net/uspacy/apis/uspacy-api-2.md) · [All operations](https://skmtc.net/uspacy/apis/uspacy-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/uspacy/uspacy-api-2/versions/c3f48fd1c26b/schema)
