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

# Assign unit by email

> Assign a unit to learners by email. Requires the `units:write` scope.

Every email must belong to a learner in your organization: if any isn't found, nothing is assigned and the response is `404`. Learners get Juno's default assignment notification.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/v1/public-api/units/{unitId}/assign-by-email
openapi: 3.1.0
info:
  title: Juno Journey API
  version: 1.0.0
  description: >-
    The Juno public API. See the [API
    overview](https://docs.junojourney.com/integrations/api-overview) for
    authentication, scopes and limits.
servers:
  - url: https://api.the-juno.com
security:
  - BearerAuth: []
paths:
  /api/v1/public-api/units/{unitId}/assign-by-email:
    post:
      tags:
        - Units
      summary: Assign unit by email
      description: >-
        Assign a unit to learners by email. Requires the `units:write` scope.


        Every email must belong to a learner in your organization: if any isn't
        found, nothing is assigned and the response is `404`. Learners get
        Juno's default assignment notification.
      operationId: assignUnitByEmail
      parameters:
        - name: unitId
          in: path
          required: true
          description: The unit's ID.
          schema:
            type: string
          example: 64f0c0ffee0000000000abcd
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - emails
              properties:
                emails:
                  type: array
                  minItems: 1
                  items:
                    type: string
                    format: email
                  description: Learner emails.
            example:
              emails:
                - dana.levi@acme.com
                - sam.cohen@acme.com
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  assigned:
                    type: array
                    items:
                      type: string
                    description: Emails of the learners the unit was assigned to.
                  notFound:
                    type: array
                    items:
                      type: string
                    description: Always empty on success.
              example:
                assigned:
                  - dana.levi@acme.com
                  - sam.cohen@acme.com
                notFound: []
        '400':
          description: Invalid body or the assignment failed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
        '404':
          description: The unit, or a learner for one of the emails, wasn't found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
              example:
                error: 'Users not found for emails: sam.cohen@acme.com'
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token. Create one in Admin → Security → Developer
        Settings → Generate Personal Access Token.

````

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