# Create a customer timeline comment

`POST /customers/{id}/timeline`

> This is a subset of the full specification, limited to the `POST /customers/{id}/timeline` operation.
>
> You can find the full specification here: /_bundle/docs/dev-docs/api/index.yaml

```yaml
openapi: 3.1.1
info:
  version: latest
  title: Core APIs
  contact:
    name: Rebilly API Support
    url: https://www.rebilly.com/contact/
    email: integrations@rebilly.com
  license:
    name: Rebilly
    url: https://www.rebilly.com/api-license/
  termsOfService: https://www.rebilly.com/terms-of-use/
  x-logo:
    url: https://rebilly-core.redoc.ly/rb_apiLogo.svg
    backgroundColor: '#0044d4'
  description: This is a subset of the full specification, limited to the `POST /customers/{id}/timeline` operation. Components more than 3 `$ref` hops away are not included.
  x-metadata:
    description: The most common APIs used to automate common workflows.
    redocly_category: API Reference
servers:
  - url: https://api-sandbox.rebilly.com/organizations/{organizationId}
    description: Sandbox server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
  - url: https://api.rebilly.com/organizations/{organizationId}
    description: Live server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
security:
  - SecretApiKey: []
  - JWT: []
tags:
  - name: Customers timeline
    description: Use customer timelines to maintain an audit trail of changes and activity for each customer.
x-tagGroups:
  - name: Customers
    tags:
      - Customers timeline
paths:
  /customers/{id}/timeline:
    parameters:
      - $ref: '#/components/parameters/resourceId'
    post:
      x-products:
        - Core
      tags:
        - Customers timeline
      summary: Create a customer timeline comment
      operationId: PostCustomerTimeline
      x-sdk-operation-name: createTimelineComment
      description: Creates a customer timeline comment or custom defined event.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerTimeline'
        description: Customer timeline resource.
        required: true
      responses:
        '201':
          description: Customer timeline comment or custom defined event created.
          headers:
            Location:
              $ref: '#/components/headers/Location'
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            // Create a comment
            const firstComment = await api
                .customers.createTimelineComment({id: 'my-customer-id', data: {message: 'Your comment here'}});

            // Using params object, mentions and references
            const message = `Example of mentions @user@mydomain.com and references #customers-customer-id`;
            const params = {
                id: 'my-customer-id',
                data: {
                    message,
                },
            };
            const secondComment = await api.customers.createTimelineComment(params);
