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

# Update a monitor

> Update a monitor by ID



## OpenAPI

````yaml post /uptime/monitors/{monitorId}
openapi: 3.1.0
info:
  title: Phare
  description: >-
    Learn how to use the phare.io API. Most of the things that can be done on
    the web platform can also be achieved with the API documented on this page.
  termsOfService: https://phare.io/legal/terms-of-service
  contact:
    name: Phare
    email: support@phare.io
  version: '1.0'
servers:
  - url: https://api.phare.io
security:
  - BearerAuth: []
tags:
  - name: Platform
    description: Platform
  - name: Users
    description: Users
  - name: Projects
    description: Projects
  - name: Alert Rules
    description: Alert Rules
  - name: Integrations
    description: Integrations
  - name: Monitors
    description: Monitors
  - name: Incidents
    description: Incidents
  - name: Maintenance Windows
    description: Maintenance Windows
  - name: Status Pages
    description: Status Pages
  - name: Reports
    description: Reports
paths:
  /uptime/monitors/{monitorId}:
    post:
      tags:
        - Monitors
      summary: Update a monitor
      description: Update a monitor by ID
      operationId: updateUptimeMonitor
      parameters:
        - name: monitorId
          in: path
          description: ID of the monitor to update
          required: true
          schema:
            type: integer
        - $ref: '#/components/parameters/header_project_id'
        - $ref: '#/components/parameters/header_project_slug'
      requestBody:
        description: Monitor request
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  description: Monitor name
                  type: string
                  example: Website
                  maxLength: 45
                  minLength: 2
                protocol:
                  $ref: '#/components/schemas/Uptime.Monitor.ProtocolEnum'
                  description: Monitoring protocol
                request:
                  description: Monitoring request, depends of the chosen protocol
                  type: object
                  oneOf:
                    - title: HTTP protocol
                      required:
                        - method
                        - url
                      properties:
                        method:
                          description: HTTP request method
                          type: string
                          enum:
                            - HEAD
                            - GET
                            - POST
                            - PUT
                            - PATCH
                            - OPTIONS
                        url:
                          description: HTTP request url
                          type: string
                          example: https://docs.phare.io/introduction
                          maxLength: 255
                        tls_skip_verify:
                          description: Skip SSL verification
                          type:
                            - boolean
                            - 'null'
                          example: false
                          default: false
                        body:
                          description: HTTP request body for POST, PUT and PATCH requests
                          type:
                            - string
                            - 'null'
                          example: Hello, World!
                          maxLength: 500
                        follow_redirects:
                          description: Follow redirects
                          type:
                            - boolean
                            - 'null'
                          example: true
                          default: true
                        user_agent_secret:
                          description: >-
                            A secret value to be used in the User-Agent header
                            for authenticating the request
                          type:
                            - string
                            - 'null'
                          example: definitely-not-a-bot
                          maxLength: 50
                          minLength: 1
                        headers:
                          description: Additional HTTP headers to add to the request
                          type:
                            - array
                            - 'null'
                          items:
                            required:
                              - name
                              - value
                            properties:
                              name:
                                description: >-
                                  Header name, the User-Agent, Signature,
                                  Signature-Input and Signature-Agent headers
                                  are not allowed
                                type: string
                                example: X-Phare-Says
                                maxLength: 50
                              value:
                                description: Header value
                                type: string
                                example: Hello world!
                                maxLength: 1024
                            type: object
                          maxItems: 10
                      type: object
                    - title: TCP protocol
                      required:
                        - host
                        - port
                        - connection
                      properties:
                        host:
                          description: TCP request hostname or IP address
                          type: string
                          example: 8.8.8.8
                        port:
                          description: TCP request port, between 1 and 65535
                          type: string
                          example: '80'
                        connection:
                          $ref: '#/components/schemas/Uptime.Monitor.ConnectionEnum'
                          description: Connection type for TCP protocol
                        tls_skip_verify:
                          description: Skip TLS verification
                          type:
                            - boolean
                            - 'null'
                          example: false
                          default: false
                      type: object
                    - title: ICMP protocol
                      required:
                        - host
                      properties:
                        host:
                          description: ICMP request hostname or IP address
                          type: string
                          example: 8.8.8.8
                      type: object
                      additionalProperties: false
                interval:
                  description: Monitoring interval in seconds
                  type: integer
                  example: 60
                  default: 60
                  enum:
                    - 30
                    - 60
                    - 120
                    - 180
                    - 300
                    - 600
                    - 900
                    - 1800
                    - 3600
                timeout:
                  description: Monitoring timeout in milliseconds
                  type: integer
                  example: 20000
                  default: 20000
                  enum:
                    - 1000
                    - 2000
                    - 3000
                    - 4000
                    - 5000
                    - 6000
                    - 7000
                    - 8000
                    - 9000
                    - 10000
                    - 15000
                    - 20000
                    - 25000
                    - 30000
                success_assertions:
                  description: >-
                    List of assertions that must be true for the check to be
                    considered successful. At least one assertion is required
                    for the HTTP protocol, assertions are ignored for the TCP
                    and ICMP protocols.
                  type: array
                  items:
                    oneOf:
                      - title: Status code assertion
                        required:
                          - type
                          - operator
                          - value
                        properties:
                          type:
                            description: >-
                              Type of assertion, only one status code assertion
                              is allowed
                            type: string
                            enum:
                              - status_code
                          operator:
                            description: Operator to use for the assertion
                            type: string
                            example: in
                            enum:
                              - in
                              - not_in
                          value:
                            description: >-
                              A comma-separated list of status code values, you
                              can use x as a wildcard for any digit.
                            type: string
                            example: 2xx,30x,418
                            maxLength: 150
                            minLength: 3
                        type: object
                      - title: Response header assertion
                        required:
                          - type
                          - selector
                          - operator
                          - value
                        properties:
                          type:
                            description: Type of assertion
                            type: string
                            enum:
                              - response_header
                          selector:
                            description: The name of the header to assert
                            type: string
                            example: Content-Type
                            maxLength: 100
                          operator:
                            description: Operator to use for the assertion
                            type: string
                            example: equals
                            enum:
                              - equals
                              - not_equals
                          value:
                            description: The value of the header to assert
                            type: string
                            example: application/json
                            maxLength: 150
                            minLength: 1
                        type: object
                      - title: Response body assertion
                        required:
                          - type
                          - operator
                          - value
                        properties:
                          type:
                            description: >-
                              Type of assertion, not available for HEAD and
                              OPTIONS requests
                            type: string
                            enum:
                              - response_body
                          operator:
                            description: Operator to use for the assertion
                            type: string
                            example: contains
                            enum:
                              - contains
                              - not_contains
                          value:
                            description: A word or sentence to check in the response body
                            type: string
                            example: Hello, World!
                            maxLength: 150
                            minLength: 1
                        type: object
                incident_confirmations:
                  description: >-
                    Number of uninterrupted failed checks required to create an
                    incident
                  type: integer
                  example: 1
                  default: 3
                  enum:
                    - 1
                    - 2
                    - 3
                    - 4
                    - 5
                recovery_confirmations:
                  description: >-
                    Number of uninterrupted successful checks required to
                    resolve an incident
                  type: integer
                  example: 1
                  default: 3
                  enum:
                    - 1
                    - 2
                    - 3
                    - 4
                    - 5
                region_threshold:
                  description: >-
                    Number of regions that must fail before an incident is
                    confirmed, cannot exceed the number of selected regions
                  type: integer
                  example: 1
                  default: 1
                  maximum: 10
                  minimum: 1
                regions:
                  description: List of regions where monitoring checks are performed
                  type: array
                  items:
                    $ref: '#/components/schemas/Uptime.Monitor.RegionEnum'
                  maxItems: 10
                  minItems: 1
                tags:
                  description: >-
                    Resource tags, made of lowercase letters, numbers, `.`, `_`,
                    `:` and `-`. An organization can have up to 200 tags.
                  type:
                    - array
                    - 'null'
                  items:
                    type: string
                    example: environment:production
                    maxLength: 100
                    minLength: 1
                  maxItems: 20
      responses:
        '200':
          description: Success, monitor updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    description: Monitor ID
                    type: integer
                    example: 1
                  project_id:
                    description: Parent project ID
                    type: integer
                    example: 1
                  status:
                    $ref: '#/components/schemas/Uptime.Monitor.StatusEnum'
                    description: Monitor current status
                  paused:
                    description: Whether the monitor is currently paused
                    type: boolean
                    example: true
                  response_time:
                    description: >-
                      75th percentile (P75) response time of successful checks
                      over the last 7 days, in milliseconds
                    type:
                      - integer
                      - 'null'
                    example: 123
                  name:
                    description: Monitor name
                    type: string
                    example: Website
                    maxLength: 45
                    minLength: 2
                  protocol:
                    $ref: '#/components/schemas/Uptime.Monitor.ProtocolEnum'
                    description: Monitoring protocol
                  request:
                    description: Monitoring request, depends of the chosen protocol
                    type: object
                    oneOf:
                      - title: HTTP protocol
                        required:
                          - method
                          - url
                        properties:
                          method:
                            description: HTTP request method
                            type: string
                            enum:
                              - HEAD
                              - GET
                              - POST
                              - PUT
                              - PATCH
                              - OPTIONS
                          url:
                            description: HTTP request url
                            type: string
                            example: https://docs.phare.io/introduction
                            maxLength: 255
                          tls_skip_verify:
                            description: Skip SSL verification
                            type:
                              - boolean
                              - 'null'
                            example: false
                            default: false
                          body:
                            description: HTTP request body for POST, PUT and PATCH requests
                            type:
                              - string
                              - 'null'
                            example: Hello, World!
                            maxLength: 500
                          follow_redirects:
                            description: Follow redirects
                            type:
                              - boolean
                              - 'null'
                            example: true
                            default: true
                          user_agent_secret:
                            description: >-
                              A secret value to be used in the User-Agent header
                              for authenticating the request
                            type:
                              - string
                              - 'null'
                            example: definitely-not-a-bot
                            maxLength: 50
                            minLength: 1
                          headers:
                            description: Additional HTTP headers to add to the request
                            type:
                              - array
                              - 'null'
                            items:
                              required:
                                - name
                                - value
                              properties:
                                name:
                                  description: >-
                                    Header name, the User-Agent, Signature,
                                    Signature-Input and Signature-Agent headers
                                    are not allowed
                                  type: string
                                  example: X-Phare-Says
                                  maxLength: 50
                                value:
                                  description: Header value
                                  type: string
                                  example: Hello world!
                                  maxLength: 1024
                              type: object
                            maxItems: 10
                        type: object
                      - title: TCP protocol
                        required:
                          - host
                          - port
                          - connection
                        properties:
                          host:
                            description: TCP request hostname or IP address
                            type: string
                            example: 8.8.8.8
                          port:
                            description: TCP request port, between 1 and 65535
                            type: string
                            example: '80'
                          connection:
                            $ref: '#/components/schemas/Uptime.Monitor.ConnectionEnum'
                            description: Connection type for TCP protocol
                          tls_skip_verify:
                            description: Skip TLS verification
                            type:
                              - boolean
                              - 'null'
                            example: false
                            default: false
                        type: object
                      - title: ICMP protocol
                        required:
                          - host
                        properties:
                          host:
                            description: ICMP request hostname or IP address
                            type: string
                            example: 8.8.8.8
                        type: object
                        additionalProperties: false
                  interval:
                    description: Monitoring interval in seconds
                    type: integer
                    example: 60
                    default: 60
                    enum:
                      - 30
                      - 60
                      - 120
                      - 180
                      - 300
                      - 600
                      - 900
                      - 1800
                      - 3600
                  timeout:
                    description: Monitoring timeout in milliseconds
                    type: integer
                    example: 20000
                    default: 20000
                    enum:
                      - 1000
                      - 2000
                      - 3000
                      - 4000
                      - 5000
                      - 6000
                      - 7000
                      - 8000
                      - 9000
                      - 10000
                      - 15000
                      - 20000
                      - 25000
                      - 30000
                  success_assertions:
                    description: >-
                      List of assertions that must be true for the check to be
                      considered successful. At least one assertion is required
                      for the HTTP protocol, assertions are ignored for the TCP
                      and ICMP protocols.
                    type: array
                    items:
                      oneOf:
                        - title: Status code assertion
                          required:
                            - type
                            - operator
                            - value
                          properties:
                            type:
                              description: >-
                                Type of assertion, only one status code
                                assertion is allowed
                              type: string
                              enum:
                                - status_code
                            operator:
                              description: Operator to use for the assertion
                              type: string
                              example: in
                              enum:
                                - in
                                - not_in
                            value:
                              description: >-
                                A comma-separated list of status code values,
                                you can use x as a wildcard for any digit.
                              type: string
                              example: 2xx,30x,418
                              maxLength: 150
                              minLength: 3
                          type: object
                        - title: Response header assertion
                          required:
                            - type
                            - selector
                            - operator
                            - value
                          properties:
                            type:
                              description: Type of assertion
                              type: string
                              enum:
                                - response_header
                            selector:
                              description: The name of the header to assert
                              type: string
                              example: Content-Type
                              maxLength: 100
                            operator:
                              description: Operator to use for the assertion
                              type: string
                              example: equals
                              enum:
                                - equals
                                - not_equals
                            value:
                              description: The value of the header to assert
                              type: string
                              example: application/json
                              maxLength: 150
                              minLength: 1
                          type: object
                        - title: Response body assertion
                          required:
                            - type
                            - operator
                            - value
                          properties:
                            type:
                              description: >-
                                Type of assertion, not available for HEAD and
                                OPTIONS requests
                              type: string
                              enum:
                                - response_body
                            operator:
                              description: Operator to use for the assertion
                              type: string
                              example: contains
                              enum:
                                - contains
                                - not_contains
                            value:
                              description: A word or sentence to check in the response body
                              type: string
                              example: Hello, World!
                              maxLength: 150
                              minLength: 1
                          type: object
                  incident_confirmations:
                    description: >-
                      Number of uninterrupted failed checks required to create
                      an incident
                    type: integer
                    example: 1
                    default: 3
                    enum:
                      - 1
                      - 2
                      - 3
                      - 4
                      - 5
                  recovery_confirmations:
                    description: >-
                      Number of uninterrupted successful checks required to
                      resolve an incident
                    type: integer
                    example: 1
                    default: 3
                    enum:
                      - 1
                      - 2
                      - 3
                      - 4
                      - 5
                  region_threshold:
                    description: >-
                      Number of regions that must fail before an incident is
                      confirmed, cannot exceed the number of selected regions
                    type: integer
                    example: 1
                    default: 1
                    maximum: 10
                    minimum: 1
                  regions:
                    description: List of regions where monitoring checks are performed
                    type: array
                    items:
                      $ref: '#/components/schemas/Uptime.Monitor.RegionEnum'
                    maxItems: 10
                    minItems: 1
                  tags:
                    description: >-
                      Resource tags, made of lowercase letters, numbers, `.`,
                      `_`, `:` and `-`. An organization can have up to 200 tags.
                    type:
                      - array
                      - 'null'
                    items:
                      type: string
                      example: environment:production
                      maxLength: 100
                      minLength: 1
                    maxItems: 20
                  last_checked_at:
                    description: Date of the last performed check with a 30s accuracy
                    type:
                      - string
                      - 'null'
                    format: date-time
                  created_at:
                    description: Date of creation for the entity
                    type: string
                    format: date-time
                  updated_at:
                    description: Date of last update for the entity
                    type: string
                    format: date-time
                required:
                  - name
                  - protocol
                  - request
                  - regions
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '422':
          $ref: '#/components/responses/422'
