API Version
Product Catalog
Library

Comments are additional information that you can add to your resources. Comments can be added to provide context for any operation that was performed.

When you make an API call on any resource, for example, Subscriptions -> Change term end, you can add more context to that operation by calling the comments API as a follow up call.

Besides the user generated comments, Chargebee also generates "System" comments when a change for a resource happens at the backend. These comments are all read-only.

Sample comment [ JSON ]

{ "added_by": "full_access_key_v1", "created_at": 1548178762, "entity_id": "__test__5SK0bLNFRFuCJKINu", "entity_type": "subscription", "id": "cmt___test__5SK0bLNFRFuCJMIO1", "notes": "This is a test comment", "object": "comment", "type": "user" }

API Index URL

https://{site}.chargebee.com/api/v1/comments

Model Class

id
string, max chars=40

Unique identifier for the comment.


entity_type
enumerated string

Type of the entity this comment generated for


Possible values are
customer

Entity that represents a customer

subscription

Entity that represents a subscription of a customer

transaction

Entity that represents a transaction.

plan

Entity that represents a subscription plan

Show all values[+]
added_by
optional, string, max chars=100

The user who created the comment. If created via API, this contains the name given for the API key used.


notes
string, max chars=1000

Actual notes for the comment.


created_at
timestamp(UTC) in seconds

The time at which this comment was created


type
enumerated string, default=user

Type of comment this is.


Possible values are
user

Comment generated by user either via API or Admin console.

system

Comment generated by Chargebee when any backend changes happen for an entity

Show all values[+]
entity_id
string, max chars=100

Unique identifier of the entity.


id id
string, max chars=40

Unique identifier for the comment.


entity_type entity_type
enumerated string

Type of the entity this comment generated for


Possible values are
customer

Entity that represents a customer

subscription

Entity that represents a subscription of a customer

transaction

Entity that represents a transaction.

plan

Entity that represents a subscription plan

Show all values[+]
added_by added_by
optional, string, max chars=100

The user who created the comment. If created via API, this contains the name given for the API key used.


notes notes
string, max chars=1000

Actual notes for the comment.


created_at created_at
timestamp(UTC) in seconds

The time at which this comment was created


type type
enumerated string, default=user

Type of comment this is.


Possible values are
user

Comment generated by user either via API or Admin console.

system

Comment generated by Chargebee when any backend changes happen for an entity

Show all values[+]
entity_id entity_id
string, max chars=100

Unique identifier of the entity.


Create a new comment for an entity. The newly added comment will be shown in the web interface as well.

Sample Request
curl  https://{site}.chargebee.com/api/v1/comments \
     -u {site_api_key}:\
     -d entity_id="__test__5SK0bLNFRFuCJKINu" \
     -d entity_type="SUBSCRIPTION" \
     -d notes="This is a test comment"
copy
Click to Copy
200:
OK
STATUS

Sample Response [ JSON ]

Show more...
{
    "comment": {
        "added_by": "full_access_key_v1",
        "created_at": 1548178762,
        "entity_id": "__test__5SK0bLNFRFuCJKINu",
        "entity_type": "subscription",
        "id": "cmt___test__5SK0bLNFRFuCJMIO1",
        "notes": "This is a test comment",
        "object": "comment",
        "type": "user"
    }
}

URL Format POST

https://{site}.chargebee.com/api/v1/comments

Method

entity_type[]
required, enumerated string

Type of the entity to create the comment for.

Possible values are
customer

Entity that represents a customer

subscription

Entity that represents a subscription of a customer

transaction

Entity that represents a transaction.

plan

Entity that represents a subscription plan

Show all values[+]
entity_id[]
required, string, max chars=100

Unique identifier of the entity.

notes[]
required, string, max chars=1000

Actual notes for the comment.

added_by[]
optional, string, max chars=100

The user who created the comment. If created via API, this contains the name given for the API key used.

