# Create an external page (or update an external page by external ID)

`POST /ai/external_pages`

> This is a subset of the full specification, limited to the `POST /ai/external_pages` operation.
>
> You can find the full specification here: /_bundle/docs/references/@2.12/rest-api/api.intercom.io.yaml

```yaml
openapi: 3.0.1
info:
  title: Intercom API
  version: '2.12'
  description: This is a subset of the full specification, limited to the `POST /ai/external_pages` 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: AI Content
    description: |
      With the AI Content APIs, you can create and manage External Pages and Content Import Sources for your Fin Content Library.

      &nbsp;

      *External Pages* are pages that you want Fin to be able to answer questions about. The API for External Pages is a great way to ingest into your Fin Content Library pages that are not publicly accessible and hence can't be crawled by Intercom.

      &nbsp;

      *Content Import Sources* are the sources of those pages, and they are used to determine the default audience for the pages (configured via the UI). You should create a Content Import Source for each source of External Pages that you want to ingest into your Fin Content Library.

      &nbsp;

      You can then iterate through the content from that source via its API and POST it to the External Pages endpoint. That endpoint has an *external_id* parameter which allows you to specify the identifier from the source. The endpoint will then either create a new External Page or update an existing one as appropriate.",
paths:
  /ai/external_pages:
    post:
      summary: Create an external page (or update an external page by external ID)
      parameters:
        - name: Intercom-Version
          in: header
          schema:
            $ref: '#/components/schemas/intercom_version'
      tags:
        - AI Content
      operationId: createExternalPage
      description: You can create a new external page by sending a POST request to this endpoint. If an external page already exists with the specified source_id and external_id, it will be updated instead.
      responses:
        '200':
          description: successful
          content:
            application/json:
              examples:
                successful:
                  value:
                    id: '5'
                    type: external_page
                    title: Test
                    html: <html><body><h1>Test</h1></body></html>
                    url: https://www.example.com
                    ai_agent_availability: true
                    ai_copilot_availability: true
                    fin_availability: true
                    locale: en
                    source_id: 12
                    external_id: abc1234
                    created_at: 1736201414
                    updated_at: 1736201414
                    last_ingested_at: 1736201414
              schema:
                $ref: '#/components/schemas/external_page'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    type: error.list
                    request_id: 3a379a5d-771f-4e0f-b8e4-74a5f20e2f2b
                    errors:
                      - code: unauthorized
                        message: Access Token Invalid
              schema:
                $ref: '#/components/schemas/error'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_external_page_request'
            examples:
              successful:
                summary: successful
                value:
                  external_id: abc1234
                  html: <html><body><h1>Test</h1></body></html>
                  locale: en
                  source_id: 12
                  title: Test
                  url: https://www.example.com
components:
  schemas:
    create_external_page_request:
      title: Create External Page Payload
      type: object
      description: You can add an External Page to your Fin Content Library.
      nullable: false
      properties:
        title:
          type: string
          description: The title of the external page.
          example: Getting started with...
        html:
          type: string
          description: The body of the external page in HTML.
          example: <p>Hello world!</p>
        url:
          type: string
          description: The URL of the external page. This will be used by Fin to link end users to the page it based its answer on. When a URL is not present, Fin will not reference the source.
          example: https://help.example.com/en/articles/1234-getting-started
        ai_agent_availability:
          type: boolean
          description: Whether the external page should be used to answer questions by AI Agent. Will not default when updating an existing external page.
          default: false
          example: true
        ai_copilot_availability:
          type: boolean
          description: Whether the external page should be used to answer questions by AI Copilot. Will not default when updating an existing external page.
          default: false
          example: true
        locale:
          type: string
          description: Always en
          enum:
            - en
          default: en
          example: en
        source_id:
          type: integer
          description: The unique identifier for the source of the external page which was given by Intercom. Every external page must be associated with a Content Import Source which represents the place it comes from and from which it inherits a default audience (configured in the UI). For a new source, make a POST request to the Content Import Source endpoint and an ID for the source will be returned in the response.
          example: 1234
        external_id:
          type: string
          description: The identifier for the external page which was given by the source. Must be unique for the source.
          example: '5678'
      required:
        - title
        - html
        - locale
        - source_id
        - external_id
    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
    external_page:
      title: External Page
      type: object
      x-tags:
        - AI Content
      description: External pages that you have added to your Fin Content Library.
      nullable: false
      properties:
        type:
          type: string
          description: Always external_page
          enum:
            - external_page
          default: external_page
          example: external_page
        id:
          type: string
          description: The unique identifier for the external page which is given by Intercom.
          example: '1234'
        title:
          type: string
          description: The title of the external page.
          example: Getting started with...
        html:
          type: string
          description: The body of the external page in HTML.
          example: <p>Hello world!</p>
        url:
          type: string
          description: The URL of the external page. This will be used by Fin to link end users to the page it based its answer on.
          example: https://help.example.com/en/articles/1234-getting-started
        ai_agent_availability:
          type: boolean
          description: Whether the external page should be used to answer questions by AI Agent.
          example: true
        ai_copilot_availability:
          type: boolean
          description: Whether the external page should be used to answer questions by AI Copilot.
          example: true
        fin_availability:
          type: boolean
          description: Deprecated. Use ai_agent_availability and ai_copilot_availability instead.
          example: true
        locale:
          type: string
          description: Always en
          enum:
            - en
          default: en
          example: en
        source_id:
          type: integer
          description: The unique identifier for the source of the external page which was given by Intercom. Every external page must be associated with a Content Import Source which represents the place it comes from and from which it inherits a default audience (configured in the UI). For a new source, make a POST request to the Content Import Source endpoint and an ID for the source will be returned in the response.
          example: 1234
        external_id:
          type: string
          description: The identifier for the external page which was given by the source. Must be unique for the source.
          example: '5678'
        created_at:
          type: integer
          format: date-time
          description: The time when the external page was created.
          example: 1672928359
        updated_at:
          type: integer
          format: date-time
          description: The time when the external page was last updated.
          example: 1672928610
        last_ingested_at:
          type: integer
          format: date-time
          description: The time when the external page was last ingested.
          example: 1672928610
      required:
        - id
        - type
        - title
        - html
        - ai_agent_availability
        - ai_copilot_availability
        - locale
        - source_id
        - created_at
        - updated_at
        - last_ingested_at
        - external_id
    intercom_version:
      description: Intercom API version.</br>By default, it's equal to the version set in the app package.
      type: string
      example: '2.12'
      default: '2.12'
      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'
        - '2.12'
        - Preview
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
```