components:
  parameters:
    header_project_id:
      name: X-Phare-Project-Id
      in: header
      description: A project header is required when using an organization-scoped API key.
      required: false
      schema:
        type: integer
        example: 1
    header_project_slug:
      name: X-Phare-Project-Slug
      in: header
      description: A project header is required when using an organization-scoped API key.
      required: false
      schema:
        type: string
        example: luminous-guiding-tower
  schemas:
    Uptime.Monitor.ProtocolEnum:
      type: string
      enum:
        - http
        - tcp
        - icmp
    Uptime.Monitor.ConnectionEnum:
      type: string
      enum:
        - plain
        - tls
    Uptime.Monitor.RegionEnum:
      type: string
      enum:
        - as-jpn-hnd
        - as-sgp-sin
        - as-tha-bkk
        - eu-deu-fra
        - eu-fra-cdg
        - eu-gbr-lhr
        - eu-swe-arn
        - ng-nld-ams
        - na-mex-mex
        - na-usa-iad
        - na-usa-sea
        - oc-aus-syd
        - sa-bra-gru
    Uptime.Monitor.StatusEnum:
      type: string
      enum:
        - fetching
        - online
        - offline
        - partial
        - paused
  responses:
    '401':
      description: Error, access unauthorized
      content:
        application/json:
          schema:
            description: Access unauthorized error schema
            properties:
              message:
                type: string
                example: Unauthenticated.
            type: object
    '403':
      description: Error, access forbidden
      content:
        application/json:
          schema:
            description: Access forbidden error schema
            properties:
              message:
                type: string
                example: >-
                  The platform:write permission is required to perform this
                  action.
            type: object
    '404':
      description: Error, resource not found
      content:
        application/json:
          schema:
            description: Not found error schema
            properties:
              message:
                type: string
                example: Record not found.
            type: object
    '422':
      description: Error, unprocessable entity
      content:
        application/json:
          schema:
            description: Validation error schema
            properties:
              message:
                type: string
              errors:
                properties:
                  key:
                    type: array
                    items:
                      type: string
                      example: The key field is required
                type: object
            type: object
  securitySchemes:
    BearerAuth:
      type: http
      description: >-
        Use a user token to access authenticated routes. The token must be
        specified in the Authorization HTTP header with the following format
        'Authorization: Bearer <token>'.
      scheme: bearer

````

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