# Scroll over all companies

`GET /companies/scroll`

> This is a subset of the full specification, limited to the `GET /companies/scroll` operation.
>
> You can find the full specification here: /_bundle/docs/references/@2.11/rest-api/api.intercom.io.yaml

```yaml
openapi: 3.0.1
info:
  title: Intercom API
  version: '2.11'
  description: This is a subset of the full specification, limited to the `GET /companies/scroll` operation.
  contact:
    name: Intercom Developer Hub
    url: https://developers.intercom.com
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
servers:
  - url: https://api.intercom.io
    description: The production API server
  - url: https://api.eu.intercom.io
    description: The european API server
  - url: https://api.au.intercom.io
    description: The australian API server
security:
  - bearerAuth: []
tags:
  - name: Companies
    description: Everything about your Companies
paths:
  /companies/scroll:
    get:
      summary: Scroll over all companies
      parameters:
        - name: Intercom-Version
          in: header
          schema:
            $ref: '#/components/schemas/intercom_version'
        - name: scroll_param
          in: query
          required: false
          description: ''
          schema:
            type: string
      tags:
        - Companies
      operationId: scrollOverAllCompanies
      description: |-
        The `list all companies` functionality does not work well for huge datasets, and can result in errors and performance problems when paging deeply. The Scroll API provides an efficient mechanism for iterating over all companies in a dataset.

        - Each app can only have 1 scroll open at a time. You'll get an error message if you try to have more than one open per app.
        - If the scroll isn't used for 1 minute, it expires and calls with that scroll param will fail
        - If the end of the scroll is reached, "companies" will be empty and the scroll parameter will expire

        **Scroll Parameter**

        You can get the first page of companies by simply sending a GET request to the scroll endpoint.
        For subsequent requests you will need to use the scroll parameter from the response.

        **Scroll network timeouts**

        Since scroll is often used on large datasets network errors such as timeouts can be encountered. When this occurs you will see a HTTP 500 error with the following message:
        "Request failed due to an internal network error. Please restart the scroll operation."
        If this happens, you will need to restart your scroll query: It is not possible to continue from a specific point when using scroll.
      responses:
        '200':
          description: Successful
          content:
            application/json:
              examples:
                Successful:
                  value:
                    type: list
                    data:
                      - type: company
                        company_id: remote_companies_scroll_2
                        id: 667d608b8a68186f43bafd67
                        app_id: this_is_an_id162_that_should_be_at_least_
                        name: IntercomQATest1
                        remote_created_at: 1719492747
                        created_at: 1719492747
                        updated_at: 1719492747
                        monthly_spend: 0
                        session_count: 0
                        user_count: 4
                        tags:
                          type: tag.list
                          tags: []
                        segments:
                          type: segment.list
                          segments: []
                        plan: {}
                        custom_attributes: {}
                    pages: null
                    total_count: null
                    scroll_param: 12d403b5-dc79-47b5-8ea1-01a5ac8cb6cc
              schema:
                $ref: '#/components/schemas/company_scroll'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    type: error.list
                    request_id: 4b3ca8b1-8983-4fb8-abc5-b20a4ece5d32
                    errors:
                      - code: unauthorized
                        message: Access Token Invalid
              schema:
                $ref: '#/components/schemas/error'
components:
  schemas:
    company:
      title: Company
      type: object
      x-tags:
        - Companies
      description: Companies allow you to represent organizations using your product. Each company will have its own description and be associated with contacts. You can fetch, create, update and list companies.
      required:
        - company_id
        - id
        - app_id
        - name
        - remote_created_at
        - created_at
        - updated_at
        - last_request_at
        - monthly_spend
        - session_count
        - user_count
        - size
        - website
        - industry
      properties:
        type:
          type: string
          description: Value is `company`
          enum:
            - company
          example: company
        id:
          type: string
          description: The Intercom defined id representing the company.
          example: 531ee472cce572a6ec000006
        name:
          type: string
          description: The name of the company.
          example: Blue Sun
        app_id:
          type: string
          description: The Intercom defined code of the workspace the company is associated to.
          example: ecahpwf5
        plan:
          type: object
          properties:
            type:
              type: string
              description: Value is always "plan"
              example: plan
              enum:
                - plan
            id:
              type: string
              description: The id of the plan
              example: '269315'
            name:
              type: string
              description: The name of the plan
              example: Pro
        company_id:
          type: string
          description: The company id you have defined for the company.
          example: '6'
        remote_created_at:
          type: integer
          description: The time the company was created by you.
          example: 1663597223
        created_at:
          type: integer
          description: The time the company was added in Intercom.
          example: 1663597223
        updated_at:
          type: integer
          description: The last time the company was updated.
          example: 1663597223
        last_request_at:
          type: integer
          description: The time the company last recorded making a request.
          example: 1663597223
        size:
          type: integer
          description: The number of employees in the company.
          example: 100
        website:
          type: string
          description: The URL for the company website.
          example: https://www.intercom.com
        industry:
          type: string
          description: The industry that the company operates in.
          example: Software
        monthly_spend:
          type: integer
          description: How much revenue the company generates for your business.
          example: 100
        session_count:
          type: integer
          description: How many sessions the company has recorded.
          example: 100
        user_count:
          type: integer
          description: The number of users in the company.
          example: 100
        custom_attributes:
          type: object
          description: The custom attributes you have set on the company.
          additionalProperties:
            type: string
          example:
            paid_subscriber: true
            monthly_spend: 155.5
            team_mates: 9
        tags:
          type: object
          description: The list of tags associated with the company
          properties:
            type:
              type: string
              description: The type of the object
              enum:
                - tag.list
            tags:
              type: array
              items:
                $ref: '#/components/schemas/tag_basic'
        segments:
          type: object
          description: The list of segments associated with the company
          properties:
            type:
              type: string
              description: The type of the object
              enum:
                - segment.list
            segments:
              type: array
              items:
                $ref: '#/components/schemas/segment'
    company_scroll:
      title: Company Scroll
      type: object
      description: Companies allow you to represent organizations using your product. Each company will have its own description and be associated with contacts. You can fetch, create, update and list companies.
      properties:
        type:
          type: string
          description: The type of object - `list`
          enum:
            - list
          example: list
        data:
          type: array
          items:
            $ref: '#/components/schemas/company'
        pages:
          $ref: '#/components/schemas/cursor_pages'
        total_count:
          type: integer
          description: The total number of companies
          nullable: true
          example: 100
        scroll_param:
          type: string
          description: The scroll parameter to use in the next request to fetch the next page of results.
          example: 25b649f7-4d33-4ef6-88f5-60e5b8244309
      required:
        - type
        - data
        - total_count
    cursor_pages:
      title: Cursor based pages
      type: object
      description: |
        Cursor-based pagination is a technique used in the Intercom API to navigate through large amounts of data.
        A "cursor" or pointer is used to keep track of the current position in the result set, allowing the API to return the data in small chunks or "pages" as needed.
      properties:
        type:
          type: string
          description: the type of object `pages`.
          example: pages
          enum:
            - pages
        page:
          type: integer
          description: The current page
          example: 1
        next:
          $ref: '#/components/schemas/starting_after_paging'
          nullable: true
        per_page:
          type: integer
          description: Number of results per page
          example: 2
        total_pages:
          type: integer
          description: Total number of pages
          example: 13
      required:
        - type
    error:
      type: object
      title: Error
      description: The API will return an Error List for a failed request, which will contain one or more Error objects.
      properties:
        type:
          type: string
          description: The type is error.list
          example: error.list
        request_id:
          type: string
          nullable: true
          format: uuid
          description: ''
          example: f93ecfa8-d08a-4325-8694-89aeb89c8f85
        errors:
          type: array
          description: An array of one or more error objects
          items:
            properties:
              code:
                type: string
                description: A string indicating the kind of error, used to further qualify the HTTP response code
                example: unauthorized
              message:
                type: string
                nullable: true
                description: Optional. Human readable description of the error.
                example: Access Token Invalid
              field:
                type: string
                nullable: true
                description: Optional. Used to identify a particular field or query parameter that was in error.
                example: email
            required:
              - code
      required:
        - type
        - errors
    intercom_version:
      description: Intercom API version.</br>By default, it's equal to the version set in the app package.
      type: string
      example: '2.11'
      default: '2.11'
      enum:
        - '1.0'
        - '1.1'
        - '1.2'
        - '1.3'
        - '1.4'
        - '2.0'
        - '2.1'
        - '2.2'
        - '2.3'
        - '2.4'
        - '2.5'
        - '2.6'
        - '2.7'
        - '2.8'
        - '2.9'
        - '2.10'
        - '2.11'
        - Preview
    segment:
      title: Segment
      type: object
      x-tags:
        - Segments
      description: A segment is a group of your contacts defined by the rules that you set.
      required:
        - type
        - id
        - name
        - created_at
        - person_type
      properties:
        type:
          type: string
          description: The type of object.
          enum:
            - segment
          example: segment
        id:
          type: string
          description: The unique identifier representing the segment.
          example: 56203d253cba154d39010062
        name:
          type: string
          description: The name of the segment.
          example: Active
        created_at:
          type: integer
          description: The time the segment was created.
          example: 1394621988
        updated_at:
          type: integer
          description: The time the segment was updated.
          example: 1394622004
        person_type:
          type: string
          description: 'Type of the contact: contact (lead) or user.'
          enum:
            - contact
            - user
          example: contact
        count:
          type: integer
          description: The number of items in the user segment. It's returned when `include_count=true` is included in the request.
          example: 3
          nullable: true
    starting_after_paging:
      title: 'Pagination: Starting After'
      type: object
      properties:
        per_page:
          type: integer
          description: The number of results to fetch per page.
          example: 2
        starting_after:
          type: string
          description: The cursor to use in the next request to get the next page of results.
          nullable: true
          example: your-cursor-from-response
      required:
        - per_page
    tag_basic:
      title: Tag
      type: object
      x-tags:
        - Tags
      description: A tag allows you to label your contacts, companies, and conversations and list them using that tag.
      properties:
        type:
          type: string
          description: value is "tag"
          example: tag
        id:
          type: string
          description: The id of the tag
          example: '123456'
        name:
          type: string
          description: The name of the tag
          example: Test tag
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
```