components:
  securitySchemes:
    JWT:
      description: |-
        JWT is a short lifetime token that can be assigned a specific expiration time.

        Usage format: `Bearer <JWT>`.
      type: http
      scheme: bearer
      bearerFormat: JWT
    SecretApiKey:
      description: |-
        Never share your secret keys.
        Keep them guarded and secure.

        Use your secret API key only to make requests from the server side.
        To authenticate, provide your secret key in the request header.
      name: REB-APIKEY
      type: apiKey
      in: header
  parameters:
    resourceId:
      name: id
      in: path
      description: ID of the resource.
      required: true
      schema:
        type: string
        maxLength: 50
        pattern: ^[@~\-\.\w]+$
  headers:
    Location:
      description: Location of the related resource.
      schema:
        type: string
        format: uri
      example: https://api.rebilly.com/example
    Rate-Limit-Limit:
      description: |-
        Maximum number of requests available at one time for this rate limit.
        For more information, see [Rate limits](#section/Rate-limits).
      schema:
        type: integer
      example: 500
    Rate-Limit-Remaining:
      description: |-
        Number of requests still available for this rate limit.
        For more information, see [Rate limits](#section/Rate-limits).
      schema:
        type: integer
      example: 499
    Rate-Limit-Retry-After:
      description: Number of seconds to wait before retrying the request.
      schema:
        type: integer
      example: 1
  schemas:
    ResourceId:
      type: string
      description: Unique resource ID.
      maxLength: 50
      example: 4f6cf35x-2c4y-483z-a0a9-158621f77a21
    SelfLink:
      type: array
      description: Related links.
      readOnly: true
      items:
        type: object
        properties:
          href:
            description: Link URL.
            type: string
          rel:
            description: Type of link.
            type: string
            enum:
              - self
    BaseProblem:
      type: object
      additionalProperties: true
      minProperties: 1
      description: RFC-7807 [problem details](https://tools.ietf.org/html/rfc7807) JSON object.
      properties:
        type:
          type: string
          description: |-
            Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
            It should provide human-readable documentation for the problem type.
            When this member is not present, its value is assumed to be "about:blank".
          format: uri
        title:
          type: string
          description: |-
            Short, human-readable summary of the problem type.
            Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
        detail:
          type: string
          description: Human-readable explanation that is specific to this occurrence of the problem.
        instance:
          type: string
          description: |-
            URI reference that identifies the specific occurrence of the problem.
            It may or may not yield further information if dereferenced.
    Unauthorized:
      allOf:
        - title: Unauthorized
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 401
              maximum: 401
        - $ref: '#/components/schemas/BaseProblem'
    OrganizationId:
      type: string
      description: |-
        Unique organization identifier.
        An organization is an entity that represents a company.
        For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
      maxLength: 50
      example: org_0YVDM8RC7GDADADSBSMW124JA8
    Forbidden:
      allOf:
        - title: Forbidden
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 403
              maximum: 403
            error:
              type: string
              description: |-
                Message that describes why the request is forbidden.
                Most responses use a descriptive message, such as `Not allowed to change security settings`.
                If the organization requires multi-factor authentication (MFA) and MFA verification has not been completed for the session, this value is `mfa_required`.
                If MFA verification has not been completed for the session and the operation requires a confirmed session, this value is `mfa_required_for_caller`.
                This includes turning on `requireMfa` and resetting MFA for a user.
                If the organization restricts access to a list of IP addresses and the request comes from an IP address that is not in the list, this value is `ip_not_allowed`.
            organizationId:
              description: |-
                ID of the organization that requires MFA or does not allow the IP address of the request.
                This property is present only if `error` is `mfa_required` or `ip_not_allowed`.
                The organization is the organization of the request or another organization that the request acts on.
              $ref: '#/components/schemas/OrganizationId'
        - $ref: '#/components/schemas/BaseProblem'
    InvalidFields:
      type: array
      description: Invalid field details.
      items:
        type: object
        properties:
          field:
            type: string
            description: |-
              Name of the field.
              Dot notation is used for nested object field names.
          message:
            description: Message field.
            type: string
      example:
        - field: field1
          message: field1 is invalid
        - field: subObject.field2
          message: field2 is invalid
        - field: subObject.field2
          message: another error in the field2
    ValidationError:
      allOf:
        - title: Validation error
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 422
              maximum: 422
        - $ref: '#/components/schemas/BaseProblem'
        - type: object
          properties:
            invalidFields:
              $ref: '#/components/schemas/InvalidFields'
    TooManyRequests:
      type: object
      additionalProperties: true
      minProperties: 1
      description: RFC-7807 [problem details](https://tools.ietf.org/html/rfc7807) JSON object.
      properties:
        type:
          type: string
          description: |-
            Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
            It should provide human-readable documentation for the problem type.
            When this member is not present, its value is assumed to be "about:blank".
          format: uri
          example: about:blank
        title:
          type: string
          description: |-
            Short, human-readable summary of the problem type.
            Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
          example: Rate Limit Exceeded
        status:
          type: integer
          description: HTTP status code.
          minimum: 429
          maximum: 429
        detail:
          type: string
          description: Human-readable explanation that is specific to this occurrence of the problem.
          example: A request cannot be executed because the user has sent too many requests within a certain period of time
        instance:
          type: string
          description: |-
            URI reference that identifies the specific occurrence of the problem.
            It may or may not yield further information if dereferenced.
    TimelineAction:
      type: object
      discriminator:
        propertyName: action
        mapping:
          redemption-cancel: '#/components/schemas/RedemptionCancelTimelineAction'
          resend-email: '#/components/schemas/ResendEmailTimelineAction'
          ruleset-restore: '#/components/schemas/RulesetRestoreTimelineAction'
      oneOf:
        - $ref: '#/components/schemas/RedemptionCancelTimelineAction'
        - $ref: '#/components/schemas/ResendEmailTimelineAction'
        - $ref: '#/components/schemas/RulesetRestoreTimelineAction'
    TimelineTable:
      type: object
      description: Additional timeline message information.
      discriminator:
        propertyName: type
        mapping:
          three-columns: '#/components/schemas/ThreeColumnsTimelineTable'
          two-columns: '#/components/schemas/TwoColumnsTimelineTable'
          one-column: '#/components/schemas/OneColumnTimelineTable'
          list: '#/components/schemas/ListTimelineTable'
      properties:
        type:
          type: string
          enum:
            - list
            - one-columns
            - two-columns
            - three-columns
        title:
          type: string
          description: Data table title.
        footer:
          type: string
          description: Data table footer.
    ThreeColumnsTimelineTable:
      allOf:
        - $ref: '#/components/schemas/TimelineTable'
        - type: object
          properties:
            data:
              type: array
              description: |-
                Table data.
                Each array element represents a table row.
              items:
                type: object
                properties:
                  attribute:
                    type: string
                  previousValue:
                    type:
                      - string
                      - integer
                      - number
                      - boolean
                  newValue:
                    type:
                      - string
                      - integer
                      - number
                      - boolean
                example:
                  attribute: Descriptor
                  previousValue: test.com
                  newValue: new-test.com
    TwoColumnsTimelineTable:
      allOf:
        - $ref: '#/components/schemas/TimelineTable'
        - type: object
          properties:
            data:
              type: array
              description: |-
                Table data.
                Each array element represents a table row.
              items:
                type: object
                properties:
                  attribute:
                    type: string
                  value:
                    type:
                      - string
                      - integer
                      - number
                      - boolean
                example:
                  attribute: Who
                  value: John Doe
    OneColumnTimelineTable:
      allOf:
        - $ref: '#/components/schemas/TimelineTable'
        - type: object
          properties:
            data:
              type: array
              description: |-
                Table data.
                Each array element represents a table row.
              items:
                type: object
                properties:
                  attribute:
                    type: string
                  value:
                    type:
                      - string
                      - integer
                      - number
                      - boolean
                example:
                  attribute: Who
                  value: John Doe
    ListTimelineTable:
      allOf:
        - $ref: '#/components/schemas/TimelineTable'
        - type: object
          properties:
            data:
              type: array
              description: |-
                Table data.
                Each array element represents a table row.
              items:
                type: string
    TimelineExtraData:
      type: object
      description: Additional data.
      readOnly: true
      properties:
        actions:
          description: |-
            Actions available for a timeline message.
            If no actions are available, this field is empty.
          type: array
          minItems: 0
          items:
            $ref: '#/components/schemas/TimelineAction'
        tables:
          description: Table data that is attached to the timeline message.
          type: array
          minItems: 0
          items:
            $ref: '#/components/schemas/TimelineTable'
        author:
          type: object
          description: Author of the timeline message.
          properties:
            userFullName:
              description: Full name of the author.
              type: string
            userId:
              description: ID of the author.
              type: string
              maxLength: 50
              example: usr_0YVCEENYJ3D7Q9EN6BN16HA0G4
        mentions:
          description: User mentions, or tags, in a timeline.
          type: object
          additionalProperties:
            type: string
          example:
            '@test@mail.com': userId-1
        links:
          description: Links that are attached to a timeline message.
          type: array
          items:
            type: object
            properties:
              resourceType:
                type: string
                enum:
                  - kyc-document
                  - invoice
                  - subscription
                  - transaction
                  - email-message
                  - dispute
                  - coupon
                  - external
                  - payout-request-batch
                  - replay-promotion-claim
                  - replay-player-level-reward-award
              resourceId:
                $ref: '#/components/schemas/ResourceId'
              placeholder:
                type: string
                example: KYC document
              externalUrl:
                type: string
                example: http://example.com
    ServerTimestamp:
      type: string
      description: Read-only timestamp in ISO 8601 date-time format.
      format: date-time
      readOnly: true
    CustomerTimeline:
      type: object
      properties:
        id:
          type: string
          description: ID of the customer timeline custom event.
          readOnly: true
          maxLength: 50
          example: tmln_0YV8Q9WEF5DTA8HFXS27D1G6GC
        type:
          description: Type of timeline message.
          type: string
          enum:
            - account-password-reset-requested
            - account-verification-requested
            - aml-list-was-possibly-matched
            - bonus-cleared
            - bonus-expired
            - bonus-forfeited
            - bonus-granted
            - deposit-request-completed
            - deposit-request-created
            - deposit-request-expired
            - deposit-request-started
            - coupon-applied
            - coupon-redeemed
            - coupon-redemption-canceled
            - custom-event
            - custom-event-processed
            - custom-fields-changed
            - customer-bank-account-blocked
            - customer-bank-account-unblocked
            - customer-blocked
            - customer-comment-created
            - customer-created
            - customer-id-unblocked
            - customer-merged
            - customer-payment-card-blocked
            - customer-payment-card-unblocked
            - customer-requested-otp
            - customer-tagged
            - customer-untagged
            - default-payment-instrument-changed
            - email-message-sent
            - experian-check-performed
            - invoice-abandoned
            - invoice-created
            - invoice-disputed
            - invoice-issued
            - invoice-paid
            - invoice-partially-paid
            - invoice-partially-refunded
            - invoice-past-due
            - invoice-refunded
            - invoice-reissued
            - invoice-revenue-recognized
            - invoice-voided
            - kyc-document-accepted
            - kyc-document-created
            - kyc-document-modified
            - kyc-document-rejected
            - kyc-document-reviewed
            - kyc-request-fulfilled
            - lead-source-changed
            - order-activated
            - order-canceled
            - order-churned
            - order-completed
            - order-created
            - order-downgraded
            - order-change-applied
            - order-change-canceled
            - order-change-created
            - order-paid-early
            - order-reactivated
            - order-renewed
            - order-trial-converted
            - order-trial-ended
            - order-upgraded
            - payment-card-expiration-was-modified
            - payment-card-expired
            - payment-instrument-created
            - payment-instrument-deactivated
            - primary-address-changed
            - quickbooks-customer-created
            - quickbooks-customer-task-failed
            - quote-canceled
            - quote-created
            - quote-expired
            - quote-issued
            - quote-order-attached
            - quote-recalled
            - quote-rejected
            - quote-updated
            - refund-was-reflected-in-invoices
            - subscription-pause-created
            - subscription-pause-revoked
            - subscription-paused
            - subscription-resumed
            - subscription-trial-end-changed
            - transaction-abandoned
            - transaction-amount-discrepancy-found
            - transaction-approved
            - transaction-canceled
            - transaction-declined
            - transaction-discrepancy-found
            - transaction-disputed
            - transaction-reconciled
            - transaction-partially-refunded
            - transaction-refunded
            - transaction-voided
            - transaction-waiting-gateway
            - wallet-admin-credited
            - wallet-admin-debited
        customEventType:
          description: |-
            Timeline custom event type.
            Used with `custom-event` type.
            This value must be defined using the Create customer timeline custom event type operation.
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 255
        customData:
          description: |-
            Timeline custom event data.
            Used with `custom-event` type.
            Transforms to `extraData` two-column table in response.
          type: object
          writeOnly: true
          example:
            customAttribute: customValue
            otherAttribute: otherValue
        triggeredBy:
          description: Specifies who, or what, triggered the timeline event.
          type: string
          readOnly: true
          enum:
            - rebilly
            - app
            - direct-api
        message:
          description: Detailed message description.
          type: string
        extraData:
          $ref: '#/components/schemas/TimelineExtraData'
        occurredTime:
          description: Date and time when the timeline message occurred.
          $ref: '#/components/schemas/ServerTimestamp'
        _links:
          $ref: '#/components/schemas/SelfLink'
  responses:
    Unauthorized:
      description: |-
        Unauthorized access.
        Invalid credentials used.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    Forbidden:
      description: |-
        Access forbidden.
        If the organization requires multi-factor authentication (MFA) and the session has not passed MFA, `error` is `mfa_required`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Forbidden'
    ValidationError:
      description: Invalid data sent.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    TooManyRequests:
      description: Request rate limit exceeded.
      headers:
        Rate-Limit-Limit:
          $ref: '#/components/headers/Rate-Limit-Limit'
        Rate-Limit-Remaining:
          description: |-
            Number of requests still available for this rate limit.
            For more information, see [Rate limits](#section/Rate-limits).
          schema:
            type: integer
          example: 0
        Rate-Limit-Retry-After:
          $ref: '#/components/headers/Rate-Limit-Retry-After'
        Retry-After:
          description: Number of seconds to wait before retrying the request.
          schema:
            type: integer
          example: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TooManyRequests'
```
