# Update an Email activity

PUT https://api.close.com/api/v1/activity/email/{id}/
Content-Type: application/json

This can be used to modify a draft or send it once the draft is complete.

When changing a draft's status to `scheduled` or `outbox`, the `sender` field is required if not already set on the email.

Reference: https://developer.close.com/api/resources/activities/emails/update

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /activity/email/{id}/:
    put:
      operationId: update
      summary: Update an Email activity
      description: >-
        This can be used to modify a draft or send it once the draft is
        complete.


        When changing a draft's status to `scheduled` or `outbox`, the `sender`
        field is required if not already set on the email.
      tags:
        - subpackage_activitiesEmails
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Basic authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailActivity'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateEmailActivity'
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    UpdateEmailActivityAttachmentsItems:
      type: object
      properties:
        content_id:
          type:
            - string
            - 'null'
        content_type:
          type:
            - string
            - 'null'
        filename:
          type: string
        inline_only:
          type: boolean
        size:
          type: integer
        url:
          type: string
          format: uri
      required:
        - filename
        - size
        - url
      title: UpdateEmailActivityAttachmentsItems
    UpdateEmailActivityOpensItems:
      type: object
      properties:
        opened_at:
          type: string
          format: date-time
      required:
        - opened_at
      title: UpdateEmailActivityOpensItems
    UpdateEmailActivityStatus:
      type: string
      enum:
        - inbox
        - draft
        - scheduled
        - outbox
        - sent
        - error
      title: UpdateEmailActivityStatus
    UpdateEmailActivity:
      type: object
      properties:
        account_id:
          type:
            - string
            - 'null'
        activity_at:
          type:
            - string
            - 'null'
          format: date-time
        attachments:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/UpdateEmailActivityAttachmentsItems'
        bcc:
          type:
            - array
            - 'null'
          items:
            type: string
        body_html:
          type:
            - string
            - 'null'
        body_text:
          type:
            - string
            - 'null'
        cc:
          type:
            - array
            - 'null'
          items:
            type: string
        contact_id:
          type:
            - string
            - 'null'
        followup_date:
          type:
            - string
            - 'null'
          format: date-time
        followup_sequence_add_cc_bcc:
          type:
            - boolean
            - 'null'
        followup_sequence_delay:
          type:
            - integer
            - 'null'
        followup_sequence_id:
          type:
            - string
            - 'null'
        in_reply_to_id:
          type:
            - string
            - 'null'
        opens:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/UpdateEmailActivityOpensItems'
        sender:
          type:
            - string
            - 'null'
          format: email
        status:
          $ref: '#/components/schemas/UpdateEmailActivityStatus'
        subject:
          type:
            - string
            - 'null'
        template_id:
          type:
            - string
            - 'null'
        to:
          type:
            - array
            - 'null'
          items:
            type: string
        user_id:
          type:
            - string
            - 'null'
      title: UpdateEmailActivity
    Attachment:
      type: object
      properties:
        content_type:
          type:
            - string
            - 'null'
        filename:
          type:
            - string
            - 'null'
        size:
          type:
            - integer
            - 'null'
        thumbnail_url:
          type:
            - string
            - 'null'
        url:
          type: string
      required:
        - content_type
        - filename
        - size
        - url
      title: Attachment
    CommunicationDirection:
      type: string
      enum:
        - incoming
        - outgoing
      description: >-
        This is the former EmailDirection.

        Any activity that has a concept of direction (in or out) should be using

        this enum.

        For historical reasons, this is different from PhoneActivityDirection

        but at some point PhoneActivityDirection should be deprecated and
        replaced

        with CommunicationDirection.
      title: CommunicationDirection
    MessageStatus:
      type: string
      enum:
        - inbox
        - draft
        - scheduled
        - outbox
        - sent
        - error
      description: |-
        Status of a message, such as Email or SMS.

        This set of statuses should be enough to support features such as
        "send later" or "undo send".
      title: MessageStatus
    EmailActivity:
      type: object
      properties:
        _type:
          type: string
        activity_at:
          type:
            - string
            - 'null'
          format: date-time
        agent_action_reason:
          type:
            - string
            - 'null'
        agent_config_id:
          type:
            - string
            - 'null'
        attachments:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Attachment'
        bcc:
          type: array
          items:
            type: string
        body_html:
          type:
            - string
            - 'null'
        body_preview:
          type:
            - string
            - 'null'
        body_text:
          type:
            - string
            - 'null'
        bulk_email_action_id:
          type:
            - string
            - 'null'
        cc:
          type: array
          items:
            type: string
        contact_id:
          type:
            - string
            - 'null'
        created_by:
          type:
            - string
            - 'null'
        created_by_name:
          type:
            - string
            - 'null'
        date_created:
          type: string
          format: date-time
        date_scheduled:
          type:
            - string
            - 'null'
          format: date-time
        date_sent:
          type:
            - string
            - 'null'
          format: date-time
        date_updated:
          type: string
          format: date-time
        direction:
          oneOf:
            - $ref: '#/components/schemas/CommunicationDirection'
            - type: 'null'
        email_account_id:
          type:
            - string
            - 'null'
        envelope:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
        followup_sequence_add_cc_bcc:
          type: boolean
        followup_sequence_delay:
          type:
            - integer
            - 'null'
        followup_sequence_id:
          type:
            - string
            - 'null'
        has_reply:
          type: boolean
        id:
          type: string
        in_reply_to_id:
          type:
            - string
            - 'null'
        lead_id:
          type:
            - string
            - 'null'
        message_ids:
          type: array
          items:
            type: string
        need_smtp_credentials:
          type: boolean
        opens:
          type:
            - array
            - 'null'
          items:
            type: object
            additionalProperties:
              type: string
        opens_summary:
          type:
            - string
            - 'null'
        organization_id:
          type: string
        references:
          type: array
          items:
            type: string
        send_as_id:
          type:
            - string
            - 'null'
        send_attempts:
          type:
            - array
            - 'null'
          items:
            type: object
            additionalProperties:
              type: string
        sender:
          type:
            - string
            - 'null'
        sequence_id:
          type:
            - string
            - 'null'
        sequence_name:
          type:
            - string
            - 'null'
        sequence_subscription_id:
          type:
            - string
            - 'null'
        status:
          $ref: '#/components/schemas/MessageStatus'
        subject:
          type:
            - string
            - 'null'
        template_id:
          type:
            - string
            - 'null'
        template_name:
          type:
            - string
            - 'null'
        thread_id:
          type:
            - string
            - 'null'
        to:
          type: array
          items:
            type: string
        updated_by:
          type:
            - string
            - 'null'
        updated_by_name:
          type:
            - string
            - 'null'
        user_id:
          type:
            - string
            - 'null'
        user_name:
          type:
            - string
            - 'null'
        users:
          type: array
          items:
            type: string
      required:
        - _type
        - activity_at
        - bcc
        - body_html
        - body_text
        - bulk_email_action_id
        - cc
        - contact_id
        - created_by
        - date_created
        - date_scheduled
        - date_sent
        - date_updated
        - direction
        - followup_sequence_add_cc_bcc
        - followup_sequence_delay
        - has_reply
        - id
        - in_reply_to_id
        - lead_id
        - message_ids
        - need_smtp_credentials
        - opens_summary
        - organization_id
        - references
        - send_as_id
        - sender
        - status
        - subject
        - template_id
        - thread_id
        - to
        - updated_by
        - user_id
        - users
      title: EmailActivity
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: basic
    OAuth2:
      type: http
      scheme: bearer

```