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

# Assign an account

> Makes a sales rep the CRM owner of one of the listed accounts (the HubSpot company or the Salesforce Account), and of its highlighted contact too with `with_contact: true`. Writes to your CRM. Returns the list with the account's new owner.



## OpenAPI

````yaml POST /todays-accounts/assign
openapi: 3.1.0
info:
  title: OpenAPI Lonescale
  description: A sample API for Lonescale
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://public-api.lonescale.com
security:
  - ApiKeyAuth: []
paths:
  /todays-accounts/assign:
    post:
      description: >-
        Makes a sales rep the CRM owner of one of the listed accounts (the
        HubSpot company or the Salesforce Account), and of its highlighted
        contact too with `with_contact: true`. Writes to your CRM. Returns the
        list with the account's new owner.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                domain:
                  type: string
                  description: The account's domain, as listed in `accounts[].domain`.
                  example: pennylane.com
                owner_id:
                  type: string
                  description: A CRM owner id, from `GET /todays-accounts/owners`.
                with_contact:
                  type: boolean
                  default: false
                  description: >-
                    Also make them the owner of the account's highlighted CRM
                    contact.
                scope:
                  type: string
                  description: >-
                    Which CRM book to rank: omit it for the API key holder's own
                    accounts (their linked CRM owner), `all` for every account
                    with a domain, `unassigned` for accounts nobody owns
                    (HubSpot only), or a CRM owner id from `GET
                    /todays-accounts/owners`.
              required:
                - domain
                - owner_id
      responses:
        '200':
          description: The book's list, whatever its status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodaysAccountsList'
        '400':
          description: >-
            The CRM refused the change (e.g. the account was assigned but not
            the contact)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: >-
                  The account was assigned, the contact was not: insufficient
                  access rights
                error: Bad Request
                statusCode: 400
        '401':
          description: Invalid or missing authentication credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
              example:
                message: Invalid API Key
                error: Unauthorized
                statusCode: 401
        '403':
          description: Today's accounts is not enabled for the API key's holder
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: >-
                  Today's accounts is not enabled for this user: ask LoneScale
                  to turn it on.
                error: Forbidden
                statusCode: 403
        '404':
          description: The account is not in this book's current list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: Account not in this list
                error: Not Found
                statusCode: 404
        '429':
          description: 'Rate limit exceeded: 30 requests per minute, counted per API key'
components:
  schemas:
    TodaysAccountsList:
      type: object
      properties:
        status:
          type: string
          enum:
            - none
            - pending
            - ended
            - error
          description: '`none`: never ranked, call refresh. `pending`: ranking, poll again.'
        scope:
          type: string
          nullable: true
          description: >-
            The book: `all`, `unassigned`, `owner:<CRM owner id>`, or
            `unlinked:<user id>` when the caller has no CRM owner.
        crm:
          type: string
          nullable: true
          enum:
            - hubspot
            - salesforce
        requested_at:
          type: string
          format: date-time
          nullable: true
        generated_at:
          type: string
          format: date-time
          nullable: true
        error:
          type: string
          nullable: true
        owner_linked:
          type: boolean
          nullable: true
          description: >-
            False when the caller's own book was asked and no CRM owner matches
            their email.
        book_size:
          type: integer
          nullable: true
          description: Accounts with a domain in the book.
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/TodaysAccount'
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    AuthError:
      required:
        - message
        - error
        - statusCode
      type: object
      properties:
        message:
          type: string
          example: Invalid API Key
        error:
          type: string
          example: Unauthorized
        statusCode:
          type: integer
          example: 401
    TodaysAccount:
      type: object
      properties:
        rank:
          type: integer
          example: 1
        domain:
          type: string
          example: pennylane.com
        name:
          type: string
          nullable: true
        location:
          type: string
          nullable: true
          description: City and country from the CRM address; `null` when the CRM has none.
          example: Paris, France
        industry:
          type: string
          nullable: true
          description: The CRM industry; `null` when the CRM has none.
        angle:
          type: string
          nullable: true
          description: >-
            Why this person, why now: one line written at list time in the
            account's language. `null` when it could not be written.
          example: 'Nouveau VP Sales depuis 8 jours : il choisit ses outils maintenant.'
        crm_id:
          type: string
          nullable: true
          description: HubSpot company id or Salesforce Account id.
        owner:
          type: object
          nullable: true
          description: '`null` when unassigned.'
          properties:
            id:
              type: string
            name:
              type: string
              nullable: true
        signal:
          type: object
          properties:
            type:
              type: string
              enum:
                - JOB_CHANGE
                - NEW_HIRE
                - JOB_POSTING
                - CONTACT_SOURCING
                - HIRING
            reason:
              type: string
              example: Charlotte C. just moved here as Team Lead BDR
            detected_at:
              type: string
              format: date-time
              nullable: true
        person:
          type: object
          nullable: true
          description: >-
            The one to reach first (`people[0]`); `null` when no contact is
            known.
          properties:
            role:
              type: string
              nullable: true
              enum:
                - DECISION_MAKER
                - CHAMPION
                - USER
                - null
              description: >-
                Who they are to the purchase, read off the job title; `null`
                when unclear.
            full_name:
              type: string
              nullable: true
            job_title:
              type: string
              nullable: true
            linkedin_url:
              type: string
              nullable: true
            crm_id:
              type: string
              nullable: true
              description: CRM contact id, when the person is in the CRM.
            email:
              type: string
              nullable: true
            phone:
              type: string
              nullable: true
        people:
          type: array
          description: >-
            The buying committee, the signal's person first: up to 3, one per
            role when LoneScale or your CRM knows them (more after
            `find-people`). Older lists carry `[person]`.
          items:
            $ref: '#/components/schemas/TodaysAccountPerson'
        last_activity_at:
          type: string
          format: date-time
          nullable: true
          description: Last sales activity on the account; `null` when never contacted.
        open_deal:
          type: boolean
        looks_like_your_wins:
          type: boolean
          description: Industry and size typical of your recent closed-won deals.
        former_customer:
          type: boolean
          description: >-
            A deal won more than 18 months ago: a win-back. Current customers (a
            deal won in the last 18 months, or the CRM's customer stage) are
            never listed.
        score:
          type: number
          example: 10.4
        score_parts:
          type: array
          description: How the score adds up.
          items:
            type: object
            properties:
              label:
                type: string
                example: Job change, 10 d old
              points:
                type: number
                example: 6.1
    TodaysAccountPerson:
      type: object
      description: A person to reach at a listed account.
      properties:
        role:
          type: string
          nullable: true
          enum:
            - DECISION_MAKER
            - CHAMPION
            - USER
            - null
          description: >-
            Who they are to the purchase, read off the job title; `null` when
            unclear.
        full_name:
          type: string
          nullable: true
        job_title:
          type: string
          nullable: true
        linkedin_url:
          type: string
          nullable: true
        crm_id:
          type: string
          nullable: true
          description: CRM contact id, when the person is in the CRM.
        email:
          type: string
          nullable: true
        phone:
          type: string
          nullable: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Provide your API key in the x-api-key header.

````

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