comment comment
always returned
Resource object representing comment

Sample admin console URL

https://{site}.chargebee.com/admin-console/comments/123x

Retrieve a comment for an entity identified by comment ID.

Sample Request
curl  https://{site}.chargebee.com/api/v1/comments/cmt___test__5SK0bLNFRFuCJTAON \
     -u {site_api_key}:
copy
Click to Copy
200:
OK
STATUS

Sample Response [ JSON ]

Show more...
{
    "comment": {
        "added_by": "full_access_key_v1",
        "created_at": 1548178762,
        "entity_id": "__test__5SK0bLNFRFuCJS1OH",
        "entity_type": "subscription",
        "id": "cmt___test__5SK0bLNFRFuCJTAON",
        "notes": "This is a no cost plan",
        "object": "comment",
        "type": "user"
    }
}

URL Format GET

https://{site}.chargebee.com/api/v1/comments/{comment-id}

Method

comment comment
always returned
Resource object representing comment

Sample admin console URL

https://{site}.chargebee.com/admin-console/comments/123x

Retrieve the list of comments sorted by the recent ones on the top.

If you want to retrieve the list of comments for an entity, for example, subscription you can filter them by passing the entity type and unique identifier for that entity, for example, subscription ID.

Sample Request
curl  https://{site}.chargebee.com/api/v1/comments \
     -G  \
     -u {site_api_key}:\
     --data-urlencode limit=2
copy
Click to Copy
200:
OK
STATUS

Sample Response [ JSON ]

Show more...
{
    "list": [
        {
            "comment": {
                "added_by": "full_access_key_v1",
                "created_at": 1548178762,
                "entity_id": "__test__5SK0bLNFRFuCJPSO9",
                "entity_type": "customer",
                "id": "cmt___test__5SK0bLNFRFuCJR6OG",
                "notes": "This is a test comment",
                "object": "comment",
                "type": "user"
            }
        },
        {..}
    ],
    "next_offset": "[\"1548178762000\",\"101000000046\"]"
}

URL Format GET

https://{site}.chargebee.com/api/v1/comments

Method

limit[]
optional, integer, default=10, min=1, max=100
The number of resources to be returned.
offset[]
optional, string, max chars=1000
Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set 'offset' to the value of 'next_offset' obtained in the previous iteration of the API call.
entity_type[]
optional, enumerated string

Type of the entity this comment generated for.

Possible values are
customer

Entity that represents a customer

subscription

Entity that represents a subscription of a customer

transaction

Entity that represents a transaction.

plan

Entity that represents a subscription plan

Show all values[+]
entity_id[]
optional, string, max chars=100

Unique identifier of the entity.

comment comment
always returned
Resource object representing comment
next_offset next_offset
optional, string, max chars=1000
This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`.

Sample admin console URL

https://{site}.chargebee.com/admin-console/comments/123x

Delete a comment for an entity identified by comment ID.

Only the comments that are added via Admin console and API can be deleted. Chargebee generated "System" comments cannot be deleted.

Sample Request
curl  https://{site}.chargebee.com/api/v1/comments/cmt___test__5SK0bLNFRFuCJOdO8/delete \
     -X POST  \
     -u {site_api_key}:
copy
Click to Copy
200:
OK
STATUS

Sample Response [ JSON ]

Show more...
{
    "comment": {
        "added_by": "full_access_key_v1",
        "created_at": 1548178762,
        "entity_id": "__test__5SK0bLNFRFuCJNPO2",
        "entity_type": "subscription",
        "id": "cmt___test__5SK0bLNFRFuCJOdO8",
        "notes": "This is a no cost plan",
        "object": "comment",
        "type": "user"
    }
}

URL Format POST

https://{site}.chargebee.com/api/v1/comments/{comment-id}/delete

Method

comment comment
always returned
Resource object representing comment

Sample admin console URL

https://{site}.chargebee.com/admin-console/comments/123x