NAV
JSON Shell Browser Node.js Python Ruby PHP Go C# Java

Moesif API Reference

Moesif is an API analytics and monetization service to grow your API products. With Moesif, you can quickly get started with API observability, API monetization and usage-based billing.

With Moesif, you cam This reference is for v1 of the Moesif APIs. For an overview on the Moesif platform, see the developer docs or implementation guides

There are two APIs:

Name Host Authentication
Collector API api.moesif.net Retrieve your Collector Application Id by logging into Moesif and going to API keys from bottom left menu. Place in the request X-Moesif-Application-Id header. More info
Management API api.moesif.com Generate a Management API key by logging into Moesif and going to API keys from bottom left menu. Add it as a Bearer token to the request Authorization header. More info

API definitions

The Collector API enables you to log raw data to Moesif at high volume such as events and user profiles. It's a write-only, high-volume data collection network and is also used by the Moesif server integrations and plugins.

The Management API enables you to query and manage data in your Moesif account such as to embed charts in customer-facing applications.

Overview

Data Model

The Moesif data model includes two types of events (API Calls and Custom Actions) and three type of entities (Users, Companies, and Subscriptions). A full diagram is below.

Moesif Data Model

For more info, view docs on Moesif data structure.

Filtering

Query Params

Some endpoints require a date range for data to look at. This is done via the from and the to query parameters. There is also an optional time_zone query parameter if you want the calendar dates aligned to your local time zone. Time zone is UTC by default and must be a TZ Database Name such as America/Los_Angeles

Relative dates support the following units:

symbol unit
s seconds
m minutes
h hours
d days
w weeks
M months
now current UTC time

Dates can optionally be prepended with a - or a +

Some examples:

From Date To Date Description
-24h now from 24 hours ago to now
-1d now from 1 day ago to now
-1w now from 1 week ago to now
-2w -1w frm 2 weeks ago to 1 week ago
-1M 1M from 1 month ago to 1 month in the future

Elasticsearch DSL

The Moesif Search APIs supports majority of the Elasticsearch/Opensearch Search DSL, which makes it super flexible to generate the report you're looking for. Only the DSL for search is supported. Other APIs outside of search are not supported. You can generate a query quickly within the Moesif UI by clicking the orange "Embed" button on any report. Then select "Search API". The generated CURL command will be for the exact report you are looking at. If you change filters or other criteria, you can go back and click "Embed" again to see how it changes. For help building a query for your business requirements, contact us.

Example: Getting most recent 500 errors

If you wanted to get the most recent API errors, you can filter by API calls with response status 500 and sort by request time in descending order.

POST https://api.moesif.com/search/~/search/events?from=-1d&to=now

Example Request
{
  "post_filter": {
    "bool": {
      "should": {
        "term": {
          "response.status": "500"
        }
      }
    }
  },
  "size": 50,
  "sort": [
    {
      "request.time": "desc"
    }
  ]
}
curl -XPOST \
    -d '{"post_filter":{"bool":{"should":{"term":{"response.status":"500"}}}},"size":50,"sort":[{"request.time":"desc"}]}' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer {access-token}' \
    "https://api.moesif.com/search/~/search/events?from=-1d&to=now"

Example: Getting API usage per customer

Another popular use case is to get the monthly API usage for a specific customer so you can display current usage vs. plan quota in your customer facing portal. This can be done easily by looking at past month and getting a count for the user_id

POST https://api.moesif.com/search/~/search/count?from=-1M&to=now

Example Request
{
  "post_filter": {
    "bool": {
      "should": {
        "term": {
          "user_id.raw": "123456"
        }
      }
    }
  }
}
curl -XPOST \
    -d '{"post_filter":{"bool":{"should":{"term":{"user_id.raw":"123456"}}}}}' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer {access-token}' \
    "https://api.moesif.com/search/~/count/events?from=-1M&to=now"

Pagination

Sorting List of Items

To rapidly generate your query, it's strongly recommended using the query builder within the Moesif UI. This can be found by clicking orange "Embed" button and selecting "Search API". Set up your sort field and click the next page to see an example for pagination.

Moesif's search APIs (such as to get list of events of users) use a combination of keyset and seek pagination to ensure APIs are performant for very large offset values. For an overview of different types, see this blog post on pagination.

For pagination, the search API allows for three request body fields:

For the request, we need to define the last item seen in the ordered list. This can be obtained by looking at the previous response's hits.hits.sort field.

Sorting items by request time For example, let's say we want to return the most recent events in descending order in batches of 100 items. For each page after the first, we should set the last event already seen as the request.time.

POST https://api.moesif.com/search/~/search/events?from=-7d&to=now

Sorting items by request time
{
    "size": 10,
    "search_after": [
        1694190464456
    ],
    "sort": [
        {
            "request.time": {
                "order": "desc",
                "unmapped_type": "string"
            }
        }
    ]
}

Sorting items by low cardinality key

For lower cardinality keys (likes response.status), many events may match the same status code. In order to have a stable sort, you must use a high cardinality key as well such that it's a sort on a compound key. Below is an example using both the response.status as well as the _id field (which is guaranteed to be unique)

POST https://api.moesif.com/search/~/search/events?from=-7d&to=now

Sorting items by low cardinality key
{
    "size": 50,
    "search_after": [
        "12345",
        "AYpjf3Gow2BIxAOLPgx4"
    ],
    "sort": [
        {
            "user_id.raw": {
                "order": "desc",
                "unmapped_type": "string"
            }
        },
        {
            "_id": "desc"
        }
    ]
}

Sorting Metric Terms

To rapidly generate your query, t's strongly recommended using the query builder within the Moesif UI. This can be found by clicking orange "Embed" button and selecting "Search API".

Metrics APIs (such as to get a time series or segmentation report) do not support pagination as the response is already aggregated and contains the required dataset. However, Moesif does support sorting by "top X" and "Bottom X" for when a "group by" is present. This is important to define whether you want the top terms or bottom terms and what is the metric to order the group by terms.

Sorting group by terms

In the below example, we have a segmentation report that gets the total event count for the top 10 companies. The query has a "group by" on company_id.raw. The group by will return the top 10 terms sorted by the company's event count (weight) in descending order (desc).

POST https://api.moesif.com/search/~/search/events?from=-7d&to=now

Sorting group by term
{
    "aggs": {
        "seg": {
            "filter": {
                "match_all": {}
            },
            "aggs": {
                "company_id.raw": {
                    "terms": {
                        "field": "company_id.raw",
                        "size": "20",
                        "min_doc_count": 1,
                        "order": {
                            "weight|sum": "desc"
                        },
                        "missing": "(none)"
                    },
                    "aggs": {
                        "weight|sum": {
                            "sum": {
                                "field": "weight",
                                "missing": 1
                            }
                        }
                    }
                },
                "weight|sum": {
                    "sum": {
                        "field": "weight",
                        "missing": 1
                    }
                }
            }
        }
    },
    "size": 0
}

Sorting by a different metric

The metric returned and the sort order can be different. In the below example, the metric returned is 90th percentile latency, but we still want to sort by the top 10 APIs by volume so we ignore the small volume APIs.

POST https://api.moesif.com/search/~/search/events?from=-7d&to=now

Sorting by a different metric
{
    "aggs": {
        "seg": {
            "filter": {
                "match_all": {}
            },
            "aggs": {
                "request.route.raw": {
                    "terms": {
                        "field": "request.route.raw",
                        "size": "10",
                        "min_doc_count": 1,
                        "order": {
                            "duration_ms|percentiles(90).90": "desc"
                        },
                        "missing": "(none)"
                    },
                    "aggs": {
                        "duration_ms|percentiles(90)": {
                            "percentiles": {
                                "field": "duration_ms",
                                "percents": [
                                    90
                                ]
                            }
                        }
                    }
                },
                "duration_ms|percentiles(90)": {
                    "percentiles": {
                        "field": "duration_ms",
                        "percents": [
                            90
                        ]
                    }
                }
            }
        }
    },
    "size": 0
}

Idempotency

Moesif Collector API support idempotent requests. This ensures Moesif does not create duplicate events even if the same event was sent twice to the Moesif Collector API. For users and companies APIs, this is automatic. For events and actions APIs, ensure you set the transaction_id for each event to a random UUID. This should be a 36 character UUID such as 123e4567-e89b-12d3-a456-426614174000. Moesif uses the transaction_id for ensuring duplicate events are not created. Setting the transaction_id is strongly recommended if you can replay processing from a pipeline like logstash.

Deduplication for Batches

Because each event has it's own transaction_id, Moesif will still deduplicate even if the batches are different. For example, let's say you send the following batches:

  1. Send a batch of two events containing transaction_id's A, B
  2. Send a batch of one event containing transaction_id C
  3. Send a batch of three events containing transaction_id's A, C, D

At the end, Moesif will only contain 4 events (A, B, C, D)

Request Format

For POST, PUT, and PATCH requests, the request body should be JSON. The Content-Type header should be set to application/json

Response Format

The response body format is always JSON. Successful operations are seen via 2xx status code. Successful creation of new objects will be seen via 201. 4xx status implies client error.

The REST API JSON payload uses underscore format (i.e some_key). Many of the API libs may use camelCase, PascalCase, or other as their model entities. Please select the respective language tab.

CORS

CORS is enabled on this API. Access-Control-Allow-Origin is set to *

Errors

Error Code Meaning
400 Bad Request -- Your request has an incorrect parameter
401 Unauthorized -- Your X-Moesif-Application-Id or Authorization header is incorrect or missing required scopes
402 Payment Required -- Your subscription is not active or has been cancelled
404 Not Found -- The specified endpoint could not be found
405 Method Not Allowed -- You tried to access a resource with an invalid HTTP method
406 Not Acceptable -- You requested a format that is not JSON format, Moesif's API supports JSON
410 Gone -- The resource requested has been removed from our servers
429 Too Many Requests -- You are hitting a rate limit such as too many queries at same time.
500 Internal Server Error -- We had a problem with our server. Please contact us
502 Bad Gateway -- A transient error when no server is available to handle your request, retry again or contact us if problem persists.
503 Service Unavailable -- A transient error when no server is available to handle your request, retry again or contact us if problem persists.

Limits and Restrictions

Moesif has certain limits to ensure performance and stability for all Moesif customers. The Management APIs are rate limited to protect service degradation. Moesif also has limits on event size to ensure performance of your account.

Moesif does not rate limit data ingestion via the collector APIs. However, you can still be throttled due to security reasons to product Moesif infrastructure. This may happen when unusual behavior is detected such as exceeding your quota by a wide margin

Maximum Event Size

Collected events have size limits to ensure performance and stability of the Moesif platform for customers.

Limit Value
Maximum size of single event 1MB
Maximum size of a batch of events 50MB
Truncation size of request.body or response.body 450KB

The maximum size of an event (one API call or custom action) is 1MB, which is a hard limit due to how the Moesif platform was architected for scale. Majority of APIs we see have an average event size of 1Kb to 5Kb so it would be unusual to reach this limit. With that said, there are a couple of things you can try:

  1. Don't log non API traffic using skip functionality (i.e. HTML, pictures, etc). Moesif is not designed for monitoring access to large files nor provides much usefulness.
  2. Remove large keys from payload using mask data. This can be helpful if you have a JSON key that's large but not valuable.

If you're sending a batch of events to the batch API, the maximum batch size is 50MB regardless if compression is used. For batches of events greater than 50MB, you should break up the batch into smaller batches.

Moesif will still try to log events over 1MB by truncating the request or response body to 450Kb and base64 encoded it. The logged body won't be valid JSON but at least the event is logged for later inspection. A warning is also displayed in the Moesif app so you can identify when this is occurring. The partial body will not be analyzed by Moesif's body analytics feature so filters may not match on body fields, etc.

Management API Rate Limits

To ensure performance of search queries, the Management API has a rate limit of 500 queries/minute, but can burst higher based on your history and pattern. The Management API will return 429 Too Many Requests once you hit this limit. This operates on a fixed calendar minute period. Moesif reserves the right to modify these limits to protect the reliability of the Moesif Platform.

The search APIs are intended for interactive workflows such as logging into Moesif UI or to integrate Moesif into your applications. If you need to transfer large amounts of data to cloud object storage (like Azure Storage) or to your data warehouse, you should use the bulk export APIs and not the search API.

Moesif does not rate limit data ingestion via the collector APIs. However, you can still be throttled due to security reasons to product Moesif infrastructure. This may happen when unusual behavior is detected such as exceeding your quota by a wide margin

Late Events

Moesif server integrations stream events to the collector API in real-time. If you build a custom integration, you should also send events in real-time.

However, we understand you may have special circumstances that cause events to be sent later than expected. By default, Moesif can process events that are up to 30 days in the past. By default, events older than 30 days are rejected by the collector API. If you need an exception to backfill more historical data, please contact us so we can enable your account for backfill.

While Moesif will process the events, events that are more than 5 minutes old are considered "late events". Certain workflows with strict deadlines like alerting and billing may be impacted. If you're using a native Moesif server integrations, this shouldn't be an issue as they stream events to Moesif in real-time within milliseconds. If you have an ingestion delay in the minutes it likely implies something wrong with your server integration. Server clock can be another issue if incorrectly set. We do track ingestion delays internally, so we'll reach out if we see such issues happening on your account.

API Libs

THese are low-level libraries to access the Moesif Collector API directly. For logging API calls at scale, most customers should integrate with one of Moesif's API monitoring agents which instrument your API automatically and handle batching. Likewise, Moesif has client integrations for tracking users and their actions in your UI.

How to Install

Pick a language at the bottom left


Source Code:

https://github.com/moesif/moesifapi-java
// Add the dependency

<dependency>
    <groupId>com.moesif.api</groupId>
    <artifactId>moesifapi</artifactId>
    <version>1.6.9</version>
</dependency>
Source Code:

https://github.com/moesif/moesifapi-nodejs


Package:

https://www.npmjs.com/package/moesifapi
// To Install Moesif Lib, run in your terminal

npm install --save moesifapi
Source Code:

https://github.com/moesif/moesifapi-python


Package:

https://pypi.python.org/pypi/moesifapi
# To Install Moesif Lib, run in your terminal

pip install moesifapi
Source Code:

https://github.com/moesif/moesifapi-ruby


Package:

https://rubygems.org/gems/moesif_api
# To Install Moesif Lib, run in your terminal

gem install moesif_api
Source Code:

https://github.com/moesif/moesifapi-csharp


Package:

https://www.nuget.org/packages/Moesif.Api/
// Install the Nuget Package via Package Manager Console:

Install-Package Moesif.Api
Source Code:

https://github.com/Moesif/moesifapi-go

go get github.com/moesif/moesifapi-go;
Source Code:

https://github.com/Moesif/moesifapi-php
// Install via Composer

composer require moesif/moesifapi-php
Install via NPM:
var moesif = require('moesif-browser-js');

moesif.init({
  applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
  // add other option here.
});
Install via CDN
<script src="//unpkg.com/moesif-browser-js@^1/moesif.min.js"></script>
<script type="text/javascript">
moesif.init({
  applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});
</script>

Select your language on the right:

The SDKs are open-source and available on GitHub.

Collector API v1

The Collector API enables you to log data to Moesif at high volumes. This is also what the Moesif server integrations use. For more info, check out an overview of our analytics infrastructure.

Base URL (Public) Base URL (When using Secure Proxy)
api.moesif.net/v1 localhost:9500/collector/v1

If you're using the Moesif secure proxy for client-side encryption, the base URL is https://localhost:9500/collector/v1 assuming it's running on port 9500. See accessing Collector API

Terms of service

Moesif's official SDKs and plugins only use HTTPS, but the API does support HTTP for very specific applications like legacy embedded devices (uncommon). It's strongly recommended to ensure all communication is HTTPS.

Authentication

Authentication is handled by adding the HTTP header X-Moesif-Application-Id to all requests. Moesif recommends using the same Application Id for all integrations within the same application environment (i.e. product, staging, etc) so your analytics data is unified.

X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID

API Calls

Log an API Call

POST https://api.moesif.net/v1/events

Log a single API call to Moesif as an event. The request payload is a single API event containing the API request, the API response, and any custom event metadata.

POST https://api.moesif.net/v1/events

Example Request
  {
    "request": {
      "time": "2024-10-30T04:45:42.914",
      "uri": "https://api.acmeinc.com/items/12345/reviews/",
      "verb": "POST",
      "api_version": "1.1.0",
      "ip_address": "61.48.220.123",
      "headers": {
        "Host": "api.acmeinc.com",
        "Accept": "*/*",
        "Connection": "Keep-Alive",
        "Content-Type": "application/json",
        "Content-Length": "126",
        "Accept-Encoding": "gzip"
      },
      "body": {
        "items": [
          {
            "direction_type": 1,
            "item_id": "hello",
            "liked": false
          },
          {
            "direction_type": 2,
            "item_id": "world",
            "liked": true
          }
        ]
      },
      "transfer_encoding": ""
    },
    "response": {
      "time": "2024-10-30T04:45:42.914",
      "status": 500,
      "headers": {
        "Vary": "Accept-Encoding",
        "Pragma": "no-cache",
        "Expires": "-1",
        "Content-Type": "application/json; charset=utf-8",
        "Cache-Control": "no-cache"
      },
      "body": {
        "Error": "InvalidArgumentException",
        "Message": "Missing field location"
      },
      "transfer_encoding": ""
    },
    "user_id": "12345",
    "company_id": "67890",
    "transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257",
    "metadata": {
        "some_string": "I am a string",
        "some_int": 77,
        "some_object": {
            "some_sub_field": "some_value"
        }
    }
  }
# You can also use wget
curl -X POST https://api.moesif.net/v1/events \
  -H 'Content-Type: application/json' \
  -H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
  -d '{"request":{"time":"2024-10-30T04:45:42.914","uri":"https://api.acmeinc.com/items/12345/reviews/","verb":"POST","api_version":"1.1.0","ip_address":"61.48.220.123","headers":{"Host":"api.acmeinc.com","Accept":"*/*","Connection":"Keep-Alive","Content-Type":"application/json","Content-Length":"126","Accept-Encoding":"gzip"},"body":{"items":[{"direction_type":1,"item_id":"hello","liked":false},{"direction_type":2,"item_id":"world","liked":true}]},"transfer_encoding":""},"response":{"time":"2024-10-30T04:45:42.914","status":500,"headers":{"Vary":"Accept-Encoding","Pragma":"no-cache","Expires":"-1","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache"},"body":{"Error":"InvalidArgumentException","Message":"Missing field location"},"transfer_encoding":""},"user_id":"12345","company_id":"67890","transaction_id":"a3765025-46ec-45dd-bc83-b136c8d1d257","metadata":{"some_string":"I am a string","some_int":77,"some_object":{"some_sub_field":"some_value"}}}'
String reqBody = "{" +
  "\"items\": [" +
    "{" +
      "\"type\": 1," +
      "\"id\": \"hello\"" +,
    "}" +
  "]" +
  "}";

String rspBody = "{" +
    "\"Error\": \"InvalidArgumentException\"," +
    "\"Message\": \"Missing field field_a\"" +
  "}";

// Generate the event
Map<String, String> reqHeaders = new HashMap<String, String>();
reqHeaders.put("Host", "api.acmeinc.com");
reqHeaders.put("Content-Type", "application/json");
reqHeaders.put("Accept-Encoding", "gzip");

Map<String, String> rspHeaders = new HashMap<String, String>();
rspHeaders.put("Content-Type", "application/json; charset=utf-8");

BodyParser.BodyWrapper reqBodyWrapper = BodyParser.parseBody(reqHeaders, reqBody);
BodyParser.BodyWrapper rspBodyWrapper = BodyParser.parseBody(rspHeaders, rspBody);

EventRequestModel eventReq = new EventRequestBuilder()
        .time(new Date())
        .uri("https://api.acmeinc.com/items/reviews/")
        .verb("PATCH")
        .apiVersion("1.1.0")
        .ipAddress("61.48.220.123")
        .headers(reqHeaders)
        .body(reqBodyWrapper.body)
        .transferEncoding(reqBodyWrapper.transferEncoding);
        .build();

EventResponseModel eventRsp = new EventResponseBuilder()
        .time(new Date(System.currentTimeMillis() + 1000))
        .status(500)
        .headers(rspHeaders)
        .body(rspBodyWrapper.body)
        .transferEncoding(rspBodyWrapper.transferEncoding);
        .build();

EventModel eventModel = new EventBuilder()
        .request(eventReq)
        .response(eventRsp)
        .userId("12345")
        .companyId("67890")
        .build();

// Asynchronous Call to Create Event
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");
APIController api = getClient().getAPI();

APICallBack<Object> callBack = new APICallBack<Object>() {
    public void onSuccess(HttpContext context, Object response) {
        // Sent successfully!
    }

    public void onFailure(HttpContext context, Throwable error) {
        // Log there was a failure
    }
};

// Async call to Send Event to Moesif
api.createEventAsync(eventModel, callBack);

// Synchronous call to Send Event to Moesif
api.createEvent(eventModel);
// 1. Import the module
var moesifapi = require('moesifapi');
var EventModel = moesifapi.UserModel;
var api = moesifapi.ApiController;

// 2. Configure the ApplicationId
var config = moesifapi.configuration;
config.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";

// 3. Generate an API Event Model
var reqHeaders = JSON.parse('{' +
        '"Host": "api.acmeinc.com",' +
        '"Accept": "*/*",' +
        '"Connection": "Keep-Alive",' +
        '"User-Agent": "Apache-HttpClient",' +
        '"Content-Type": "application/json",' +
        '"Content-Length": "126",' +
        '"Accept-Encoding": "gzip"' +
    '}');

var reqBody = JSON.parse( '{' +
        '"items": [' +
            '{' +
                '"type": 1,' +
                '"id": "hello"' +
            '},' +
            '{' +
                '"type": 2,' +
                '"id": "world"' +
            '}' +
        ']' +
    '}');

var rspHeaders = JSON.parse('{' +
        '"Vary": "Accept-Encoding",' +
        '"Pragma": "no-cache",' +
        '"Expires": "-1",' +
        '"Content-Type": "application/json; charset=utf-8",' +
        '"Cache-Control": "no-cache"' +
    '}');

var rspBody = JSON.parse('{' +
        '"Error": "InvalidArgumentException",' +
        '"Message": "Missing field field_a"' +
    '}');

var reqDate = new Date();
var eventReq = {
    time: reqDate,
    uri: "https://api.acmeinc.com/items/reviews/",
    verb: "PATCH",
    apiVersion: "1.1.0",
    ipAddress: "61.48.220.123",
    headers: reqHeaders,
    body: reqBody
};

var eventRsp = {
    time: (new Date()).setMilliseconds(reqDate.getMilliseconds() + 500),
    status: 500,
    headers: rspHeaders,
    body: rspBody
};

var eventModel = {
    request: eventReq,
    response: eventRsp,
    userId: "12345",
    companyId: "67890"
};

var events = [new EventModel(eventModel),
  new EventModel(eventModel),
  new EventModel(eventModel),
  new EventModel(eventModel)];

// 4. Send batch of events
api.createEventsBatch(events, function(error, response, context) {
  // Do Something
});

from __future__ import print_function
from moesifapi.moesif_api_client import *
from moesifapi.models import *
from datetime import *

client = MoesifAPIClient(YOUR_COLLECTOR_APPLICATION_ID)
api = client.api

# Note: we recommend sending all API calls via MVC framework middleware.

req_headers = APIHelper.json_deserialize("""  {
  "Host": "api.acmeinc.com",
  "Accept": "*/*",
  "Connection": "Keep-Alive",
  "User-Agent": "Apache-HttpClient",
  "Content-Type": "application/json",
  "Content-Length": "126",
  "Accept-Encoding": "gzip"
} """)

req_body = APIHelper.json_deserialize( """{
  "items": [
    {
      "type": 1,
      "id": "hello"
    },
    {
      "type": 2,
      "id": "world"
    }
  ]
}""")

rsp_headers = APIHelper.json_deserialize("""  {
    "Date": "Mon, 05 Feb 2024 23:46:49 GMT",
    "Vary": "Accept-Encoding",
    "Pragma": "no-cache",
    "Expires": "-1",
    "Content-Type": "application/json; charset=utf-8"
    "Cache-Control": "no-cache"
  } """)

rsp_body = APIHelper.json_deserialize( """{
    "Error": "InvalidArgumentException",
    "Message": "Missing field field_a"
  }""")


event_req = EventRequestModel(time = datetime.utcnow() - timedelta(seconds=-1),
    uri = "https://api.acmeinc.com/items/reviews/",
    verb = "PATCH",
    api_version = "1.1.0",
    ip_address = "61.48.220.123",
    headers = req_headers,
    body = req_body)

event_rsp = EventResponseModel(time = datetime.utcnow(),
    status = 500,
    headers = rsp_headers,
    body = rsp_body)

event_model = EventModel(request = event_req,
    response = event_rsp,
    user_id = "12345",
    company_id = "67890")


# Perform the API call through the SDK function
api.create_event(event_model)
require 'moesif_api'

client = MoesifApi::MoesifAPIClient.new(YOUR_COLLECTOR_APPLICATION_ID)
api = client.api_controller

req_headers = JSON.parse('{'\
  '"Host": "api.acmeinc.com",'\
  '"Accept": "*/*",'\
  '"Connection": "Keep-Alive",'\
  '"User-Agent": "Apache-HttpClient",'\
  '"Content-Type": "application/json",'\
  '"Content-Length": "126",'\
  '"Accept-Encoding": "gzip"'\
'}')

req_body = JSON.parse( '{'\
  '"items": ['\
    '{'\
      '"type": 1,'\
      '"id": "hello"'\
    '},'\
    '{'\
      '"type": 2,'\
      '"id": "world"'\
    '}'\
  ']'\
'}')

rsp_headers = JSON.parse('{'\
  '"Date": "Mon, 05 Feb 2024 23:46:49 GMT",'\
                '"Vary": "Accept-Encoding",'\
  '"Pragma": "no-cache",'\
  '"Expires": "-1",'\
  '"Content-Type": "application/json; charset=utf-8",'\
                '"Cache-Control": "no-cache"'\
'}')

rsp_body = JSON.parse('{'\
  '"Error": "InvalidArgumentException",'\
  '"Message": "Missing field field_a"'\
'}')


event_req = EventRequestModel.new()
event_req.time = "2024-10-30T04:45:42.914"
event_req.uri = "https://api.acmeinc.com/items/reviews/"
event_req.verb = "PATCH"
event_req.api_version = "1.1.0"
event_req.ip_address = "61.48.220.123"
event_req.headers = req_headers
event_req.body = req_body

event_rsp = EventResponseModel.new()
event_rsp.time = "2024-10-30T04:45:42.914"
event_rsp.status = 500
event_rsp.headers = rsp_headers
event_rsp.body = rsp_body

event_model = EventModel.new()
event_model.request = event_req
event_model.response = event_rsp
event_model.user_id ="12345"
event_model.company_id ="67890"

# Perform the API call through the SDK function
response = api.create_event(event_model)

using Moesif.Api;
using Moesif.Api.Helpers;

// Create client instance using your ApplicationId
var client = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID");
var apiClient = GetClient().Api;

// Parameters for the API call
var reqHeaders = APIHelper.JsonDeserialize<object>(@" {
        ""Host"": ""api.acmeinc.com"",
        ""Accept"": ""*/*"",
        ""Connection"": ""Keep-Alive"",
        ""User-Agent"": ""Apache-HttpClient"",
        ""Content-Type"": ""application/json"",
        ""Content-Length"": ""126"",
        ""Accept-Encoding"": ""gzip""
    }");

var reqBody = APIHelper.JsonDeserialize<object>(@" {
        ""items"": [
            {
                ""type"": 1,
                ""id"": ""hello""
            },
            {
                ""type"": 2,
                ""id"": ""world""
            }
        ]
    }");

var rspHeaders = APIHelper.JsonDeserialize<object>(@" {
        ""Date"": ""Mon, 05 Feb 2024 23:46:49 GMT"",
        ""Vary"": ""Accept-Encoding"",
        ""Pragma"": ""no-cache"",
        ""Expires"": ""-1"",
        ""Content-Type"": ""application/json; charset=utf-8"",
        ""Cache-Control"": ""no-cache""
    } ");

var rspBody = APIHelper.JsonDeserialize<object>(@" {
        ""Error"": ""InvalidArgumentException"",
        ""Message"": ""Missing field field_a""
    }");


var eventReq = new EventRequestModel()
{
    Time = DateTime.Parse("2024-10-30T04:45:42.914"),
    Uri = "https://api.acmeinc.com/items/reviews/",
    Verb = "PATCH",
    ApiVersion = "1.1.0",
    IpAddress = "61.48.220.123",
    Headers = reqHeaders,
    Body = reqBody
};

var eventRsp = new EventResponseModel()
{
    Time = DateTime.Parse("2024-10-30T04:45:42.914"),
    Status = 500,
    Headers = rspHeaders,
    Body = rspBody
};

var eventModel = new EventModel()
{
    Request = eventReq,
    Response = eventRsp,
    UserId = "12345",
    CompanyId = "67890"
};

//////////////////////////////////////
// Example for making an async call //     
//////////////////////////////////////
try
{
    await controller.CreateEventAsync(eventModel);
}
catch(APIException)
{
    // Handle Error
};

///////////////////////////////////////////
// Example for making a synchronous call //
///////////////////////////////////////////
try
{
    controller.CreateEvent(eventModel);
}
catch(APIException)
{
    // Handle Error
};

import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"
import "time"

apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")

reqTime := time.Now().UTC()
apiVersion := "1.0"
ipAddress := "61.48.220.123"

req := models.EventRequestModel{
  Time:       &reqTime,
  Uri:        "https://api.acmeinc.com/widgets",
  Verb:       "GET",
  ApiVersion: &apiVersion,
  IpAddress:  &ipAddress,
  Headers: map[string]interface{}{
    "ReqHeader1": "ReqHeaderValue1",
  },
  Body: nil,
}

rspTime := time.Now().UTC().Add(time.Duration(1) * time.Second)

rsp := models.EventResponseModel{
  Time:      &rspTime,
  Status:    500,
  IpAddress: nil,
  Headers: map[string]interface{}{
    "RspHeader1":     "RspHeaderValue1",
    "Content-Type":   "application/json",
    "Content-Length": "1000",
  },
  Body: map[string]interface{}{
    "Key1": "Value1",
    "Key2": 12,
    "Key3": map[string]interface{}{
      "Key3_1": "SomeValue",
    },
  },
}

userId := "12345"
companyId: := "67890"

event := models.EventModel{
  Request:      req,
  Response:     rsp,
  SessionToken: nil,
  Tags:         nil,
  UserId:       &userId,
  CompanyId:    &companyId,
}


// Queue the event (will queue the requests into batches and flush buffers periodically.)
err := apiClient.QueueEvent(&event)

// Create the event synchronously
err := apiClient.CreateEvent(&event)

<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.

require_once "vendor/autoload.php";

// Import the SDK client in your project:

use MoesifApi\MoesifApiClient;

// Instantiate the client. After this, you can now access the Moesif API
// and call the respective methods:

$client = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID");
$api = $client->getApi();

$event = new Models\EventModel();
$reqdate = new DateTime();
$rspdate = new DateTime();

$event->request = array(
       "time" => $reqdate->format(DateTime::ISO8601), 
       "uri" => "https://api.acmeinc.com/items/reviews/", 
       "verb" => "PATCH", 
       "api_version" => "1.1.0", 
       "ip_address" => "61.48.220.123", 
       "headers" => array(
         "Host" => "api.acmeinc.com", 
         "Accept" => "_/_", 
         "Connection" => "Keep-Alive", 
         "User-Agent" => "moesifapi-php/1.1.5",
         "Content-Type" => "application/json", 
         "Content-Length" => "126", 
         "Accept-Encoding" => "gzip"), 
        "body" => array(
          "review_id" => 132232, 
          "item_id" => "ewdcpoijc0", 
          "liked" => false)
        );

 $event->response = array(
           "time" => $rspdate->format(DateTime::ISO8601), 
           "status" => 500, 
           "headers" => array(
             "Date" => "Tue, 1 Mar 2022 23:46:49 GMT", 
             "Vary" => "Accept-Encoding", 
             "Pragma" => "no-cache", 
             "Expires" => "-1", 
             "Content-Type" => "application/json; charset=utf-8", 
             "X-Powered-By" => "ARR/3.0", 
             "Cache-Control" => "no-cache", 
             "Arr-Disable-Session-Affinity" => "true"), 
             "body" => array(
               "item_id" => "13221", 
               "title" => "Red Brown Chair",
               "description" => "Red brown chair for sale",
               "price" => 22.23
             )
        );
$event->metadata = array(
          "foo" => "bar" 
        );

$event->user_id = "12345";
$event->company_id = "67890";

$api->createEvent($event);
Name Type Required Description
request object true The object that specifies the API request.

time

string(date-time) true Timestamp for the request in ISO 8601 format.

uri

string true Full uri such as https://api.acmeinc.com/?query=string including protocol, host, and query string.

verb

string true HTTP method used such as GET or POST.

api_version

string false API Version you want to tag this request with such as 1.0.0.

ip_address

string false IP address of the requester, If not set, we extract the remote IP address.

headers

object true Headers of the request as a Map<string, string>. Multiple headers with the same key name should be combined together such that the values are joined by a comma. HTTP Header Protocol on w3.org.

body

object false Payload of the request in either JSON or a base64 encoded string.

transfer_encoding

string false Specifies the transfer encoding of request.body field. If set to json then the response.body must be a JSON object. If set to base64, then request.body must be a base64 encoded string. Helpful for binary payloads. If not set, the body is assumed to be json.
response object false The object that specifies the API response. The response object can be undefined such as a request timeouts.

time

string(date-time) true Timestamp for the response in ISO 8601 format.

status

integer true HTTP status code as number such as 200 or 500.

ip_address

string false IP address of the responding server.

headers

object true Headers of the response as a Map<string, string>. Multiple headers with the same key name should be combined together such that the values are joined by a comma. HTTP Header Protocol on w3.org

body

object false Payload of the response in either JSON or a base64 encoded string.

transfer_encoding

string false Specifies the transfer encoding of response.body field. If set to json then the response.body must be a JSON object. If set to base64, then response.body must be a base64 encoded string. Helpful for binary payloads. If not set, the body is assumed to be json.
transaction_id string false A random 36 char UUID for this event. If set, Moesif will deduplicate events using this id and ensure idempotency.
session_token string false Set the API key/session token used for this API call. Moesif will auto-detect API sessions if not set.
user_id string false Associate this API call to a user. Typically, a real person.
company_id string false Associate this API call to a company (Required for metered billing).
subscription_id string false Associate this API call to a specific subscription of a company. Not needed unless same company can have multiple subscriptions to the same plan. When set, usage will be reported to only this subscription.
direction string false The direction of this API call which can be Incoming or Outgoing.
metadata object false An object containing any custom event metadata you want to store with this event.

Log API Calls in Batch

POST https://api.moesif.net/v1/events/batch

Creates and logs a batch of API calls to Moesif. The request payload is an array API calls entities, each consisting of the API request, the API response, and any custom event metadata.

This API takes a list form of the same model defined in create single event.

The maximum batch size is 50MB. Break up larger batches into smaller batches.

POST https://api.moesif.net/v1/events/batch

Example Request
  [
    {
        "request": {
          "time": "2024-10-30T04:45:42.914",
          "uri": "https://api.acmeinc.com/items/83738/reviews/",
          "verb": "POST",
          "api_version": "1.1.0",
          "ip_address": "61.48.220.123",
          "headers": {
            "Host": "api.acmeinc.com",
            "Accept": "*/*",
            "Connection": "Keep-Alive",
            "Content-Type": "application/json",
            "Content-Length": "126",
            "Accept-Encoding": "gzip"
          },
          "body": {
            "items": [
              {
                "direction_type": 1,
                "item_id": "hello",
                "liked": false
              },
              {
                "direction_type": 2,
                "item_id": "world",
                "liked": true
              }
            ]
          },
          "transfer_encoding": ""
        },
        "response": {
          "time": "2024-10-30T04:45:42.914",
          "status": 500,
          "headers": {
            "Vary": "Accept-Encoding",
            "Pragma": "no-cache",
            "Expires": "-1",
            "Content-Type": "application/json; charset=utf-8",
            "Cache-Control": "no-cache"
          },
          "body": {
            "Error": "InvalidArgumentException",
            "Message": "Missing field location"
          },
          "transfer_encoding": ""
        },
        "user_id": "12345",
        "company_id": "67890",
        "transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257",
        "metadata": {
            "some_string": "I am a string",
            "some_int": 77,
            "some_object": {
                "some_sub_field": "some_value"
            }
        }
    }
  ]
# You can also use wget
curl -X POST https://api.moesif.net/v1/events/batch \
  -H 'Content-Type: application/json' \
  -H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
  -d '[{"request":{"time":"2024-10-30T04:45:42.914","uri":"https://api.acmeinc.com/items/83738/reviews/","verb":"POST","api_version":"1.1.0","ip_address":"61.48.220.123","headers":{"Host":"api.acmeinc.com","Accept":"*/*","Connection":"Keep-Alive","Content-Type":"application/json","Content-Length":"126","Accept-Encoding":"gzip"},"body":{"items":[{"direction_type":1,"item_id":"hello","liked":false},{"direction_type":2,"item_id":"world","liked":true}]},"transfer_encoding":""},"response":{"time":"2024-10-30T04:45:42.914","status":500,"headers":{"Vary":"Accept-Encoding","Pragma":"no-cache","Expires":"-1","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache"},"body":{"Error":"InvalidArgumentException","Message":"Missing field location"},"transfer_encoding":""},"user_id":"12345","company_id":"67890","transaction_id":"a3765025-46ec-45dd-bc83-b136c8d1d257","metadata":{"some_string":"I am a string","some_int":77,"some_object":{"some_sub_field":"some_value"}}}]'
String reqBody = "{" +
  "\"items\": [" +
    "{" +
      "\"type\": 1," +
      "\"id\": \"hello\"" +,
    "}" +
  "]" +
  "}";

String rspBody = "{" +
    "\"Error\": \"InvalidArgumentException\"," +
    "\"Message\": \"Missing field field_a\"" +
  "}";

// Generate the event
Map<String, String> reqHeaders = new HashMap<String, String>();
reqHeaders.put("Host", "api.acmeinc.com");
reqHeaders.put("Content-Type", "application/json");
reqHeaders.put("Accept-Encoding", "gzip");

Map<String, String> rspHeaders = new HashMap<String, String>();
rspHeaders.put("Content-Type", "application/json; charset=utf-8");

BodyParser.BodyWrapper reqBodyWrapper = BodyParser.parseBody(reqHeaders, reqBody);
BodyParser.BodyWrapper rspBodyWrapper = BodyParser.parseBody(rspHeaders, rspBody);

EventRequestModel eventReq = new EventRequestBuilder()
        .time(new Date())
        .uri("https://api.acmeinc.com/items/reviews/")
        .verb("PATCH")
        .apiVersion("1.1.0")
        .ipAddress("61.48.220.123")
        .headers(reqHeaders)
        .body(reqBodyWrapper.body)
        .transferEncoding(reqBodyWrapper.transferEncoding);
        .build();

EventResponseModel eventRsp = new EventResponseBuilder()
        .time(new Date(System.currentTimeMillis() + 1000))
        .status(500)
        .headers(rspHeaders)
        .body(rspBodyWrapper.body)
        .transferEncoding(rspBodyWrapper.transferEncoding);
        .build();

EventModel eventModel = new EventBuilder()
        .request(eventReq)
        .response(eventRsp)
        .userId("12345")
        .companyId("67890")
        .build();

// Asynchronous Call to Create Event
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");
APIController api = getClient().getAPI();

APICallBack<Object> callBack = new APICallBack<Object>() {
    public void onSuccess(HttpContext context, Object response) {
        // Sent successfully!
    }

    public void onFailure(HttpContext context, Throwable error) {
        // Log there was a failure
    }
};

// Create a batch of events
List<EventModel> events = new ArrayList<EventModel>();
events.add(eventModel);

// Async Call to Send Event to Moesif
api.createEventsBatchAsync(events, callBack);

// Synchronous Call to Send Event to Moesif
api.createEventsBatch(events);
// Import the module:
var moesifapi = require('moesifapi');

// Set your application id
var config = moesifapi.configuration;
config.ApplicationId = 'YOUR_COLLECTOR_APPLICATION_ID';

// Create API Event Models and set fields
var reqHeaders = JSON.parse('{' +
        '"Host": "api.acmeinc.com",' +
        '"Accept": "*/*",' +
        '"Connection": "Keep-Alive",' +
        '"User-Agent": "Apache-HttpClient",' +
        '"Content-Type": "application/json",' +
        '"Content-Length": "126",' +
        '"Accept-Encoding": "gzip"' +
    '}');

var reqBody = JSON.parse( '{' +
        '"items": [' +
            '{' +
                '"type": 1,' +
                '"id": "hello"' +
            '},' +
            '{' +
                '"type": 2,' +
                '"id": "world"' +
            '}' +
        ']' +
    '}');

var rspHeaders = JSON.parse('{' +
        '"Vary": "Accept-Encoding",' +
        '"Pragma": "no-cache",' +
        '"Expires": "-1",' +
        '"Content-Type": "application/json; charset=utf-8",' +
        '"Cache-Control": "no-cache"' +
    '}');

var rspBody = JSON.parse('{' +
        '"Error": "InvalidArgumentException",' +
        '"Message": "Missing field field_a"' +
    '}');

var reqDate = new Date();
var eventReq = {
    time: reqDate,
    uri: "https://api.acmeinc.com/items/reviews/",
    verb: "PATCH",
    apiVersion: "1.1.0",
    ipAddress: "61.48.220.123",
    headers: reqHeaders,
    body: reqBody
};

var eventRsp = {
    time: (new Date()).setMilliseconds(reqDate.getMilliseconds() + 500),
    status: 500,
    headers: rspHeaders,
    body: rspBody
};

var eventA = {
    request: eventReq,
    response: eventRsp,
    userId: "12345",
    companyId: "67890"
};

var myEventModels = [ eventA ]

//Access various controllers by:
var controller = moesifapi.ApiController;

// Send the actual events
controller.createEventsBatch(myEventModels, function(error, response, context) {
  //  Handle Errors
});

from __future__ import print_function
from moesifapi.moesif_api_client import *
from moesifapi.models import *
from datetime import *

# Setup API Client
client = MoesifAPIClient(YOUR_COLLECTOR_APPLICATION_ID)
api = client.api_controller


# Create API Event Models and set fields
req_headers = APIHelper.json_deserialize("""  {
  "Host": "api.acmeinc.com",
  "Accept": "*/*",
  "Connection": "Keep-Alive",
  "User-Agent": "Apache-HttpClient",
  "Content-Type": "application/json",
  "Content-Length": "126",
  "Accept-Encoding": "gzip"
} """)

req_body = APIHelper.json_deserialize( """{
  "items": [
    {
      "type": 1,
      "id": "hello"
    },
    {
      "type": 2,
      "id": "world"
    }
  ]
}""")

rsp_headers = APIHelper.json_deserialize("""  {
    "Date": "Mon, 05 Feb 2024 23:46:49 GMT",
    "Vary": "Accept-Encoding",
    "Pragma": "no-cache",
    "Expires": "-1",
    "Content-Type": "application/json; charset=utf-8"
    "Cache-Control": "no-cache"
  } """)

rsp_body = APIHelper.json_deserialize( """{
    "Error": "InvalidArgumentException",
    "Message": "Missing field field_a"
  }""")


event_req = EventRequestModel(time = datetime.utcnow() - timedelta(seconds=-1),
    uri = "https://api.acmeinc.com/items/reviews/",
    verb = "PATCH",
    api_version = "1.1.0",
    ip_address = "61.48.220.123",
    headers = req_headers,
    body = req_body)

event_rsp = EventResponseModel(time = datetime.utcnow(),
    status = 500,
    headers = rsp_headers,
    body = rsp_body)

event_a = EventModel(request = event_req,
    response = event_rsp,
    user_id = "12345",
    company_id = "67890"

my_events = [ event_a ]

# Send the actual events
api.create_events_batch(my_events)

require 'moesif_api'

# Setup API Client
client = MoesifApi::MoesifAPIClient.new(YOUR_COLLECTOR_APPLICATION_ID)
api = client.api_controller

# Create API Event Models and set fields
event_a = EventModel.new()
event_a.user_id = "12345"
event_a.company_id = "67890"
my_event_models = [ event_a ]

# Send the actual events
api.create_events_batch(my_event_models)

using Moesif.Api;
using Moesif.Api.Helpers;

// Create client instance using your ApplicationId
var client = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID");
var apiClient = GetClient().Api;

// Parameters for the API call
var reqHeaders = APIHelper.JsonDeserialize<object>(@" {
        ""Host"": ""api.acmeinc.com"",
        ""Accept"": ""*/*"",
        ""Connection"": ""Keep-Alive"",
        ""User-Agent"": ""Apache-HttpClient"",
        ""Content-Type"": ""application/json"",
        ""Content-Length"": ""126"",
        ""Accept-Encoding"": ""gzip""
    }");

var reqBody = APIHelper.JsonDeserialize<object>(@" {
        ""items"": [
            {
                ""type"": 1,
                ""id"": ""hello""
            },
            {
                ""type"": 2,
                ""id"": ""world""
            }
        ]
    }");

var rspHeaders = APIHelper.JsonDeserialize<object>(@" {
        ""Date"": ""Mon, 05 Feb 2024 23:46:49 GMT"",
        ""Vary"": ""Accept-Encoding"",
        ""Pragma"": ""no-cache"",
        ""Expires"": ""-1"",
        ""Content-Type"": ""application/json; charset=utf-8"",
        ""Cache-Control"": ""no-cache""
    } ");

var rspBody = APIHelper.JsonDeserialize<object>(@" {
        ""Error"": ""InvalidArgumentException"",
        ""Message"": ""Missing field field_a""
    }");

var reqDate = new Date();
var eventReq = new EventRequestModel()
{
    Time = DateTime.Parse("2024-10-30T04:45:42.914"),
    Uri = "https://api.acmeinc.com/items/reviews/",
    Verb = "PATCH",
    ApiVersion = "1.1.0",
    IpAddress = "61.48.220.123",
    Headers = reqHeaders,
    Body = reqBody
};

var eventRsp = new EventResponseModel()
{
    Time = DateTime.Parse("2024-10-30T04:45:42.914"),
    Status = 500,
    Headers = rspHeaders,
    Body = rspBody
};

var eventModel = new EventModel()
{
    Request = eventReq,
    Response = eventRsp,
    UserId = "12345",
    CompanyId = "67890"
};

// Create a List
var events = new List<EventModel>();
events.Add(eventModel);
events.Add(eventModel);
events.Add(eventModel);

//////////////////////////////////////
// Example for making an async call //  
//////////////////////////////////////
try
{
    await controller.CreateEventsBatchAsync(events);
}
catch(APIException)
{
    // Handle Error
};

///////////////////////////////////////////
// Example for making a synchronous call //
///////////////////////////////////////////
try
{
    controller.CreateEventsBatch(events);
}
catch(APIException)
{
    // Handle Error
};

import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"
import "time"

apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")

reqTime := time.Now().UTC()
apiVersion := "1.0"
ipAddress := "61.48.220.123"

req := models.EventRequestModel{
  Time:       &reqTime,
  Uri:        "https://api.acmeinc.com/widgets",
  Verb:       "GET",
  ApiVersion: &apiVersion,
  IpAddress:  &ipAddress,
  Headers: map[string]interface{}{
    "ReqHeader1": "ReqHeaderValue1",
  },
  Body: nil,
}

rspTime := time.Now().UTC().Add(time.Duration(1) * time.Second)

rsp := models.EventResponseModel{
  Time:      &rspTime,
  Status:    500,
  IpAddress: nil,
  Headers: map[string]interface{}{
    "RspHeader1": "RspHeaderValue1",
  },
  Body: map[string]interface{}{
    "Key1": "Value1",
    "Key2": 12,
    "Key3": map[string]interface{}{
      "Key3_1": "SomeValue",
    },
  },
}

userId := "12345"
companyId := "6789"

event := models.EventModel{
  Request:      req,
  Response:     rsp,
  SessionToken: nil,
  Tags:         nil,
  UserId:       &userId,
  CompanyId:    &companyId,
}

events := make([]*models.EventModel, 20)
for i := 0; i < 20; i++ {
  events[i] = &event
}

// Queue the events
err := apiClient.QueueEvents(events)

// Create the events batch synchronously
err := apiClient.CreateEventsBatch(event)

<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.

require_once "vendor/autoload.php";

// Import the SDK client in your project:

use MoesifApi\MoesifApiClient;

// Instantiate the client. After this, you can now access the Moesif API
// and call the respective methods:

$client = new MoesifApiClient("Your application Id");
$api = $client->getApi();
Name Type Required Description
request object true The object that specifies the API request.

time

string(date-time) true Timestamp for the request in ISO 8601 format.

uri

string true Full uri such as https://api.acmeinc.com/?query=string including protocol, host, and query string.

verb

string true HTTP method used such as GET or POST.

api_version

string false API Version you want to tag this request with such as 1.0.0.

ip_address

string false IP address of the requester, If not set, we extract the remote IP address.

headers

object true Headers of the request as a Map<string, string>. Multiple headers with the same key name should be combined together such that the values are joined by a comma. HTTP Header Protocol on w3.org.

body

object false Payload of the request in either JSON or a base64 encoded string.

transfer_encoding

string false Specifies the transfer encoding of request.body field. If set to json then the response.body must be a JSON object. If set to base64, then request.body must be a base64 encoded string. Helpful for binary payloads. If not set, the body is assumed to be json.
response object false The object that specifies the API response. The response object can be undefined such as a request timeouts.

time

string(date-time) true Timestamp for the response in ISO 8601 format.

status

integer true HTTP status code as number such as 200 or 500.

ip_address

string false IP address of the responding server.

headers

object true Headers of the response as a Map<string, string>. Multiple headers with the same key name should be combined together such that the values are joined by a comma. HTTP Header Protocol on w3.org

body

object false Payload of the response in either JSON or a base64 encoded string.

transfer_encoding

string false Specifies the transfer encoding of response.body field. If set to json then the response.body must be a JSON object. If set to base64, then response.body must be a base64 encoded string. Helpful for binary payloads. If not set, the body is assumed to be json.
transaction_id string false A random 36 char UUID for this event. If set, Moesif will deduplicate events using this id and ensure idempotency. Moesif will still deduplicate even across different size batches.
session_token string false Set the API key/session token used for this API call. Moesif will auto-detect API sessions if not set.
user_id string false Associate this API call to a user. Typically, a real person.
company_id string false Associate this API call to a company (Required for metered billing).
subscription_id string false Associate this API call to a specific subscription of a company. Not needed unless same company can have multiple subscriptions to the same plan. When set, usage will be reported to only this subscription.
direction string false The direction of this API call which can be Incoming or Outgoing.
metadata object false An object containing any custom event metadata you want to store with this event.

Actions

Track a Custom Action

POST https://api.moesif.net/v1/actions

Log a single custom action to Moesif. An action represents something a customer performed on your website such as Sign In or Purchased Subscription. Each action consists of an Action Name and optional Metadata.

An example tracking actions using moesif-browser-js:

var moesif = require('moesif-browser-js');

moesif.init({
  applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});

// The first argument (required) contains the action name string. 
// The second argument (optional) contains event metadata.
moesif.track('Clicked Sign Up', {
  button_label: 'Get Started',
  sign_up_method: 'Google SSO'
});

POST https://api.moesif.net/v1/actions

Example Request
{
  "action_name": "Clicked Sign Up",
  "user_id": "12345",
  "company_id": "67890",
  "transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257",
  "request": {
    "uri": "https://acmeinc.com/pricing",
    "user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
  },
  "metadata": {
    "button_label": "Get Started",
    "sign_up_method": "Google SSO"
  }
}
# You can also use wget
curl -X POST https://api.moesif.net/v1/actions \
  -H 'Content-Type: application/json' \
  -H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID' \
  -d '{"action_name":"Clicked Sign Up","user_id":"12345","company_id":"67890","transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"button_label":"Get Started","sign_up_method":"Google SSO"}}'
var moesif = require('moesif-browser-js');

moesif.init({
  applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});

// The first argument (required) contains the action name string. 
// The second argument (optional) contains event metadata.
moesif.track('Clicked Sign Up', {
  button_label: 'Get Started',
  sign_up_method: 'Google SSO'
});
Name Type Required Description
transaction_id string false A random 36 char UUID for this event. If set, Moesif will deduplicate events using this id and ensure idempotency.
action_name string true A recognizable name such as Clicked Sign Up or Purchased Subscription
session_token string false The customer's current session token as a string.
user_id string false Associate this API call to a user. Typically, a real person.
company_id string false Associate this API call to a company (Required for metered billing).
subscription_id string false Associate this API call to a specific subscription of a company. Not needed unless same company can have multiple subscriptions to the same plan. When set, usage will be reported to only this subscription.
metadata object false An object containing any custom event metadata you want to store with this event.
request object true The object containing the action's request context.

time

string(date-time) false Timestamp for the action in ISO 8601 format. Set by server automatically if not set.

uri

string true Full uri customer is on such as https://wwww.acmeinc.com/pricing?utm_source=adwords including protocol, host, and query string.

ip_address

string false IP address of the customer, If not set, we extract the remote IP address.

user_agent_string

string false The customer's browser agent string for device context.

Track Custom Actions in Batch

POST https://api.moesif.net/v1/actions/batch

Log a batch of custom action to Moesif. An action represents something a customer performed on your website such as Sign In or Purchased Subscription. Each action consists of an Action Name and optional Metadata.

This API takes an array form of the same model defined for track single action. The maximum batch size is 12MB. Break up larger batches.

An example tracking actions using moesif-browser-js:

var moesif = require('moesif-browser-js');

moesif.init({
  applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});

// The first argument (required) contains the action name string. 
// The second argument (optional) contains event metadata.
moesif.track('Clicked Sign Up', {
  button_label: 'Get Started',
  sign_up_method: 'Google SSO'
});

POST https://api.moesif.net/v1/actions/batch

Example Request
[
  {
    "action_name": "Clicked Sign Up",
    "user_id": "12345",
    "company_id": "67890",
    "transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257",
    "request": {
      "uri": "https://acmeinc.com/pricing",
      "user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
    },
    "metadata": {
      "button_label": "Get Started",
      "sign_up_method": "Google SSO"
    }
  },
  {
    "action_name": "Purchased Subscription",
    "user_id": "12345",
    "company_id": "67890",
    "transaction_id": "a90cbabb-2dfc-4290-a368-48ce1a1af7ba",
    "request": {
      "uri": "https://acmeinc.com/pricing",
      "user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
    },
    "metadata": {
      "plan_name": "Pay As You Go",
      "plan_revenue": 5000
    }
  }
]
# You can also use wget
curl -X POST https://api.moesif.net/v1/actions/batch \
  -H 'Content-Type: application/json' \
  -H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID' \
  -d '[{"action_name":"Clicked Sign Up","user_id":"12345","company_id":"67890","transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"button_label":"Get Started","sign_up_method":"Google SSO"}},{"action_name":"Purchased Subscription","user_id":"12345","company_id":"67890","transaction_id": "a90cbabb-2dfc-4290-a368-48ce1a1af7ba","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"plan_name":"Pay As You Go","plan_revenue":5000}}]'
var moesif = require('moesif-browser-js');

moesif.init({
  applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});

// The first argument (required) contains the action name string. 
// The second argument (optional) contains event metadata.
moesif.track('Clicked Sign Up', {
  button_label: 'Get Started',
  sign_up_method: 'Google SSO'
});
Name Type Required Description
transaction_id string false A random 36 char UUID for this event. If set, Moesif will deduplicate events using this id and ensure idempotency. Moesif will still deduplicate even across different size batches.
action_name string true A recognizable name such as Clicked Sign Up or Purchased Subscription
session_token string false The customer's current session token as a string.
user_id string false Associate this API call to a user. Typically, a real person.
company_id string false Associate this API call to a company (Required for metered billing).
subscription_id string false Associate this API call to a specific subscription of a company. Not needed unless same company can have multiple subscriptions to the same plan. When set, usage will be reported to only this subscription.
metadata object false An object containing any custom event metadata you want to store with this event.
request object true The object containing the action's request context.

time

string(date-time) false Timestamp for the action in ISO 8601 format. Set by server automatically if not set.

uri

string true Full uri customer is on such as https://wwww.acmeinc.com/pricing?utm_source=adwords including protocol, host, and query string.

ip_address

string false IP address of the customer, If not set, we extract the remote IP address.

user_agent_string

string false The customer's browser agent string for device context.

Users

Update a User

POST https://api.moesif.net/v1/users

Updates a user profile in Moesif, which is typically a single person or API consumer. For updating customer profiles such as for monetization use cases, see companies and subscriptions.

You can also track users automatically using a Moesif client integration like moesif-browser-js or Segment.

User properties can be stored via the metadata object.

We’ve reserved some metadata fields that have semantic meanings for users, and we handle them in special ways. For example, we expect email to be a string containing the user’s email address which is used to look up a user's demographic enrichment data and send behavioral emails.

Reserved metadata fields include:

Create vs update

If the user does not exist, Moesif will create a new one.

If a user exists, the new user properties will be merged with the existing properties recursively. This means you don't need to resend the entire user object if you are only updating a single field.

Do not call identifyUser for anonymous visitors. The SDK automatically tracks these via a generated anonymousId in localStorage. Once you call identifyUser, Moesif automatically merges multiple user profiles if needed.
POST https://api.moesif.net/v1/users

Example Request
  {
    "user_id": "12345",
    "company_id": "67890",
    "metadata": {
      "email": "[email protected]",
      "first_name": "John",
      "last_name": "Doe",
      "title": "Software Engineer",
      "sales_info": {
          "stage": "Customer",
          "lifetime_value": 24000,
          "account_owner": "[email protected]"
      }
    }
  }
# You can also use wget
curl -X POST https://api.moesif.net/v1/users \
  -d '{"user_id":"12345","company_id":"67890","metadata":{"email":"[email protected]","first_name":"John","last_name":"Doe","title":"Software Engineer","sales_info":{"stage":"Customer","lifetime_value":24000,"account_owner":"[email protected]"}}}' \
  -H 'Accept: application/json' \
  -H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
var moesifapi = require('moesifapi');
var apiClient = moesifapi.ApiController;

moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";

// Only userId is required.
// metadata can be any custom object
var user = {
  userId: '12345',
  companyId: '67890'
  metadata: {
    email: '[email protected]',
    firstName: 'John',
    lastName: 'Doe',
    title: 'Software Engineer',
    salesInfo: {
        stage: 'Customer',
        lifetimeValue: 24000,
        accountOwner: '[email protected]',
    },
  }
};
// 4. Create a single user
apiClient.updateUser(new moesifapi.UserModel(user), function(error, response, context) {
  // Do Something
});
from moesifapi.moesif_api_client import *
from moesifapi.models import *

api_client = MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").api

# Only user_id is required.
# metadata can be any custom object
user = {
  'user_id': '12345',
  'company_id': '67890', # If set, associate user with a company object
  'metadata': {
    'email': '[email protected]',
    'first_name': 'John',
    'last_name': 'Doe',
    'title': 'Software Engineer',
    'sales_info': {
        'stage': 'Customer',
        'lifetime_value': 24000,
        'account_owner': '[email protected]'
    },
  }
}

update_user = api_client.update_user(user)
api_client = MoesifApi::MoesifAPIClient.new('YOUR_COLLECTOR_APPLICATION_ID').api

metadata => {
  :email => '[email protected]',
  :first_name => 'John',
  :last_name => 'Doe',
  :title => 'Software Engineer',
  :salesInfo => {
      :stage => 'Customer',
      :lifetime_value => 24000,
      :accountOwner => '[email protected]',
  }
}

# Only user_id is required.
# metadata can be any custom object
user = UserModel.new()
user.user_id = "12345"
user.company_id = "67890" # If set, associate user with a company object
user.metadata = metadata

update_user = api_client.update_user(user)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.
require_once "vendor/autoload.php";

// Import the SDK client in your project:
use MoesifApi\MoesifApiClient;
$apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID")->getApi();;

// metadata can be any custom object
$user->metadata = array(
        "email" => "[email protected]",
        "first_name" => "John",
        "last_name" => "Doe",
        "title" => "Software Engineer",
        "sales_info" => array(
            "stage" => "Customer",
            "lifetime_value" => 24000,
            "account_owner" => "[email protected]"
        )
    );

$user = new Models\UserModel();
$user->userId = "12345";
$user->companyId = "67890"; // If set, associate user with a company object
$user->metadata = $metadata;

$apiClient->updateUser($user);
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"

apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")

// metadata can be any custom dictionary
metadata := map[string]interface{}{
  "email", "[email protected]",
  "first_name", "John",
  "last_name", "Doe",
  "title", "Software Engineer",
  "sales_info", map[string]interface{}{
      "stage", "Customer",
      "lifetime_value", 24000,
      "account_owner", "[email protected]",
  },
}

// Only UserId is required
user := models.UserModel{
  UserId:  "12345",
  CompanyId:  "67890", // If set, associate user with a company object
  Metadata:  &metadata,
}

// Queue the user asynchronously
err := apiClient.QueueUser(&user)

// Update the user synchronously
err := apiClient.UpdateUser(&user)
var apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID").Api;;

// metadata can be any custom dictionary
var metadata = new Dictionary<string, object>
{
    {"email", "[email protected]"},
    {"first_name", "John"},
    {"last_name", "Doe"},
    {"title", "Software Engineer"},
    {"sales_info", new Dictionary<string, object> {
        {"stage", "Customer"},
        {"lifetime_value", 24000},
        {"account_owner", "[email protected]"}
    }
};

// Only user_id is required
var user = new UserModel()
{
    UserId = "12345",
  CompanyId = "67890",
    Metadata = metadata
};

// Update the user asynchronously
await apiClient.UpdateUserAsync(user);

// Update the user synchronously
apiClient.UpdateUser(user);
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");

// Only userId is required
// metadata can be any custom object
UserModel user = new UserBuilder()
    .userId("12345")
    .companyId("67890") // If set, associate user with a company object
    .metadata(APIHelper.deserialize("{" +
        "\"email\": \"[email protected]\"," +
        "\"first_name\": \"John\"," +
        "\"last_name\": \"Doe\"," +
        "\"title\": \"Software Engineer\"," +
        "\"sales_info\": {" +
            "\"stage\": \"Customer\"," +
            "\"lifetime_value\": 24000," +
            "\"account_owner\": \"[email protected]\"" +
          "}" +
        "}"))
    .build();

// Asynchronous Call to update user
client.getAPI().updateUserAsync(user, callBack);

// Synchronous Call to update user
client.getAPI().updateUser(user);
var moesif = require('moesif-browser-js');

moesif.init({
  applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
  // add other option here.
});

// The second argument containing user metatdata is optional,
// but useful to store customer properties like email and name.
moesif.identifyUser('12345', {
  email: '[email protected]',
  firstName: 'John',
  lastName: 'Doe',
  title: 'Software Engineer',
  salesInfo: {
      stage: 'Customer',
      lifetimeValue: 24000,
      accountOwner: '[email protected]',
  },
});

User id

Users in Moesif are identified via a user_id and should be a permanent and robust identifier, like a database id. We recommend not using values that can change like email addresses or usernames. The user_id matches the identifyUser hook in your API monitoring agent.

Users can also be associated to a company by setting the company_id field when you update a user. This enables tracking API usage for individual users along with account-level usage.

Name Type Required Description
user_id string true The unique identifier for this user.
company_id string false Associate the user with a company (Helpful for B2B companies)
session_token string false Associate this user with a new API key/session token. This field is append only meaning when you set this field, previously set tokens are not removed.
modified_time string(date-time) false Last modified time of user profile. Set automatically by Moesif if not provided.
ip_address string false Set the user's last known ip address. Moesif sets this automatically from the user's most recent API activity if not provided.
user_agent_string string false Set the user's last known user agent. Moesif sets this automatically from the user's most recent API activity if not provided.
campaign object false Referrer and UTM parameters to track effectiveness of your acquisition channels. Set automatically by moesif-browser-js, but not with server side SDKs

utm_source

string false UTM parameter that identifies which site sent the traffic

utm_medium

string false UTM parameter that identifies what type of link was used, such as cost per click or email.

utm_campaign

string false UTM parameter that identifies a specific product promotion or strategic campaign.

utm_term

string false UTM parameter that identifies search terms.

utm_content

string false UTM parameter that identifies what specifically was clicked to bring the user to the site, such as a banner ad or a text link.

referrer

string false The referring URI before your domain.

referring_domain

string false The referring domain of the page that linked to your domain.

gclid

string false Google click Identifier to track Google Ads
metadata object false An object containing user demographics or other properties you want to store with this profile.

Update Users in Batch

POST https://api.moesif.net/v1/users/batch

Updates a list of user profiles in a single batch. Users are typically a single person or API consumer. For updating customer profiles such as for monetization use cases, see companies and subscriptions.

You can also track users automatically using a Moesif client integration like moesif-browser-js or Segment.

Any custom user properties can be stored via the metadata object.

We’ve reserved some fields names in the metadata object that have semantic meanings for users, and we handle them in special ways. For example, we expect email to be a string containing the user’s email address which is used to sync with external CRMs and to look up a user's Gravatar and demographics.

Reserved metadata fields include:

Create vs update

If the user does not exist, Moesif will create a new one.

If a user exists, the new user properties will be merged with the existing properties recursively. This means you don't need to resend the entire user object if you are only updating a single field.

POST https://api.moesif.net/v1/users/batch

Example Request
[
  {
    "user_id": "12345",
    "company_id": "67890",
    "metadata": {
      "email": "[email protected]",
      "first_name": "John",
      "last_name": "Doe",
      "title": "Software Engineer",
      "sales_info": {
        "stage": "Customer",
        "lifetime_value": 24000,
        "account_owner": "[email protected]"
      }
    }
  },
  {
    "user_id": "54321",
    "company_id": "67890",
    "metadata": {
      "email": "[email protected]",
      "first_name": "Mary",
      "last_name": "Jane",
      "title": "Software Engineer",
      "sales_info": {
        "stage": "Customer",
        "lifetime_value": 24000,
        "account_owner": "[email protected]"
      }
    }
  }
]
# You can also use wget
curl -X POST https://api.moesif.net/v1/users/batch \
  -d '[{"user_id":"12345","company_id":"67890","metadata":{"email":"[email protected]","first_name":"John","last_name":"Doe","title":"Software Engineer","sales_info":{"stage":"Customer","lifetime_value":24000,"account_owner":"[email protected]"}}},{"user_id":"54321","company_id":"67890","metadata":{"email":"[email protected]","first_name":"Mary","last_name":"Jane","title":"Software Engineer","sales_info":{"stage":"Customer","lifetime_value":24000,"account_owner":"[email protected]"}}}]' \
  -H 'Accept: application/json' \
  -H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'


var moesifapi = require('moesifapi');
var apiClient = moesifapi.ApiController;

moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";

// 3. Generate a User Model
var userA = {
  userId: '12345',
  companyId: '67890'
  metadata: {
    email: '[email protected]',
    firstName: 'John',
    lastName: 'Doe',
    title: 'Software Engineer',
    salesInfo: {
        stage: 'Customer',
        lifetimeValue: 24000,
        accountOwner: '[email protected]',
    },
  }
};

var userB = {
  userId: '67890',
  companyId: '67890'
  metadata: {
    email: '[email protected]',
    firstName: 'Mary',
    lastName: 'Jane',
    title: 'Software Engineer',
    salesInfo: {
        stage: 'Customer',
        lifetimeValue: 24000,
        accountOwner: '[email protected]',
    },
  }
};

var users = [
  new moesifapi.UserModel(userA),
  new moesifapi.UserModel(userB)
];

// 4. Send batch of users
apiClient.updateUsersBatch(users, function(error, response, context) {
  // Do Something
});
from moesifapi.moesif_api_client import *
from moesifapi.models import *

api_client = MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").api

userA = {
  'user_id': '12345',
  'company_id': '67890', # If set, associate user with a company object
  'metadata': {
    'email': '[email protected]',
    'first_name': 'John',
    'last_name': 'Doe',
    'title': 'Software Engineer',
    'sales_info': {
        'stage': 'Customer',
        'lifetime_value': 24000,
        'account_owner': '[email protected]'
    },
  }
}

userB = {
  'user_id': '54321',
  'company_id': '67890', # If set, associate user with a company object
  'metadata': {
    'email': '[email protected]',
    'first_name': 'Mary',
    'last_name': 'Jane',
    'title': 'Software Engineer',
    'sales_info': {
        'stage': 'Customer',
        'lifetime_value': 48000,
        'account_owner': '[email protected]'
    },
  }
}
update_users = api_client.update_users_batch([userA, userB])
api_client = MoesifApi::MoesifAPIClient.new('YOUR_COLLECTOR_APPLICATION_ID').api

users = []

metadata => {
  :email => '[email protected]',
  :first_name => 'John',
  :last_name => 'Doe',
  :title => 'Software Engineer',
  :salesInfo => {
      :stage => 'Customer',
      :lifetime_value => 24000,
      :accountOwner => '[email protected]',
  }
}

# Only user_id is required.
# metadata can be any custom object
user = UserModel.new()
user.user_id = "12345"
user.company_id = "67890" # If set, associate user with a company object
user.metadata = metadata

users << user

api_client = api_controller.update_users_batch(user_model)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.
require_once "vendor/autoload.php";

use MoesifApi\MoesifApiClient;
$apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID")->getApi();

// metadata can be any custom object
$userA->metadata = array(
        "email" => "[email protected]",
        "first_name" => "John",
        "last_name" => "Doe",
        "title" => "Software Engineer",
        "sales_info" => array(
            "stage" => "Customer",
            "lifetime_value" => 24000,
            "account_owner" => "[email protected]"
        )
    );

$userA = new Models\UserModel();
$userA->userId = "12345";
$userA->companyId = "67890"; // If set, associate user with a company object
$userA->metadata = $metadata;

// metadata can be any custom object
$userB->metadata = array(
        "email" => "[email protected]",
        "first_name" => "Mary",
        "last_name" => "Jane",
        "title" => "Software Engineer",
        "sales_info" => array(
            "stage" => "Customer",
            "lifetime_value" => 24000,
            "account_owner" => "[email protected]"
        )
    );

$userB = new Models\UserModel();
$userB->userId = "12345";
$userB->companyId = "67890"; // If set, associate user with a company object
$userB->metadata = $metadata;

$users = array($userA, $userB)
$apiClient->updateUsersBatch($user);
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"

apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")

// List of Users
var users []*models.UserModel

// metadata can be any custom dictionary
metadata := map[string]interface{}{
  "email", "[email protected]",
  "first_name", "John",
  "last_name", "Doe",
  "title", "Software Engineer",
  "sales_info", map[string]interface{}{
      "stage", "Customer",
      "lifetime_value", 24000,
      "account_owner", "[email protected]",
  },
}

// Only UserId is required
userA := models.UserModel{
  UserId:  "12345",
  CompanyId:  "67890", // If set, associate user with a company object
  Metadata:  &metadata,
}

users = append(users, &userA)

// Queue the user asynchronously
err := apiClient.QueueUsers(&users)

// Update the user synchronously
err := apiClient.UpdateUsersBatch(&users)
var apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID").Api;;

var users = new List<UserModel>();

var metadataA = new Dictionary<string, object>
{
    {"email", "[email protected]"},
    {"first_name", "John"},
    {"last_name", "Doe"},
    {"title", "Software Engineer"},
    {"sales_info", new Dictionary<string, object> {
        {"stage", "Customer"},
        {"lifetime_value", 24000},
        {"account_owner", "[email protected]"}
    }
};

// Only user_id is required
var userA = new UserModel()
{
    UserId = "12345",
  CompanyId = "67890", // If set, associate user with a company object
    Metadata = metadataA
};

var metadataB = new Dictionary<string, object>
{
    {"email", "[email protected]"},
    {"first_name", "Mary"},
    {"last_name", "Jane"},
    {"title", "Software Engineer"},
    {"sales_info", new Dictionary<string, object> {
        {"stage", "Customer"},
        {"lifetime_value", 24000},
        {"account_owner", "[email protected]"}
    }
};

// Only user_id is required
var userB = new UserModel()
{
    UserId = "54321",
  CompanyId = "67890",
    Metadata = metadataA
};


users.Add(userA);
users.Add(userB);

// Update the users asynchronously
await apiClient.UpdateUsersBatchAsync(users);

// Update the users synchronously
apiClient.UpdateUsersBatch(users);
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");

List<UserModel> users = new ArrayList<UserModel>();

UserModel userA = new UserBuilder()
        .userId("12345")
        .companyId("67890")
        .metadata(APIHelper.deserialize("{" +
            "\"email\": \"[email protected]\"," +
            "\"first_name\": \"John\"," +
            "\"last_name\": \"Doe\"," +
            "\"title\": \"Software Engineer\"," +
            "\"sales_info\": {" +
                "\"stage\": \"Customer\"," +
                "\"lifetime_value\": 24000," +
                "\"account_owner\": \"[email protected]\"" +
              "}" +
            "}"))
        .build();
users.add(userA);

UserModel userB = new UserBuilder()
        .userId("54321")
        .companyId("67890")
        .metadata(APIHelper.deserialize("{" +
            "\"email\": \"[email protected]\"," +
            "\"first_name\": \"John\"," +
            "\"last_name\": \"Doe\"," +
            "\"title\": \"Software Engineer\"," +
            "\"sales_info\": {" +
                "\"stage\": \"Customer\"," +
                "\"lifetime_value\": 24000," +
                "\"account_owner\": \"[email protected]\"" +
              "}" +
            "}"))
        .build();
users.add(userB);

// Asynchronous call to update users
APICallBack<Object> callBack = new APICallBack<Object>() {
    public void onSuccess(HttpContext context, Object response) {
      // Do something
    }

    public void onFailure(HttpContext context, Throwable error) {
      // Do something else
    }
};

// Asynchronous call to update users
client.getAPI().updateUsersBatchAsync(users, callBack);


// Synchronous call to update users
client.getAPI().updateUsersBatch(users);
Since this is a client side SDK, you cannot save a batch of users with moesif-browser-js.

User id

Users in Moesif are identified via a user_id and should be a permanent and robust identifier, like a database id. We recommend not using values that can change like email addresses or usernames. The user_id matches the identifyUser hook in your API monitoring agent.

Users can also be associated to a company by setting the company_id field when you update a user. This enables tracking API usage for individual users along with account-level usage.

Name Type Required Description
user_id string true The unique identifier for this user.
company_id string false Associate the user with a company (Helpful for B2B companies).
session_token string false Associate this user with a new API key/session token. This field is append only meaning when you set this field, previously set tokens are not removed.
modified_time string(date-time) false Last modified time of user profile. Set automatically by Moesif if not provided.
ip_address string false Set the user's last known ip address. Moesif sets this automatically from the user's most recent API activity if not provided.
user_agent_string string false Set the user's last known user agent. Moesif sets this automatically from the user's most recent API activity if not provided.
campaign object false Referrer and UTM parameters to track effectiveness of your acquisition channels. Set automatically by moesif-browser-js, but not with server side SDKs.

utm_source

string false UTM parameter that identifies which site sent the traffic.

utm_medium

string false UTM parameter that identifies what type of link was used, such as cost per click or email.

utm_campaign

string false UTM parameter that identifies a specific product promotion or strategic campaign.

utm_term

string false UTM parameter that identifies search terms.

utm_content

string false UTM parameter that identifies what specifically was clicked to bring the user to the site, such as a banner ad or a text link.

referrer

string false The referring URI before your domain.

referring_domain

string false The referring domain of the page that linked to your domain.

gclid

string false Google click Identifier to track Google Ads.
metadata object false An object containing user demographics or other properties you want to store with this profile.

Companies

Update a Company

POST https://api.moesif.net/v1/companies

Updates a company profile in Moesif. A company is your direct customer paying for your service. A company can have one or more users and one or more subscriptions. More info on the Moesif data model.

You can save custom properties to a company via the metadata object. While optional, it's also recommended to set the company_domain. When set, Moesif will enrich the company with publicly available information.

If company does not exist, a new one will be created. If a company exists, it will be merged on top of existing fields. Any new field set will override the existing fields. This is done via recursive merge which merges inner objects.

Create vs update

If the company does not exist, Moesif will create a new one.

If a company exists, the new company properties will be merged with the existing properties recursively. This means you don't need to resend the entire company object if you are only updating a single field.

If you call both identifyUser() and identifyCompany() in the same session, then Moesif will automatically associate the user with the company.
POST https://api.moesif.net/v1/companies

Example Request
{
  "company_id": "12345",
  "company_domain": "acmeinc.com",
  "metadata": {
    "org_name": "Acme, Inc",
    "plan_name": "Free",
    "deal_stage": "Lead",
    "mrr": 24000,
    "demographics": {
      "alexa_ranking": 500000,
      "employee_count": 47
    }
  }
}
# You can also use wget
curl -X POST https://api.moesif.net/v1/companies \
  -d '{"company_id":"12345","company_domain":"acmeinc.com","metadata":{"org_name":"Acme, Inc","plan_name":"Free","deal_stage":"Lead","mrr":24000,"demographics":{"alexa_ranking":500000,"employee_count":47}}}' \
  -H 'Accept: application/json' \
  -H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
var moesifapi = require('moesifapi');
var apiClient = moesifapi.ApiController;

moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";


// Only companyId is required.
// metadata can be any custom object
var company = {
  companyId: '67890',
  companyDomain: 'acmeinc.com', // If domain is set, Moesif will enrich your profiles with publicly available info 
  metadata: {
    orgName: 'Acme, Inc',
    planName: 'Free Plan',
    dealStage: 'Lead',
    mrr: 24000,
    demographics: {
      alexaRanking: 500000,
      employeeCount: 47
    }
  }
};

apiClient.updateCompany(company, function(error, response, context) {
  // Do Something
});
from moesifapi.moesif_api_client import *
from moesifapi.models import *

api_client = MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").api

# Only company_id is required.
# metadata can be any custom object
company = {
  'company_id': '12345',
  'company_domain': 'acmeinc.com', # If domain is set, Moesif will enrich your profiles with publicly available info 
  'metadata': {
    'org_name': 'Acme, Inc',
    'plan_name': 'Free',
    'deal_stage': 'Lead',
    'mrr': 24000,
    'demographics': {
        'alexa_ranking': 500000,
        'employee_count': 47
    },
  }
}

update_company = api_client.update_company(company)
api_client = MoesifApi::MoesifAPIClient.new('YOUR_COLLECTOR_APPLICATION_ID').api

metadata => {
  :org_name => 'Acme, Inc',
  :plan_name => 'Free',
  :deal_stage => 'Lead',
  :mrr => 24000,
  :demographics => {
      :alexa_ranking => 500000,
      :employee_count => 47
  }
}

# Only company_id is required.
# metadata can be any custom object
company = CompanyModel.new()
company.company_id = "67890"
company.company_domain = "acmeinc.com" # If domain is set, Moesif will enrich your profiles with publicly available info 
company.metadata = metadata

update_company = api_client.update_company(company)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.

require_once "vendor/autoload.php";

use MoesifApi\MoesifApiClient;
$apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID")->getApi();


$company = new Models\CompanyModel();
$company->companyId = "67890";
$company->companyDomain = "acmeinc.com";

// metadata can be any custom object
$company->metadata = array(
        "org_name" => "Acme, Inc",
        "plan_name" => "Free",
        "deal_stage" => "Lead",
        "mrr" => 24000,
        "demographics" => array(
            "alexa_ranking" => 500000,
            "employee_count" => 47
        )
    );

$apiClient->updateCompany($company);
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"

apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")

// metadata can be any custom dictionary
metadata := map[string]interface{}{
  "org_name", "Acme, Inc",
  "plan_name", "Free",
  "deal_stage", "Lead",
  "mrr", 24000,
  "demographics", map[string]interface{}{
      "alexa_ranking", 500000,
      "employee_count", 47,
  },
}

// Prepare company model
company := models.CompanyModel{
    CompanyId:        "67890",  // The only required field is your company id
    CompanyDomain:    "acmeinc.com", // If domain is set, Moesif will enrich your profiles with publicly available info 
    Metadata:         &metadata,
}

// Queue the company asynchronously
apiClient.QueueCompany(&company)

// Update the company synchronously
err := apiClient.UpdateCompany(&company)
var apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID").Api;;

// metadata can be any custom dictionary
var metadata = new Dictionary<string, object>
{
    {"org_name", "Acme, Inc"},
    {"plan_name", "Free"},
    {"deal_stage", "Lead"},
    {"mrr", 24000},
    {"demographics", new Dictionary<string, object> {
        {"alexa_ranking", 500000},
        {"employee_count", 47}
    }
};

// Only company id is required
var company = new CompanyModel()
{
  CompanyId = "67890",
  CompanyDomain = "acmeinc.com", // If domain is set, Moesif will enrich your profiles with publicly available info 
    Metadata = metadata
};

// Update the company asynchronously
await apiClient.UpdateCompanyAsync(company);

// Update the company synchronously
apiClient.UpdateCompany(company);
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").Api;

// Only companyId is required
// metadata can be any custom object
CompanyModel company = new CompanyBuilder()
    .companyId("67890")
    .companyDomain("acmeinc.com") // If set, Moesif will enrich your profiles with publicly available info 
    .metadata(APIHelper.deserialize("{" +
        "\"org_name\": \"Acme, Inc\"," +
        "\"plan_name\": \"Free\"," +
        "\"deal_stage\": \"Lead\"," +
        "\"mrr\": 24000," +
        "\"demographics\": {" +
            "\"alexa_ranking\": 500000," +
            "\"employee_count\": 47" +
          "}" +
        "}"))
    .build();

// Asynchronous Call to update company
client.getAPI().updateCompanyAsync(company, callBack);

// Synchronous Call to update company
client.getAPI().updateCompany(company, callBack);
var moesif = require('moesif-browser-js');

moesif.init({
  applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
  // add other option here.
});

// Only the first argument is a string containing the company id. 
// This is the only required field. 
//
// The second argument is a object used to store a company info like plan, 
// MRR, and company demographics.
// 
// The third argument is a string containing company website or email domain. 
// If set, Moesif will enrich your profiles with publicly available info.  
metadata = {
  orgName: 'Acme, Inc',
  planName: 'Free Plan',
  dealStage: 'Lead',
  mrr: 24000,
  demographics: {
    alexaRanking: 500000,
    employeeCount: 47
  }
};

moesif.identifyCompany('67890', metadata, 'acmeinc.com');

Company ids

Users in Moesif are identified via a company_id and should be a permanent and robust identifier, like a database id. We recommend not using values that can change like website domain or company name. The company_id matches the identifyCompany hook in your API monitoring agent.

Users can also be associated to a company by setting the company_id field when you update a user. This enables tracking API usage for individual users along with account-level usage.

Name Type Required Description
company_id string true The unique identifier for this company.
company_domain string false If set, Moesif will enrich your company profile with publicly available info
session_token string false Associate this company with a new API key/session token. This field is append only meaning when you set this field, previously set tokens are not removed.
modified_time string(date-time) false Last modified time of company profile. Set automatically by Moesif if not provided.
ip_address string false Set the company's last known ip address. Moesif sets this automatically from the user's most recent API activity if not provided.
campaign object false Referrer and UTM parameters to track effectiveness of your acquisition channels. Set automatically by moesif-browser-js, but not with server side SDKs

utm_source

string false UTM parameter that identifies which site sent the traffic

utm_medium

string false UTM parameter that identifies what type of link was used, such as cost per click or email.

utm_campaign

string false UTM parameter that identifies a specific product promotion or strategic campaign.

utm_term

string false UTM parameter that identifies search terms.

utm_content

string false UTM parameter that identifies what specifically was clicked to bring the company to the site, such as a banner ad or a text link.

referrer

string false The referring URI before your domain.

referring_domain

string false The referring domain of the page that linked to your domain.

gclid

string false Google click Identifier to track Google Ads
metadata object false An object containing company demographics or other properties you want to store with this profile.

Update Companies in Batch

POST https://api.moesif.net/v1/companies/batch

Updates a list of companies profile in Moesif.

A custom JSON object can be placed in the metadata object of each company which will be stored as part of the company profile.

A company is your direct customer paying for your service. A company can have one or more users and one or more subscriptions. More info on the Moesif data model.

You can save custom properties to a company via the metadata object. While optional, it's also recommended to set the company_domain. When set, Moesif will enrich the company with publicly available information.

If company does not exist, a new one will be created. If a company exists, it will be merged on top of existing fields. Any new field set will override the existing fields. This is done via recursive merge which merges inner objects.

POST https://api.moesif.net/v1/companies/batch

Example Request
[
  {
    "company_id": "12345",
    "company_domain": "acmeinc.com",
    "metadata": {
      "org_name": "Acme, Inc",
      "plan_name": "Free",
      "deal_stage": "Lead",
      "mrr": 24000,
      "demographics": {
        "alexa_ranking": 500000,
        "employee_count": 47
      }
    }
  },
  {
    "company_id": "54321",
    "company_domain": "contoso.com",
    "metadata": {
      "org_name": "Contoso, Inc",
      "plan_name": "Paid",
      "deal_stage": "Lead",
      "mrr": 48000,
      "demographics": {
        "alexa_ranking": 500000,
        "employee_count": 47
      }
    }
  }
]
# You can also use wget
curl -X POST https://api.moesif.net/v1/companies/batch \
  -d '[{"company_id":"12345","company_domain":"acmeinc.com","metadata":{"org_name":"Acme, Inc","plan_name":"Free","deal_stage":"Lead","mrr":24000,"demographics":{"alexa_ranking":500000,"employee_count":47}}},{"company_id":"54321","company_domain":"contoso.com","metadata":{"org_name":"Contoso, Inc","plan_name":"Paid","deal_stage":"Lead","mrr":48000,"demographics":{"alexa_ranking":500000,"employee_count":47}}}]' \
  -H 'Accept: application/json' \
  -H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
var moesifapi = require('moesifapi');
var apiClient = moesifapi.ApiController;

moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";


// Only companyId is required.
// metadata can be any custom object
var companies = [{
    companyId: '67890',
    companyDomain: 'acmeinc.com', // If domain is set, Moesif will enrich your profiles with publicly available info 
    metadata: {
      orgName: 'Acme, Inc',
      planName: 'Free Plan',
      dealStage: 'Lead',
      mrr: 24000,
      demographics: {
        alexaRanking: 500000,
        employeeCount: 47
      }
    }
  },
  {
    companyId: '09876',
    companyDomain: 'contoso.com', // If domain is set, Moesif will enrich your profiles with publicly available info 
    metadata: {
      orgName: 'Contoso, Inc',
      planName: 'Paid Plan',
      dealStage: 'Lead',
      mrr: 48000,
      demographics: {
        alexaRanking: 500000,
        employeeCount: 53
      }
    }
  }
]

apiClient.updateCompanies(companies, function(error, response, context) {
  // Do Something
});
from moesifapi.moesif_api_client import *
from moesifapi.models import *

api_client = MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").api

# Only company_id is required.
# metadata can be any custom object
companies = [{
  'company_id': '67890',
  'company_domain': 'acmeinc.com', # If domain is set, Moesif will enrich your profiles with publicly available info 
  'metadata': {
    'org_name': 'Acme, Inc',
    'plan_name': 'Free',
    'deal_stage': 'Lead',
    'mrr': 24000,
    'demographics': {
        'alexa_ranking': 500000,
        'employee_count': 47
    },
  }
},
{
  'company_id': '09876',
  'company_domain': 'contoso.com', # If domain is set, Moesif will enrich your profiles with publicly available info 
  'metadata': {
    'org_name': 'Contoso, Inc',
    'plan_name': 'Paid',
    'deal_stage': 'Lead',
    'mrr': 48000,
    'demographics': {
        'alexa_ranking': 500000,
        'employee_count': 53
    },
  }
}]

update_company = api_client.update_companies(companies)
api_client = MoesifApi::MoesifAPIClient.new('YOUR_COLLECTOR_APPLICATION_ID').api

companies = []

metadata => {
  :org_name => 'Acme, Inc',
  :plan_name => 'Free',
  :deal_stage => 'Lead',
  :mrr => 24000,
  :demographics => {
      :alexa_ranking => 500000,
      :employee_count => 47
  }
}

# Only company_id is required.
# metadata can be any custom object
company = CompanyModel.new()
company.company_id = "67890"
company.company_domain = "acmeinc.com" # If domain is set, Moesif will enrich your profiles with publicly available info 
company.metadata = metadata

companies << company

update_company = api_client.update_companies(companies)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.

require_once "vendor/autoload.php";

use MoesifApi\MoesifApiClient;
$apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID")->getApi();

$companyA = new Models\CompanyModel();
$companyA->companyId = "67890";
$companyA->companyDomain = "acmeinc.com";

// metadata can be any custom object
$companyB->metadata = array(
        "org_name" => "Acme, Inc",
        "plan_name" => "Free",
        "deal_stage" => "Lead",
        "mrr" => 24000,
        "demographics" => array(
            "alexa_ranking" => 500000,
            "employee_count" => 47
        )
    );

$companyB = new Models\CompanyModel();
$companyB->companyId = "67890";
$companyB->companyDomain = "acmeinc.com";

// metadata can be any custom object
$companyB->metadata = array(
        "org_name" => "Acme, Inc",
        "plan_name" => "Free",
        "deal_stage" => "Lead",
        "mrr" => 24000,
        "demographics" => array(
            "alexa_ranking" => 500000,
            "employee_count" => 47
        )
    );

$companies = array($companyA, $companyB)
$apiClient->updateCompaniesBatch(array($companies));
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"

apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")

// List of Companies
var companies []*models.CompanyModel

// metadata can be any custom dictionary
metadata := map[string]interface{}{
  "org_name", "Acme, Inc",
  "plan_name", "Free",
  "deal_stage", "Lead",
  "mrr", 24000,
  "demographics", map[string]interface{}{
      "alexa_ranking", 500000,
      "employee_count", 47,
  },
}

// Prepare company model
companyA := models.CompanyModel{
    CompanyId:        "67890",  // The only required field is your company id
    CompanyDomain:  "acmeinc.com", // If domain is set, Moesif will enrich your profiles with publicly available info 
    Metadata:           &metadata,
}

companies = append(companies, &companyA)

// Queue the company asynchronously
apiClient.QueueCompanies(&companies)

// Update the company synchronously
err := apiClient.UpdateCompaniesBatch(&companies)
var apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID").Api;;

var companies = new List<CompanyModel>();

// metadata can be any custom dictionary
var metadataA = new Dictionary<string, object>
{
    {"org_name", "Acme, Inc"},
    {"plan_name", "Free"},
    {"deal_stage", "Lead"},
    {"mrr", 24000},
    {"demographics", new Dictionary<string, object> {
        {"alexa_ranking", 500000},
        {"employee_count", 47}
    }
};

// Only company id is required
var companyA = new CompanyModel()
{
  CompanyId = "67890",
  CompanyDomain = "acmeinc.com", // If domain is set, Moesif will enrich your profiles with publicly available info 
    Metadata = metadata
};

// metadata can be any custom dictionary
var metadataB = new Dictionary<string, object>
{
    {"org_name", "Contoso, Inc"},
    {"plan_name", "Paid"},
    {"deal_stage", "Lead"},
    {"mrr", 48000},
    {"demographics", new Dictionary<string, object> {
        {"alexa_ranking", 500000},
        {"employee_count", 53}
    }
};

// Only company id is required
var companyB = new CompanyModel()
{
  CompanyId = "09876",
  CompanyDomain = "contoso.com", // If domain is set, Moesif will enrich your profiles with publicly available info 
    Metadata = metadata
};


companies.Add(companyA);
companies.Add(companyB);

// Update the companies asynchronously
await apiClient.UpdateCompaniesBatchAsync(companies);

// Update the companies synchronously
apiClient.UpdateCompaniesBatch(companies);
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").Api;

// Only companyId is required
// metadata can be any custom object
CompanyModel company = new CompanyBuilder()
    .companyId("67890")
    .companyDomain("acmeinc.com") // If set, Moesif will enrich your profiles with publicly available info 
    .metadata(APIHelper.deserialize("{" +
        "\"org_name\": \"Acme, Inc\"," +
        "\"plan_name\": \"Free\"," +
        "\"deal_stage\": \"Lead\"," +
        "\"mrr\": 24000," +
        "\"demographics\": {" +
            "\"alexa_ranking\": 500000," +
            "\"employee_count\": 47" +
          "}" +
        "}"))
    .build();

// Create a batch of companies
List<EventModel> events = new ArrayList<CompanyModel>();
events.add(company);

// Asynchronous Call to update companies
client.getAPI().updateCompaniesBatchAsync(companies, callBack);

// Synchronous Call to update companies
client.getAPI().updateCompaniesBatch(companies);
Since this is a client side SDK, you cannot save a batch of companies with moesif-browser-js.

Company ids

Users in Moesif are identified via a company_id and should be a permanent and robust identifier, like a database id. We recommend not using values that can change like website domain or company name. The company_id matches the identifyCompany hook in your API monitoring agent.

Users can also be associated to a company by setting the company_id field when you update a user. This enables tracking API usage for individual users along with account-level usage.

Name Type Required Description
company_id string true The unique identifier for this company.
company_domain string false If set, Moesif will enrich your company profile with publicly available info
session_token string false Associate this company with a new API key/session token. This field is append only meaning when you set this field, previously set tokens are not removed.
modified_time string(date-time) false Last modified time of company profile. Set automatically by Moesif if not provided.
ip_address string false Set the company's last known ip address. Moesif sets this automatically from the user's most recent API activity if not provided.
campaign object false Referrer and UTM parameters to track effectiveness of your acquisition channels. Set automatically by moesif-browser-js, but not with server side SDKs

utm_source

string false UTM parameter that identifies which site sent the traffic

utm_medium

string false UTM parameter that identifies what type of link was used, such as cost per click or email.

utm_campaign

string false UTM parameter that identifies a specific product promotion or strategic campaign.

utm_term

string false UTM parameter that identifies search terms.

utm_content

string false UTM parameter that identifies what specifically was clicked to bring the company to the site, such as a banner ad or a text link.

referrer

string false The referring URI before your domain.

referring_domain

string false The referring domain of the page that linked to your domain.

gclid

string false Google click Identifier to track Google Ads
metadata object false An object containing company demographics or other properties you want to store with this profile.

Subscriptions

Update a Subscription

POST https://api.moesif.net/v1/subscriptions

Updates a subscription for a subscription in Moesif. A subscription represents a single plan a customer is subscribed to and paying for. A company can have one or more subscriptions. Any custom subscription properties can be stored via the metadata object.

Create vs update

If the subscription does not exist, Moesif will create a new one.

If a subscription exists, the new subscription properties will be merged with the existing properties recursively. This means you don't need to resend the entire subscription object if you are only updating a single field.

POST https://api.moesif.net/v1/subscriptions

Example Request
{
    "subscription_id": "12345", // Subscription Id
    "company_id": "67890", // Company Id
    "current_period_start": "2024-10-21T17:32:28.000Z",
    "current_period_end": "2024-11-21T17:32:28.000Z",
    "status": "active",
    "metadata": {
        "subscription_type": "PAYG",
        "subscription_tier": "Pro",
        "quota": {
            "quota_limit": 1000000,
            "quota_period": "Year"
        }
    }
}
# You can also use wget
curl --location 'https://api.moesif.net/v1/subscriptions' \
--header 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID' \
--header 'Content-Type: application/json' \
--data '{
    "subscription_id": "12345",
    "company_id": "67890",
    "current_period_start": "2024-10-21T17:32:28.000Z",
    "current_period_end": "2024-11-21T17:32:28.000Z",
    "status": "active",
    "metadata": {
        "subscription_type": "PAYG",
        "subscription_tier": "Pro",
        "quota": {
            "quota_limit": 1000000,
            "quota_period": "YEAR"
        }
    }
}'

Subscription ids

Subscriptions in Moesif are identified via a subscription_id and should be a permanent and robust identifier, like a database id. We recommend not using values that can change like website domain or subscription name.

Name Type Required Description
subscription_id string true The unique identifier for this subscription.
company_id string true The unique identifier for the company this subscription should be associated with.
current_period_start string(date-time) false The start time of the current billing term. This can be yearly, monthly, or other billing term. Required for quota and billing management.
current_period_end string(date-time) false The end time of the current billing term. This can be yearly, monthly, or other billing term. Required for quota and billing management.
status string true One of [active, cancelled, paused, trialing, pending, draft, future]. This can be used to drive governance rules that the subscription status in Moesif such as blocking access to cancelled subscriptions.
metadata object false An object containing subscription demographics or other properties you want to store with this profile.

Update Subscriptions in Batch

POST https://api.moesif.net/v1/subscriptions/batch

Updates a list of subscriptions profile in Moesif.

A custom JSON object can be placed in the metadata object of each subscription which will be stored as part of the subscription profile.

If subscription does not exist, a new one will be created. If a subscription exists, it will be merged on top of existing fields. Any new field set will override the existing fields. This is done via recursive merge which merges inner objects.

POST https://api.moesif.net/v1/subscriptions/batch

Example Request
[
  {
    "subscription_id": "12345", // Subscription Id
    "company_id": "67890", // Company Id
    "current_period_start": "2024-10-21T17:32:28.000Z",
    "current_period_end": "2024-11-21T17:32:28.000Z",
    "status": "active",
    "metadata": {
        "subscription_type": "PAYG",
        "subscription_tier": "Pro",
        "quota": {
            "quota_limit": 1000000,
            "quota_period": "Year"
        }
    }
},
{
    "subscription_id": "abcde", // Subscription Id
    "company_id": "xyz", // Company Id
    "current_period_start": "2024-10-21T17:32:28.000Z",
    "current_period_end": "2024-11-21T17:32:28.000Z",
    "status": "active",
    "metadata": {
        "subscription_type": "PAYG",
        "subscription_tier": "Enterprise",
        "quota": {
            "quota_limit": 1000000,
            "quota_period": "YEAR"
        }
    }
}
]
# You can also use wget
curl --location 'https://api.moesif.net/v1/subscriptions/batch' \
--header 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID' \
--header 'Content-Type: application/json' \
--data '[{
    "subscription_id": "12345",
    "company_id": "67890",
    "current_period_start": "2024-10-21T17:32:28.000Z",
    "current_period_end": "2024-11-21T17:32:28.000Z",
    "status": "active",
    "metadata": {
        "subscription_type": "PAYG",
        "subscription_tier": "Pro",
        "quota": {
            "quota_limit": 1000000,
            "quota_period": "YEAR"
        }
    }
}]'

Subscription ids

Subscriptions in Moesif are identified via a subscription_id and should be a permanent and robust identifier, like a database id. We recommend not using values that can change like website domain or subscription name.

Name Type Required Description
subscription_id string true The unique identifier for this subscription.
company_id string true The unique identifier for the company this subscription should be associated with.
current_period_start string(date-time) false The start time of the current billing term. This can be yearly, monthly, or other billing term. Required for quota and billing management.
current_period_end string(date-time) false The end time of the current billing term. This can be yearly, monthly, or other billing term. Required for quota and billing management.
status string false One of [active, cancelled, paused, trialing, pending, draft, future]. This can be used to drive governance rules that the subscription status in Moesif such as blocking access to cancelled subscriptions.
metadata object false An object containing subscription demographics or other properties you want to store with this profile.

Config

Get Config

GET https://api.moesif.net/v1/config

Retrieves the configuration for governance rules and dynamic sampling rules.

POST https://api.moesif.net/v1/config

Example Response
{
    "sample_rate": 100,
    "user_sample_rate": {},
    "company_sample_rate": { },
    "user_rules": { },
    "company_rules": {  },
    "regex_config": [
        {
            "conditions": [
                {
                    "path": "request.route",
                    "value": "/health/.*"
                }
            ],
            "sample_rate": 0
        }
    ]
}

Get Rules

GET https://api.moesif.net/v1/rules

Retrieves the set of rules for quotas and behavior rules to block users/companies.

POST https://api.moesif.net/v1/rules

Example Response
[
    {
        "_id": "64ca685a833073c6b41b15f3",
        "created_at": "2024-10-01T00:00:00.000",
        "name": "Block Free Users who Exceeded their Monthly Quota",
        "block": true,
        "type": "user",
        "variables": [
            {
                "name": "0",
                "path": "body.plan_name"
            },
            {
                "name": "1",
                "path": "body.quota_amount"
            }
        ],
        "regex_config": [],
        "response": {
            "status": 429,
            "headers": {
                "X-Rate-Limit-Month": "{{1}}"
            },
            "body": {
                "error_code": "too_many_requests",
                "message": "You exceeded your monthly quota of {{1}} for the {{0}} plan. Please upgrade your plan."
            }
        }
    }
]

Management API v1

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Management API to query data in Moesif. You can use the management API to export data for custom reports or to build custom dashboards.

Base URLs:

If you're using the Moesif secure proxy, the base URL is https://localhost:9500/api/v1 assuming it's running on port 9500.

Terms of service

Authentication

Authorization: Bearer YOUR_MANAGEMENT_API_KEY

- Flow: password

- Token URL = https://api.moesif.com/v1/:orgId/oauth/access_tokens

Scope Scope Description
create:encrypted_keys Create encrypted Keys for the Moesif secure proxy
delete:dashboards Delete existing dashboards
update:dashboards Update existing dashboards
create:dashboards Create a new team dashboard that can be shared
read:public_workspaces Read public workspaces/shared links
read:virtual_eventtypes Read existing virtual events/tags
update:companies Update existing companies and associated company metadata
create:companies Create new companies and associated company metadata
create:reports Create a new report such as SmartDiff
delete:workspaces Delete existing workspaces
create:workspaces Create a new workspace/chart that can be shared
read:workspaces Read existing workspaces
update:virtual_eventtypes Update existing virtual events/tags
create:cohorts Save new customer cohorts
delete:encrypted_keys Delete encrypted Keys for the Moesif secure proxy
read:dashboards Read existing dashboards
read:events Read/query events and associated event metadata
create:events Create new events and associated event metadata
read:cohorts Read previously saved customer cohorts
read:encrypted_keys Read encrypted Keys for the Moesif secure proxy
update:apps Update an existing application
update:encrypted_keys Update encrypted Keys for the Moesif secure proxy
update:organizations Update an existing application
create:access_tokens Create new tokens to access the Management API or Collector API
create:users Create new users and associated user metadata
create:apps Create a new application/project under the organization
update:workspaces Update existing workspaces
delete:cohorts Delete previously saved customer cohorts
read:users Read/query users and associated user metadata
delete:virtual_eventtypes Delete existing virtual events/tags
read:reports Read reports such as SmartDiff
delete:reports Delete existing reports such as SmartDiff
update:users Update existing users and associated user metadata
update:cohorts Update previously saved customer cohorts
read:companies Read/query companies and associated company metadata
create:virtual_eventtypes Create virtual events/tags
delete:apps Delete an existing application
delete:companies Delete existing companies and associated company metadata
read:apps Read the organization's applications
create:eth_abi Create/upload new Ethereum ABI Entries
delete:users Delete existing users and associated user metadata

Companies

updateCompanies

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/companies \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "company_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "session_token": "string",
  "company_domain": "string",
  "metadata": {}
}' 
const fetch = require('node-fetch');
const inputBody = {
  "company_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "session_token": "string",
  "company_domain": "string",
  "metadata": {}
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/companies',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "company_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "session_token": "string",
  "company_domain": "string",
  "metadata": {}
}

r = requests.post('https://api.moesif.com/v1/search/~/companies', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "company_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "session_token": "string",
  "company_domain": "string",
  "metadata": {}
}')

result = RestClient.post 'https://api.moesif.com/v1/search/~/companies',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "company_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "session_token": "string",
  "company_domain": "string",
  "metadata": {}
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/companies', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "company_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "session_token": "string",
  "company_domain": "string",
  "metadata": {}
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/companies", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/companies";

      string json = @"{
  ""company_id"": ""string"",
  ""modified_time"": ""2024-04-11T04:01:35.090Z"",
  ""session_token"": ""string"",
  ""company_domain"": ""string"",
  ""metadata"": {}
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(CompanyUpdate content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(CompanyUpdate content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/companies");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "company_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "session_token": "string",
  "company_domain": "string",
  "metadata": {}
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/companies

Update a Company

POST https://api.moesif.com/v1/search/~/companies

Example Request

{
  "company_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "session_token": "string",
  "company_domain": "string",
  "metadata": {}
}

Parameters

Name In Type Required Description
body body CompanyUpdate true none

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

batchUpdateCompanies

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/companies/batch \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '[
  {
    "company_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "session_token": "string",
    "company_domain": "string",
    "metadata": {}
  }
]' 
const fetch = require('node-fetch');
const inputBody = [
  {
    "company_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "session_token": "string",
    "company_domain": "string",
    "metadata": {}
  }
];
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/companies/batch',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = [
  {
    "company_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "session_token": "string",
    "company_domain": "string",
    "metadata": {}
  }
]

r = requests.post('https://api.moesif.com/v1/search/~/companies/batch', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('[
  {
    "company_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "session_token": "string",
    "company_domain": "string",
    "metadata": {}
  }
]')

result = RestClient.post 'https://api.moesif.com/v1/search/~/companies/batch',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('[
  {
    "company_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "session_token": "string",
    "company_domain": "string",
    "metadata": {}
  }
]')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/companies/batch', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `[
  {
    "company_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "session_token": "string",
    "company_domain": "string",
    "metadata": {}
  }
]`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/companies/batch", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/companies/batch";

      string json = @"[
  {
    ""company_id"": ""string"",
    ""modified_time"": ""2024-04-11T04:01:35.090Z"",
    ""session_token"": ""string"",
    ""company_domain"": ""string"",
    ""metadata"": {}
  }
]";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(CompanyUpdate content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(CompanyUpdate content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/companies/batch");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """[
  {
    "company_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "session_token": "string",
    "company_domain": "string",
    "metadata": {}
  }
]""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/companies/batch

Update Companies in Batch

POST https://api.moesif.com/v1/search/~/companies/batch

Example Request

[
  {
    "company_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "session_token": "string",
    "company_domain": "string",
    "metadata": {}
  }
]

Parameters

Name In Type Required Description
body body CompanyUpdate true none

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

getCompany

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/companies/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/companies/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/search/~/companies/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/search/~/companies/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/search/~/companies/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/companies/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/companies/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /search/~/companies/{id}

Get a Company

GET https://api.moesif.com/v1/search/~/companies/{id}

Parameters

Name In Type Required Description
id path string true none

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

deleteCompany

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/search/~/companies/{id} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/companies/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/search/~/companies/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/search/~/companies/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/search/~/companies/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/search/~/companies/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/search/~/companies/{id}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /search/~/companies/{id}

Delete a Company

DELETE https://api.moesif.com/v1/search/~/companies/{id}

Parameters

Name In Type Required Description
id path string true none
delete_events query boolean false Delete events associated with the company which can be set to true or false(default)

Responses

Status Meaning Description Schema
200 OK success None

countCompanies

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/count/companies?app_id=string \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'


const fetch = require('node-fetch');
const inputBody = false;
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/count/companies?app_id=string',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = false

r = requests.post('https://api.moesif.com/v1/search/~/count/companies', params={
  'app_id': 'string'

}, headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('false')

result = RestClient.post 'https://api.moesif.com/v1/search/~/count/companies',
  params: {
  'app_id' => 'string'
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('false')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/count/companies', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `false`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/companies", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/count/companies";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/count/companies?app_id=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """false""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/count/companies

Count Companies

POST https://api.moesif.com/v1/search/~/count/companies

Example Request

false

Parameters

Name In Type Required Description

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

searchCompanyMetrics

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/search/companymetrics/companies \
  -H 'Content-Type: application/json' \
  -H 'Accept: 0' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'


const fetch = require('node-fetch');
const inputBody = false;
const headers = {
  'Content-Type':'application/json',
  'Accept':'0',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/search/companymetrics/companies',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': '0',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = false

r = requests.post('https://api.moesif.com/v1/search/~/search/companymetrics/companies', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => '0',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('false')

result = RestClient.post 'https://api.moesif.com/v1/search/~/search/companymetrics/companies',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => '0',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('false')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/companymetrics/companies', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"0"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `false`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/companymetrics/companies", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/search/companymetrics/companies";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/search/companymetrics/companies");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'0');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """false""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/search/companymetrics/companies

Search CompanyMetrics/Companies

POST https://api.moesif.com/v1/search/~/search/companymetrics/companies

Example Request

false

Parameters

Name In Type Required Description
from query string(date-time) false The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h
to query string(date-time) false The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

Subscriptions

getCompanySubscriptions

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/companies/{id}/subscriptions \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/companies/{id}/subscriptions',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/search/~/companies/{id}/subscriptions',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/companies/{id}/subscriptions")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/companies/{id}/subscriptions";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}/subscriptions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /search/~/companies/{id}/subscriptions

Get the Subscriptions of a Company

GET https://api.moesif.com/v1/search/~/companies/{id}/subscriptions

Parameters

Name In Type Required Description
id path string true none

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

createSubscription

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/subscriptions \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/subscriptions',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}

r = requests.post('https://api.moesif.com/v1/search/~/subscriptions', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}')

result = RestClient.post 'https://api.moesif.com/v1/search/~/subscriptions',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/subscriptions', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/subscriptions", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/subscriptions";

      string json = @"{
  ""trial_start"": ""2024-04-11T04:01:35.090Z"",
  ""company_id"": ""string"",
  ""start_date"": ""2024-04-11T04:01:35.090Z"",
  ""collection_method"": ""string"",
  ""provider"": ""string"",
  ""items"": [
    {
      ""item_price_id"": ""string"",
      ""price_id"": ""string"",
      ""is_metered"": true,
      ""plan_id"": ""string"",
      ""unit_of_measure"": ""string"",
      ""status"": ""string"",
      ""subscription_item_id"": ""string""
    }
  ],
  ""current_period_start"": ""2024-04-11T04:01:35.090Z"",
  ""company_external_id"": ""string"",
  ""payment_status"": ""string"",
  ""cancel_time"": ""2024-04-11T04:01:35.090Z"",
  ""status"": ""string"",
  ""trial_end"": ""2024-04-11T04:01:35.090Z"",
  ""external_id"": ""string"",
  ""metadata"": {},
  ""subscription_id"": ""string"",
  ""version_id"": ""string"",
  ""current_period_end"": ""2024-04-11T04:01:35.090Z"",
  ""created"": ""2024-04-11T04:01:35.090Z""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(AddSubscription content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(AddSubscription content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/subscriptions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/subscriptions

Create or Update a Subscription

POST https://api.moesif.com/v1/search/~/subscriptions

Example Request

{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}

Parameters

Name In Type Required Description
body body AddSubscription true none

Example responses

200 Response

{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "app_id": "string",
  "subscription_id": "string",
  "version_id": "string",
  "type": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "org_id": "string",
  "created": "2024-04-11T04:01:35.090Z"
}

Responses

Status Meaning Description Schema
200 OK success Subscription

batchCreateSubscriptions

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/subscriptions/batch \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/subscriptions/batch',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}

r = requests.post('https://api.moesif.com/v1/search/~/subscriptions/batch', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}')

result = RestClient.post 'https://api.moesif.com/v1/search/~/subscriptions/batch',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/subscriptions/batch', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/subscriptions/batch", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/subscriptions/batch";

      string json = @"{
  ""trial_start"": ""2024-04-11T04:01:35.090Z"",
  ""company_id"": ""string"",
  ""start_date"": ""2024-04-11T04:01:35.090Z"",
  ""collection_method"": ""string"",
  ""provider"": ""string"",
  ""items"": [
    {
      ""item_price_id"": ""string"",
      ""price_id"": ""string"",
      ""is_metered"": true,
      ""plan_id"": ""string"",
      ""unit_of_measure"": ""string"",
      ""status"": ""string"",
      ""subscription_item_id"": ""string""
    }
  ],
  ""current_period_start"": ""2024-04-11T04:01:35.090Z"",
  ""company_external_id"": ""string"",
  ""payment_status"": ""string"",
  ""cancel_time"": ""2024-04-11T04:01:35.090Z"",
  ""status"": ""string"",
  ""trial_end"": ""2024-04-11T04:01:35.090Z"",
  ""external_id"": ""string"",
  ""metadata"": {},
  ""subscription_id"": ""string"",
  ""version_id"": ""string"",
  ""current_period_end"": ""2024-04-11T04:01:35.090Z"",
  ""created"": ""2024-04-11T04:01:35.090Z""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(AddSubscription content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(AddSubscription content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/subscriptions/batch");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/subscriptions/batch

Create or Update Subscriptions in Batch

POST https://api.moesif.com/v1/search/~/subscriptions/batch

Example Request

{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}

Parameters

Name In Type Required Description
body body AddSubscription true none

Example responses

200 Response

{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "app_id": "string",
  "subscription_id": "string",
  "version_id": "string",
  "type": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "org_id": "string",
  "created": "2024-04-11T04:01:35.090Z"
}

Responses

Status Meaning Description Schema
200 OK success Subscription

getSubscription

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/subscriptions/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/subscriptions/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/search/~/subscriptions/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/search/~/subscriptions/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/search/~/subscriptions/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/subscriptions/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/subscriptions/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/subscriptions/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /search/~/subscriptions/{id}

Get a Subscription

GET https://api.moesif.com/v1/search/~/subscriptions/{id}

Parameters

Name In Type Required Description
id path string true none

Example responses

200 Response

{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "app_id": "string",
  "subscription_id": "string",
  "version_id": "string",
  "type": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "org_id": "string",
  "created": "2024-04-11T04:01:35.090Z"
}

Responses

Status Meaning Description Schema
200 OK success Subscription

Metrics

countEvents

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'


const fetch = require('node-fetch');
const inputBody = false;
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = false

r = requests.post('https://api.moesif.com/v1/search/~/count/events', params={
  'from': '2024-04-11T04:01:35.090Z',  'to': '2024-04-11T04:01:35.090Z'

}, headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('false')

result = RestClient.post 'https://api.moesif.com/v1/search/~/count/events',
  params: {
  'from' => 'string(date-time)',
  'to' => 'string(date-time)'
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('false')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/count/events', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `false`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/events", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/count/events";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """false""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/count/events

Count Events

POST https://api.moesif.com/v1/search/~/count/events

Example Request

false

Parameters

Name In Type Required Description
from query string(date-time) true The start date, which can be absolute such as 2019-07-01T00:00:00Z or relative such as -24h
to query string(date-time) true The end date, which can be absolute such as 2019-07-02T00:00:00Z or relative such as now
track_total_hits query boolean false none

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

getEvent

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3A15%3A22Z \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3A15%3A22Z',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/search/~/events/{id}', params={
  'event_time': '2024-04-11T04:01:35.090Z'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/search/~/events/{id}',
  params: {
  'event_time' => 'string(date-time)'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/search/~/events/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/events/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/events/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3A15%3A22Z");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /search/~/events/{id}

Get an Event

GET https://api.moesif.com/v1/search/~/events/{id}

Parameters

Name In Type Required Description
id path string true none
event_time query string(date-time) true none

Example responses

200 Response

{
  "_id": "AWF5M-FDTqLFD8l5y2f4",
  "_source": {
    "company_id": "67890",
    "duration_ms": 76,
    "request": {
      "body": "json",
      "uri": "https://api.github.com",
      "user_agent": {
        "patch": "1",
        "major": "7",
        "minor": "1",
        "name": "PostmanRuntime"
      },
      "geo_ip": {
        "ip": "73.189.235.253",
        "region_name": "CA",
        "continent_code": "NA",
        "location": [
          "["
        ],
        "latitude": 37.769,
        "timezone": "America/Los_Angeles",
        "area_code": 415,
        "longitude": -122.393,
        "real_region_name": "California",
        "dma_code": 807,
        "postal_code": "94107",
        "city_name": "San Francisco",
        "country_code2": "US",
        "country_code3": "USA",
        "country_name": "United States"
      },
      "ip_address": "73.189.235.253",
      "verb": "GET",
      "route": "/",
      "time": "2023-07-09T06:14:58.550",
      "headers": {}
    },
    "user_id": "123454",
    "company": {},
    "response": {
      "body": {},
      "transfer_encoding": "json",
      "status": 200,
      "time": "2023-07-09T06:14:58.626",
      "headers": {}
    },
    "id": "AWF5M-FDTqLFD8l5y2f4",
    "event_type": "api_call",
    "session_token": "rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME",
    "metadata": {},
    "app_id": "198:3",
    "org_id": "177:3",
    "user": {}
  },
  "sort": [
    0
  ]
}

Responses

Status Meaning Description Schema
200 OK success eventResponse

searchEvents

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'


const fetch = require('node-fetch');
const inputBody = false;
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = false

r = requests.post('https://api.moesif.com/v1/search/~/search/events', params={
  'from': '2024-04-11T04:01:35.090Z',  'to': '2024-04-11T04:01:35.090Z'

}, headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('false')

result = RestClient.post 'https://api.moesif.com/v1/search/~/search/events',
  params: {
  'from' => 'string(date-time)',
  'to' => 'string(date-time)'
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('false')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/events', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `false`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/events", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/search/events";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """false""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/search/events

Search Events

POST https://api.moesif.com/v1/search/~/search/events

Example Request

false

Parameters

Name In Type Required Description
from query string(date-time) true The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h
to query string(date-time) true The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now

Example responses

201 Response

{
  "took": 358,
  "timed_out": false,
  "hits": {
    "total": 947,
    "hits": [
      {
        "_id": "AWF5M-FDTqLFD8l5y2f4",
        "_source": {
          "company_id": "[",
          "duration_ms": "[",
          "request": {},
          "user_id": "[",
          "company": {},
          "response": {},
          "id": "[",
          "event_type": "[",
          "session_token": "[",
          "metadata": {},
          "app_id": "[",
          "org_id": "[",
          "user": {}
        },
        "sort": [
          0
        ]
      }
    ]
  }
}

Responses

Status Meaning Description Schema
201 Created success searchEventsResponse

searchPublicWorkspaces

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'


const fetch = require('node-fetch');
const inputBody = false;
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = false

r = requests.post('https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search', params={
  'from': '2024-04-11T04:01:35.090Z',  'to': '2024-04-11T04:01:35.090Z'

}, headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('false')

result = RestClient.post 'https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search',
  params: {
  'from' => 'string(date-time)',
  'to' => 'string(date-time)'
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('false')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `false`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """false""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/workspaces/{workspaceId}/search

Search Events in saved public Workspace

POST https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search

Example Request

false

Parameters

Name In Type Required Description
from query string(date-time) true The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h
to query string(date-time) true The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now
workspaceId path string true none
include_details query boolean false none
take query integer(int32) false none

Example responses

201 Response

{
  "took": 358,
  "timed_out": false,
  "hits": {
    "total": 947,
    "hits": [
      {
        "_id": "AWF5M-FDTqLFD8l5y2f4",
        "_source": {
          "company_id": "[",
          "duration_ms": "[",
          "request": {},
          "user_id": "[",
          "company": {},
          "response": {},
          "id": "[",
          "event_type": "[",
          "session_token": "[",
          "metadata": {},
          "app_id": "[",
          "org_id": "[",
          "user": {}
        },
        "sort": [
          0
        ]
      }
    ]
  }
}

Responses

Status Meaning Description Schema
201 Created success searchEventsResponse

Users

countUsers

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/count/users?app_id=string \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'


const fetch = require('node-fetch');
const inputBody = false;
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/count/users?app_id=string',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = false

r = requests.post('https://api.moesif.com/v1/search/~/count/users', params={
  'app_id': 'string'

}, headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('false')

result = RestClient.post 'https://api.moesif.com/v1/search/~/count/users',
  params: {
  'app_id' => 'string'
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('false')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/count/users', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `false`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/users", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/count/users";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/count/users?app_id=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """false""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/count/users

Count Users

POST https://api.moesif.com/v1/search/~/count/users

Example Request

false

Parameters

Name In Type Required Description

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

searchUserMetrics

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/search/usermetrics/users \
  -H 'Content-Type: application/json' \
  -H 'Accept: 0' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'


const fetch = require('node-fetch');
const inputBody = false;
const headers = {
  'Content-Type':'application/json',
  'Accept':'0',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/search/usermetrics/users',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': '0',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = false

r = requests.post('https://api.moesif.com/v1/search/~/search/usermetrics/users', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => '0',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('false')

result = RestClient.post 'https://api.moesif.com/v1/search/~/search/usermetrics/users',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => '0',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('false')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/usermetrics/users', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"0"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `false`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/usermetrics/users", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/search/usermetrics/users";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/search/usermetrics/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'0');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """false""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/search/usermetrics/users

Search UserMetrics/Users

POST https://api.moesif.com/v1/search/~/search/usermetrics/users

Example Request

false

Parameters

Name In Type Required Description
from query string(date-time) false The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h
to query string(date-time) false The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

updateUsers

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/users \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "company_id": "string",
  "first_name": "string",
  "name": "string",
  "email": "string",
  "photo_url": "string",
  "user_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "last_name": "string",
  "metadata": {},
  "user_name": "string",
  "phone": "string"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "company_id": "string",
  "first_name": "string",
  "name": "string",
  "email": "string",
  "photo_url": "string",
  "user_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "last_name": "string",
  "metadata": {},
  "user_name": "string",
  "phone": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/users',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "company_id": "string",
  "first_name": "string",
  "name": "string",
  "email": "string",
  "photo_url": "string",
  "user_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "last_name": "string",
  "metadata": {},
  "user_name": "string",
  "phone": "string"
}

r = requests.post('https://api.moesif.com/v1/search/~/users', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "company_id": "string",
  "first_name": "string",
  "name": "string",
  "email": "string",
  "photo_url": "string",
  "user_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "last_name": "string",
  "metadata": {},
  "user_name": "string",
  "phone": "string"
}')

result = RestClient.post 'https://api.moesif.com/v1/search/~/users',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "company_id": "string",
  "first_name": "string",
  "name": "string",
  "email": "string",
  "photo_url": "string",
  "user_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "last_name": "string",
  "metadata": {},
  "user_name": "string",
  "phone": "string"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/users', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "company_id": "string",
  "first_name": "string",
  "name": "string",
  "email": "string",
  "photo_url": "string",
  "user_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "last_name": "string",
  "metadata": {},
  "user_name": "string",
  "phone": "string"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/users", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/users";

      string json = @"{
  ""company_id"": ""string"",
  ""first_name"": ""string"",
  ""name"": ""string"",
  ""email"": ""string"",
  ""photo_url"": ""string"",
  ""user_id"": ""string"",
  ""modified_time"": ""2024-04-11T04:01:35.090Z"",
  ""last_name"": ""string"",
  ""metadata"": {},
  ""user_name"": ""string"",
  ""phone"": ""string""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(UserUpdate content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(UserUpdate content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "company_id": "string",
  "first_name": "string",
  "name": "string",
  "email": "string",
  "photo_url": "string",
  "user_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "last_name": "string",
  "metadata": {},
  "user_name": "string",
  "phone": "string"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/users

Update a User

POST https://api.moesif.com/v1/search/~/users

Example Request

{
  "company_id": "string",
  "first_name": "string",
  "name": "string",
  "email": "string",
  "photo_url": "string",
  "user_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "last_name": "string",
  "metadata": {},
  "user_name": "string",
  "phone": "string"
}

Parameters

Name In Type Required Description
body body UserUpdate true none

Example responses

200 Response

{
  "_id": "123456",
  "_source": {
    "first_name": "John",
    "body": {},
    "name": "John Doe",
    "email": "[email protected]",
    "first_seen_time": "2023-07-27T21:52:58.0990000Z",
    "user_agent": {
      "name": "Android",
      "os_major": "7",
      "os": "Android 7.0",
      "os_name": "Android",
      "os_minor": "0",
      "major": "7",
      "device": "Samsung SM-G955U",
      "minor": "0"
    },
    "geo_ip": {
      "ip": "107.200.85.196",
      "region_name": "South Carolina",
      "continent_code": "NA",
      "location": {
        "lon": -79.85489654541016,
        "lat": 32.822898864746094
      },
      "latitude": 32.822898864746094,
      "timezone": "America/New_York",
      "longitude": -79.85489654541016,
      "dma_code": 519,
      "postal_code": "29464",
      "region_code": "SC",
      "city_name": "Mt. Pleasant",
      "country_code2": "US",
      "country_code3": "US",
      "country_name": "United States"
    },
    "modified_time": "2023-07-27T21:55:19.464",
    "last_name": "Doe",
    "ip_address": "107.200.85.196",
    "session_token": [
      "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF"
    ],
    "last_seen_time": "2023-07-27T21:52:58.0990000Z",
    "app_id": "198:3",
    "org_id": "177:3"
  },
  "sort": [
    1519768519464
  ]
}

Responses

Status Meaning Description Schema
200 OK success userResponse

batchUpdateUsers

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/users/batch \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '[
  {
    "company_id": "string",
    "first_name": "string",
    "name": "string",
    "email": "string",
    "photo_url": "string",
    "user_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "last_name": "string",
    "metadata": {},
    "user_name": "string",
    "phone": "string"
  }
]' 
const fetch = require('node-fetch');
const inputBody = [
  {
    "company_id": "string",
    "first_name": "string",
    "name": "string",
    "email": "string",
    "photo_url": "string",
    "user_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "last_name": "string",
    "metadata": {},
    "user_name": "string",
    "phone": "string"
  }
];
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/users/batch',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = [
  {
    "company_id": "string",
    "first_name": "string",
    "name": "string",
    "email": "string",
    "photo_url": "string",
    "user_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "last_name": "string",
    "metadata": {},
    "user_name": "string",
    "phone": "string"
  }
]

r = requests.post('https://api.moesif.com/v1/search/~/users/batch', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('[
  {
    "company_id": "string",
    "first_name": "string",
    "name": "string",
    "email": "string",
    "photo_url": "string",
    "user_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "last_name": "string",
    "metadata": {},
    "user_name": "string",
    "phone": "string"
  }
]')

result = RestClient.post 'https://api.moesif.com/v1/search/~/users/batch',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('[
  {
    "company_id": "string",
    "first_name": "string",
    "name": "string",
    "email": "string",
    "photo_url": "string",
    "user_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "last_name": "string",
    "metadata": {},
    "user_name": "string",
    "phone": "string"
  }
]')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/search/~/users/batch', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `[
  {
    "company_id": "string",
    "first_name": "string",
    "name": "string",
    "email": "string",
    "photo_url": "string",
    "user_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "last_name": "string",
    "metadata": {},
    "user_name": "string",
    "phone": "string"
  }
]`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/users/batch", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/users/batch";

      string json = @"[
  {
    ""company_id"": ""string"",
    ""first_name"": ""string"",
    ""name"": ""string"",
    ""email"": ""string"",
    ""photo_url"": ""string"",
    ""user_id"": ""string"",
    ""modified_time"": ""2024-04-11T04:01:35.090Z"",
    ""last_name"": ""string"",
    ""metadata"": {},
    ""user_name"": ""string"",
    ""phone"": ""string""
  }
]";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(UserUpdate content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(UserUpdate content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/users/batch");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """[
  {
    "company_id": "string",
    "first_name": "string",
    "name": "string",
    "email": "string",
    "photo_url": "string",
    "user_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "last_name": "string",
    "metadata": {},
    "user_name": "string",
    "phone": "string"
  }
]""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /search/~/users/batch

Update Users in Batch

POST https://api.moesif.com/v1/search/~/users/batch

Example Request

[
  {
    "company_id": "string",
    "first_name": "string",
    "name": "string",
    "email": "string",
    "photo_url": "string",
    "user_id": "string",
    "modified_time": "2024-04-11T04:01:35.090Z",
    "last_name": "string",
    "metadata": {},
    "user_name": "string",
    "phone": "string"
  }
]

Parameters

Name In Type Required Description
body body UserUpdate true none

Example responses

200 Response

{
  "_id": "123456",
  "_source": {
    "first_name": "John",
    "body": {},
    "name": "John Doe",
    "email": "[email protected]",
    "first_seen_time": "2023-07-27T21:52:58.0990000Z",
    "user_agent": {
      "name": "Android",
      "os_major": "7",
      "os": "Android 7.0",
      "os_name": "Android",
      "os_minor": "0",
      "major": "7",
      "device": "Samsung SM-G955U",
      "minor": "0"
    },
    "geo_ip": {
      "ip": "107.200.85.196",
      "region_name": "South Carolina",
      "continent_code": "NA",
      "location": {
        "lon": -79.85489654541016,
        "lat": 32.822898864746094
      },
      "latitude": 32.822898864746094,
      "timezone": "America/New_York",
      "longitude": -79.85489654541016,
      "dma_code": 519,
      "postal_code": "29464",
      "region_code": "SC",
      "city_name": "Mt. Pleasant",
      "country_code2": "US",
      "country_code3": "US",
      "country_name": "United States"
    },
    "modified_time": "2023-07-27T21:55:19.464",
    "last_name": "Doe",
    "ip_address": "107.200.85.196",
    "session_token": [
      "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF"
    ],
    "last_seen_time": "2023-07-27T21:52:58.0990000Z",
    "app_id": "198:3",
    "org_id": "177:3"
  },
  "sort": [
    1519768519464
  ]
}

Responses

Status Meaning Description Schema
200 OK success userResponse

getUser

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/users/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/users/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/search/~/users/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/search/~/users/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/search/~/users/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/users/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/users/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/users/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /search/~/users/{id}

Get a User

GET https://api.moesif.com/v1/search/~/users/{id}

Parameters

Name In Type Required Description
id path string true none

Example responses

200 Response

{
  "_id": "123456",
  "_source": {
    "first_name": "John",
    "body": {},
    "name": "John Doe",
    "email": "[email protected]",
    "first_seen_time": "2023-07-27T21:52:58.0990000Z",
    "user_agent": {
      "name": "Android",
      "os_major": "7",
      "os": "Android 7.0",
      "os_name": "Android",
      "os_minor": "0",
      "major": "7",
      "device": "Samsung SM-G955U",
      "minor": "0"
    },
    "geo_ip": {
      "ip": "107.200.85.196",
      "region_name": "South Carolina",
      "continent_code": "NA",
      "location": {
        "lon": -79.85489654541016,
        "lat": 32.822898864746094
      },
      "latitude": 32.822898864746094,
      "timezone": "America/New_York",
      "longitude": -79.85489654541016,
      "dma_code": 519,
      "postal_code": "29464",
      "region_code": "SC",
      "city_name": "Mt. Pleasant",
      "country_code2": "US",
      "country_code3": "US",
      "country_name": "United States"
    },
    "modified_time": "2023-07-27T21:55:19.464",
    "last_name": "Doe",
    "ip_address": "107.200.85.196",
    "session_token": [
      "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF"
    ],
    "last_seen_time": "2023-07-27T21:52:58.0990000Z",
    "app_id": "198:3",
    "org_id": "177:3"
  },
  "sort": [
    1519768519464
  ]
}

Responses

Status Meaning Description Schema
200 OK success userResponse

deleteUser

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/search/~/users/{id} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/users/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/search/~/users/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/search/~/users/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/search/~/users/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/search/~/users/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/search/~/users/{id}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/users/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /search/~/users/{id}

Delete a User

DELETE https://api.moesif.com/v1/search/~/users/{id}

Parameters

Name In Type Required Description
id path string true none
delete_events query boolean false Delete events associated with the user which can be set to true or false(default)

Responses

Status Meaning Description Schema
200 OK success None

Properties

getProperties

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/mappings/users/properties?app_id=string \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/mappings/users/properties?app_id=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/search/~/mappings/users/properties', params={
  'app_id': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/users/properties',
  params: {
  'app_id' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/search/~/mappings/users/properties', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/users/properties")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/mappings/users/properties";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/users/properties?app_id=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /search/~/mappings/users/properties

Get Property Mapping for Users

GET https://api.moesif.com/v1/search/~/mappings/users/properties

Parameters

Name In Type Required Description

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

getRequestBodyProperties

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/mappings/events/request/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/mappings/events/request/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/search/~/mappings/events/request/body/properties', params={
  'app_id': 'string',  'from': '2024-04-11T04:01:35.090Z',  'to': '2024-04-11T04:01:35.090Z'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/events/request/body/properties',
  params: {
  'app_id' => 'string',
  'from' => 'string(date-time)',
  'to' => 'string(date-time)'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/search/~/mappings/events/request/body/properties', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/events/request/body/properties")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/mappings/events/request/body/properties";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/events/request/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /search/~/mappings/events/request/body/properties

Get Property Mapping for Events Request Body

GET https://api.moesif.com/v1/search/~/mappings/events/request/body/properties

Parameters

Name In Type Required Description
from query string(date-time) true none
to query string(date-time) true none
include_values query boolean false none
key_path query string false none

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

getResponseBodyProperties

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/mappings/events/response/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/search/~/mappings/events/response/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/search/~/mappings/events/response/body/properties', params={
  'app_id': 'string',  'from': '2024-04-11T04:01:35.090Z',  'to': '2024-04-11T04:01:35.090Z'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/events/response/body/properties',
  params: {
  'app_id' => 'string',
  'from' => 'string(date-time)',
  'to' => 'string(date-time)'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/search/~/mappings/events/response/body/properties', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/events/response/body/properties")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/search/~/mappings/events/response/body/properties";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/events/response/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /search/~/mappings/events/response/body/properties

Get Property Mapping for Events Response Body

GET https://api.moesif.com/v1/search/~/mappings/events/response/body/properties

Parameters

Name In Type Required Description
from query string(date-time) true none
to query string(date-time) true none
include_values query boolean false none
key_path query string false none

Example responses

Responses

Status Meaning Description Schema
200 OK success None

Response Schema

Workspaces

getWorkspaceToken

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/workspaces/access_token \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/workspaces/access_token',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/workspaces/access_token', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/workspaces/access_token',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/workspaces/access_token', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/workspaces/access_token")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/workspaces/access_token";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/workspaces/access_token");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /workspaces/access_token

Get new Workspace Token

Get a new Workspace Access Token

GET https://api.moesif.com/v1/workspaces/access_token

Example responses

200 Response

{
  "_id": "string",
  "token": "string",
  "url": "string"
}

Responses

Status Meaning Description Schema
200 OK success SignedToken

getPublicWorkspace

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/workspaces/public/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/workspaces/public/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/workspaces/public/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/workspaces/public/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/workspaces/public/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/workspaces/public/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/workspaces/public/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/workspaces/public/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /workspaces/public/{id}

Get a Public Workspace

GET https://api.moesif.com/v1/workspaces/public/{id}

Parameters

Name In Type Required Description
id path string true none

Example responses

200 Response

{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "_id": "string",
  "is_template": true,
  "dashboard": {},
  "auth_user_id": "string",
  "colors": {},
  "sequence": [
    {
      "delay": 0,
      "submit_data": {
        "body": {},
        "url": "string",
        "params": [
          {
            "key": null,
            "val": null
          }
        ],
        "verb": "string",
        "headers": [
          {
            "key": null,
            "val": null
          }
        ]
      }
    }
  ],
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "app_id": "string",
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  },
  "org_id": "string",
  "migration": {},
  "created": "2024-04-11T04:01:35.090Z",
  "comments": {
    "summary": {
      "count": 0,
      "latest_comment": {
        "auth_user_id": "string",
        "comment_id": "string",
        "mentions": [
          "string"
        ],
        "partner_user_id": "string",
        "message": "string",
        "created_at": "2024-04-11T04:01:35.090Z",
        "updated_at": "2024-04-11T04:01:35.090Z"
      }
    }
  }
}

Responses

Status Meaning Description Schema
200 OK success WorkspaceDocument

createWorkspace

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "dashboard": {},
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "dashboard": {},
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "dashboard": {},
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}

r = requests.post('https://api.moesif.com/v1/~/workspaces', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "dashboard": {},
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}')

result = RestClient.post 'https://api.moesif.com/v1/~/workspaces',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "dashboard": {},
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "dashboard": {},
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/workspaces";

      string json = @"{
  ""name"": ""string"",
  ""is_default"": true,
  ""view_count"": 0,
  ""dashboard"": {},
  ""colors"": {},
  ""drawings"": [
    {
      ""name"": ""string"",
      ""direction"": ""string"",
      ""id"": ""string"",
      ""type"": ""string"",
      ""value"": 0.1
    }
  ],
  ""chart"": {
    ""original_encoded_view_elements"": ""string"",
    ""funnel_query"": {},
    ""url_query"": ""string"",
    ""to"": ""string"",
    ""view_elements"": {},
    ""from"": ""string"",
    ""original_encoded_funnel_query"": ""string"",
    ""es_query"": {},
    ""args"": ""string"",
    ""original_encoded_query"": ""string"",
    ""time_zone"": ""string"",
    ""view"": ""string""
  },
  ""template"": {
    ""dynamic_fields"": [
      ""string""
    ],
    ""dynamic_time"": true
  },
  ""type"": ""string"",
  ""width"": 0.1,
  ""sort_order"": 0.1,
  ""policy"": {
    ""acl"": [
      {
        ""grantee"": ""string"",
        ""permission"": ""string""
      }
    ],
    ""resource"": {},
    ""api_scopes"": [
      ""string""
    ],
    ""original_encoded_resource"": ""string""
  }
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(WorkspaceCreateItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(WorkspaceCreateItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "dashboard": {},
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/workspaces

Create New Workspace

POST https://api.moesif.com/v1/~/workspaces

Example Request

{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "dashboard": {},
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}

Parameters

Name In Type Required Description
expiration query string(date-time) false none
body body WorkspaceCreateItem true none

Example responses

201 Response

{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "_id": "string",
  "is_template": true,
  "dashboard": {},
  "auth_user_id": "string",
  "colors": {},
  "sequence": [
    {
      "delay": 0,
      "submit_data": {
        "body": {},
        "url": "string",
        "params": [
          {
            "key": null,
            "val": null
          }
        ],
        "verb": "string",
        "headers": [
          {
            "key": null,
            "val": null
          }
        ]
      }
    }
  ],
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "app_id": "string",
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  },
  "org_id": "string",
  "migration": {},
  "created": "2024-04-11T04:01:35.090Z",
  "comments": {
    "summary": {
      "count": 0,
      "latest_comment": {
        "auth_user_id": "string",
        "comment_id": "string",
        "mentions": [
          "string"
        ],
        "partner_user_id": "string",
        "message": "string",
        "created_at": "2024-04-11T04:01:35.090Z",
        "updated_at": "2024-04-11T04:01:35.090Z"
      }
    }
  }
}

Responses

Status Meaning Description Schema
201 Created success WorkspaceDocument

getWorkspaces

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/workspaces?take=0&access=string \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces?take=0&access=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/workspaces', params={
  'take': '0',  'access': [
  "string"
]

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/workspaces',
  params: {
  'take' => 'integer(int32)',
  'access' => 'array[string]'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/workspaces";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces?take=0&access=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/workspaces

Get Workspaces

GET https://api.moesif.com/v1/~/workspaces

Parameters

Name In Type Required Description
take query integer(int32) true none
before_id query string false none
type query string false none
access query array[string] true none

Example responses

200 Response

[
  {
    "name": "string",
    "is_default": true,
    "view_count": 0,
    "_id": "string",
    "is_template": true,
    "dashboard": {},
    "auth_user_id": "string",
    "colors": {},
    "sequence": [
      {
        "delay": 0,
        "submit_data": {
          "body": {},
          "url": "string",
          "params": [
            {}
          ],
          "verb": "string",
          "headers": [
            {}
          ]
        }
      }
    ],
    "drawings": [
      {
        "name": "string",
        "direction": "string",
        "id": "string",
        "type": "string",
        "value": 0.1
      }
    ],
    "chart": {
      "original_encoded_view_elements": "string",
      "funnel_query": {},
      "url_query": "string",
      "to": "string",
      "view_elements": {},
      "from": "string",
      "original_encoded_funnel_query": "string",
      "es_query": {},
      "args": "string",
      "original_encoded_query": "string",
      "time_zone": "string",
      "view": "string"
    },
    "template": {
      "dynamic_fields": [
        "string"
      ],
      "dynamic_time": true
    },
    "app_id": "string",
    "type": "string",
    "width": 0.1,
    "sort_order": 0.1,
    "policy": {
      "acl": [
        {
          "grantee": "string",
          "permission": "string"
        }
      ],
      "resource": {},
      "api_scopes": [
        "string"
      ],
      "original_encoded_resource": "string"
    },
    "org_id": "string",
    "migration": {},
    "created": "2024-04-11T04:01:35.090Z",
    "comments": {
      "summary": {
        "count": 0,
        "latest_comment": {
          "auth_user_id": "string",
          "comment_id": "string",
          "mentions": [
            null
          ],
          "partner_user_id": "string",
          "message": "string",
          "created_at": "2024-04-11T04:01:35.090Z",
          "updated_at": "2024-04-11T04:01:35.090Z"
        }
      }
    }
  }
]

Responses

Status Meaning Description Schema
200 OK success Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [WorkspaceDocument] false none none
» name string false none none
» is_default boolean false none none
» view_count integer(int32) true none none
» _id string false none none
» is_template boolean false none none
» dashboard object false none none
» auth_user_id string true none none
» colors object false none none
» sequence [SequenceItem] false none none
»» delay integer(int32) true none none
»» submit_data object true none none
»»» body object false none none
»»» url string true none none
»»» params [KeyValuePair] false none none
»»»» key string true none none
»»»» val string true none none
»»» verb string true none none
»»» headers [KeyValuePair] false none none
» drawings [DrawingItem] false none none
»» name string true none none
»» direction string true none none
»» id string true none none
»» type string true none none
»» value number(double) true none none
» chart object false none none
»» original_encoded_view_elements string false none none
»» funnel_query object false none none
»» url_query string true none none
»» to string false none none
»» view_elements object false none none
»» from string false none none
»» original_encoded_funnel_query string false none none
»» es_query object false none none
»» args string false none none
»» original_encoded_query string false none none
»» time_zone string false none none
»» view string true none none
» template object false none none
»» dynamic_fields [string] true none none
»» dynamic_time boolean false none none
» app_id string true none none
» type string false none none
» width number(double) false none none
» sort_order number(double) false none none
» policy object false none none
»» acl [ACLItem] true none none
»»» grantee string true none none
»»» permission string true none none
»» resource object true none none
»» api_scopes [string] false none none
»» original_encoded_resource string false none none
» org_id string true none none
» migration object false none none
» created string(date-time) true none none
» comments object false none none
»» summary object true none none
»»» count integer(int32) true none none
»»» latest_comment object false none none
»»»» auth_user_id string false none none
»»»» comment_id string false none none
»»»» mentions [string] false none none
»»»» partner_user_id string false none none
»»»» message string false none none
»»»» created_at string(date-time) false none none
»»»» updated_at string(date-time) false none none

getWorkspaceTemplates

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/workspaces/templates \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/templates',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/workspaces/templates', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/templates',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces/templates', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/templates")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/workspaces/templates";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/templates");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/workspaces/templates

Get Workspace Templates

GET https://api.moesif.com/v1/~/workspaces/templates

Parameters

Name In Type Required Description

Example responses

200 Response

[
  {
    "name": "string",
    "is_default": true,
    "view_count": 0,
    "_id": "string",
    "is_template": true,
    "dashboard": {},
    "auth_user_id": "string",
    "colors": {},
    "sequence": [
      {
        "delay": 0,
        "submit_data": {
          "body": {},
          "url": "string",
          "params": [
            {}
          ],
          "verb": "string",
          "headers": [
            {}
          ]
        }
      }
    ],
    "drawings": [
      {
        "name": "string",
        "direction": "string",
        "id": "string",
        "type": "string",
        "value": 0.1
      }
    ],
    "chart": {
      "original_encoded_view_elements": "string",
      "funnel_query": {},
      "url_query": "string",
      "to": "string",
      "view_elements": {},
      "from": "string",
      "original_encoded_funnel_query": "string",
      "es_query": {},
      "args": "string",
      "original_encoded_query": "string",
      "time_zone": "string",
      "view": "string"
    },
    "template": {
      "dynamic_fields": [
        "string"
      ],
      "dynamic_time": true
    },
    "app_id": "string",
    "type": "string",
    "width": 0.1,
    "sort_order": 0.1,
    "policy": {
      "acl": [
        {
          "grantee": "string",
          "permission": "string"
        }
      ],
      "resource": {},
      "api_scopes": [
        "string"
      ],
      "original_encoded_resource": "string"
    },
    "org_id": "string",
    "migration": {},
    "created": "2024-04-11T04:01:35.090Z",
    "comments": {
      "summary": {
        "count": 0,
        "latest_comment": {
          "auth_user_id": "string",
          "comment_id": "string",
          "mentions": [
            null
          ],
          "partner_user_id": "string",
          "message": "string",
          "created_at": "2024-04-11T04:01:35.090Z",
          "updated_at": "2024-04-11T04:01:35.090Z"
        }
      }
    }
  }
]

Responses

Status Meaning Description Schema
200 OK success Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [WorkspaceDocument] false none none
» name string false none none
» is_default boolean false none none
» view_count integer(int32) true none none
» _id string false none none
» is_template boolean false none none
» dashboard object false none none
» auth_user_id string true none none
» colors object false none none
» sequence [SequenceItem] false none none
»» delay integer(int32) true none none
»» submit_data object true none none
»»» body object false none none
»»» url string true none none
»»» params [KeyValuePair] false none none
»»»» key string true none none
»»»» val string true none none
»»» verb string true none none
»»» headers [KeyValuePair] false none none
» drawings [DrawingItem] false none none
»» name string true none none
»» direction string true none none
»» id string true none none
»» type string true none none
»» value number(double) true none none
» chart object false none none
»» original_encoded_view_elements string false none none
»» funnel_query object false none none
»» url_query string true none none
»» to string false none none
»» view_elements object false none none
»» from string false none none
»» original_encoded_funnel_query string false none none
»» es_query object false none none
»» args string false none none
»» original_encoded_query string false none none
»» time_zone string false none none
»» view string true none none
» template object false none none
»» dynamic_fields [string] true none none
»» dynamic_time boolean false none none
» app_id string true none none
» type string false none none
» width number(double) false none none
» sort_order number(double) false none none
» policy object false none none
»» acl [ACLItem] true none none
»»» grantee string true none none
»»» permission string true none none
»» resource object true none none
»» api_scopes [string] false none none
»» original_encoded_resource string false none none
» org_id string true none none
» migration object false none none
» created string(date-time) true none none
» comments object false none none
»» summary object true none none
»»» count integer(int32) true none none
»»» latest_comment object false none none
»»»» auth_user_id string false none none
»»»» comment_id string false none none
»»»» mentions [string] false none none
»»»» partner_user_id string false none none
»»»» message string false none none
»»»» created_at string(date-time) false none none
»»»» updated_at string(date-time) false none none

updateWorkspace

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces/{id} \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
};
const headers = {
  'Content-Type':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/{id}',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}

r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}')

result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/workspaces/{id}";

      string json = @"{
  ""name"": ""string"",
  ""colors"": {},
  ""drawings"": [
    {
      ""name"": ""string"",
      ""direction"": ""string"",
      ""id"": ""string"",
      ""type"": ""string"",
      ""value"": 0.1
    }
  ],
  ""chart"": {
    ""original_encoded_view_elements"": ""string"",
    ""funnel_query"": {},
    ""url_query"": ""string"",
    ""to"": ""string"",
    ""view_elements"": {},
    ""from"": ""string"",
    ""original_encoded_funnel_query"": ""string"",
    ""es_query"": {},
    ""args"": ""string"",
    ""original_encoded_query"": ""string"",
    ""time_zone"": ""string"",
    ""view"": ""string""
  },
  ""template"": {
    ""dynamic_fields"": [
      ""string""
    ],
    ""dynamic_time"": true
  },
  ""width"": 0.1,
  ""sort_order"": 0.1,
  ""policy"": {
    ""acl"": [
      {
        ""grantee"": ""string"",
        ""permission"": ""string""
      }
    ],
    ""resource"": {},
    ""api_scopes"": [
      ""string""
    ],
    ""original_encoded_resource"": ""string""
  }
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(WorkspaceUpdateItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(WorkspaceUpdateItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/workspaces/{id}

Update a Workspace

POST https://api.moesif.com/v1/~/workspaces/{id}

Example Request

{
  "name": "string",
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}

Parameters

Name In Type Required Description
id path string true none
body body WorkspaceUpdateItem true none

Responses

Status Meaning Description Schema
200 OK success None

getWorkspace

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/workspaces/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/workspaces/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/workspaces/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/workspaces/{id}

Get a Workspace

GET https://api.moesif.com/v1/~/workspaces/{id}

Parameters

Name In Type Required Description
id path string true none

Example responses

200 Response

{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "_id": "string",
  "is_template": true,
  "dashboard": {},
  "auth_user_id": "string",
  "colors": {},
  "sequence": [
    {
      "delay": 0,
      "submit_data": {
        "body": {},
        "url": "string",
        "params": [
          {
            "key": null,
            "val": null
          }
        ],
        "verb": "string",
        "headers": [
          {
            "key": null,
            "val": null
          }
        ]
      }
    }
  ],
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "app_id": "string",
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  },
  "org_id": "string",
  "migration": {},
  "created": "2024-04-11T04:01:35.090Z",
  "comments": {
    "summary": {
      "count": 0,
      "latest_comment": {
        "auth_user_id": "string",
        "comment_id": "string",
        "mentions": [
          "string"
        ],
        "partner_user_id": "string",
        "message": "string",
        "created_at": "2024-04-11T04:01:35.090Z",
        "updated_at": "2024-04-11T04:01:35.090Z"
      }
    }
  }
}

Responses

Status Meaning Description Schema
200 OK success WorkspaceDocument

deleteWorkspace

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/workspaces/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/workspaces/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/workspaces/{id}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/workspaces/{id}

Delete a Workspace

DELETE https://api.moesif.com/v1/~/workspaces/{id}

Parameters

Name In Type Required Description
id path string true none

Responses

Status Meaning Description Schema
200 OK success None

createComment

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/comments \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "message": "string",
  "mentions": [
    "string"
  ]
}' 
const fetch = require('node-fetch');
const inputBody = {
  "message": "string",
  "mentions": [
    "string"
  ]
};
const headers = {
  'Content-Type':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "message": "string",
  "mentions": [
    "string"
  ]
}

r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/comments', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "message": "string",
  "mentions": [
    "string"
  ]
}')

result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/comments',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "message": "string",
  "mentions": [
    "string"
  ]
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}/comments', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "message": "string",
  "mentions": [
    "string"
  ]
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}/comments", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments";

      string json = @"{
  ""message"": ""string"",
  ""mentions"": [
    ""string""
  ]
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(CommentItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(CommentItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "message": "string",
  "mentions": [
    "string"
  ]
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/workspaces/{id}/comments

Create a New Comment

POST https://api.moesif.com/v1/~/workspaces/{id}/comments

Example Request

{
  "message": "string",
  "mentions": [
    "string"
  ]
}

Parameters

Name In Type Required Description
id path string true none
body body CommentItem true none

Responses

Status Meaning Description Schema
201 Created success None

getComments

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/workspaces/{id}/comments \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/workspaces/{id}/comments', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/{id}/comments',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces/{id}/comments', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/{id}/comments")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/workspaces/{id}/comments

Get all Comments

GET https://api.moesif.com/v1/~/workspaces/{id}/comments

Parameters

Name In Type Required Description
id path string true none

Responses

Status Meaning Description Schema
200 OK success None

updateComment

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId} \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "message": "string",
  "mentions": [
    "string"
  ]
}' 
const fetch = require('node-fetch');
const inputBody = {
  "message": "string",
  "mentions": [
    "string"
  ]
};
const headers = {
  'Content-Type':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "message": "string",
  "mentions": [
    "string"
  ]
}

r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "message": "string",
  "mentions": [
    "string"
  ]
}')

result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "message": "string",
  "mentions": [
    "string"
  ]
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "message": "string",
  "mentions": [
    "string"
  ]
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}";

      string json = @"{
  ""message"": ""string"",
  ""mentions"": [
    ""string""
  ]
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(CommentItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(CommentItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "message": "string",
  "mentions": [
    "string"
  ]
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/workspaces/{id}/comments/{commentId}

Update Existing Comment

POST https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}

Example Request

{
  "message": "string",
  "mentions": [
    "string"
  ]
}

Parameters

Name In Type Required Description
id path string true none
commentId path string true none
body body CommentItem true none

Responses

Status Meaning Description Schema
201 Created success None

deleteComment

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/workspaces/{id}/comments/{commentId}

Delete a Comment

DELETE https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}

Parameters

Name In Type Required Description
id path string true none
commentId path string true none

Responses

Status Meaning Description Schema
204 No Content success None

addACLPermissions

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/policy/acl \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl',
{
  method: 'POST',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/policy/acl',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/policy/acl");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/workspaces/{id}/policy/acl

Add ACL permission

POST https://api.moesif.com/v1/~/workspaces/{id}/policy/acl

Parameters

Name In Type Required Description
id path string true none
grantee query string false none
permission query string false none

Responses

Status Meaning Description Schema
200 OK success None

deleteACLPermissions

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', params={
  'grantee': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}/policy/acl',
  params: {
  'grantee' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/workspaces/{id}/policy/acl

Delete ACL permission

DELETE https://api.moesif.com/v1/~/workspaces/{id}/policy/acl

Parameters

Name In Type Required Description
id path string true none
grantee query string true none

Responses

Status Meaning Description Schema
200 OK success None

Applications

addApp

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/apps \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/apps',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}

r = requests.post('https://api.moesif.com/v1/~/apps', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}')

result = RestClient.post 'https://api.moesif.com/v1/~/apps',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/apps', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/apps", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/apps";

      string json = @"{
  ""name"": ""string"",
  ""time_zone"": ""string"",
  ""week_starts_on"": 0,
  ""custom_app_id"": ""string""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(AppCreate content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(AppCreate content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/apps");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/apps

Create a new App

Create a new app under the selected organization

POST https://api.moesif.com/v1/~/apps

Example Request

{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}

Parameters

Name In Type Required Description
body body AppCreate true none

Example responses

200 Response

{
  "name": "string",
  "custom_app_id": "string",
  "search_api_base_url": "string",
  "week_starts_on": 0,
  "id": "string",
  "portal_api_base_url": "string",
  "secure_proxy": true,
  "time_zone": "string"
}

Responses

Status Meaning Description Schema
200 OK success AppResponse

getApps

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/apps?take=0 \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/apps?take=0',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/apps', params={
  'take': '0'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/apps',
  params: {
  'take' => 'integer(int32)'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/apps', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/apps")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/apps";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/apps?take=0");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/apps

Gets Apps

Gets a list of apps for the selected organization

GET https://api.moesif.com/v1/~/apps

Parameters

Name In Type Required Description
take query integer(int32) true none
before_id query string false none

Example responses

200 Response

[
  {
    "name": "string",
    "custom_app_id": "string",
    "search_api_base_url": "string",
    "week_starts_on": 0,
    "id": "string",
    "portal_api_base_url": "string",
    "secure_proxy": true,
    "time_zone": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK success Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [AppResponse] false none none
» name string true none none
» custom_app_id string false none none
» search_api_base_url string false none none
» week_starts_on integer(int32) false none none
» id string false none none
» portal_api_base_url string false none none
» secure_proxy boolean false none none
» time_zone string false none none

updateApp

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/apps/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/apps/{id}',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}

r = requests.post('https://api.moesif.com/v1/~/apps/{id}', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}')

result = RestClient.post 'https://api.moesif.com/v1/~/apps/{id}',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/apps/{id}', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/apps/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/apps/{id}";

      string json = @"{
  ""name"": ""string"",
  ""time_zone"": ""string"",
  ""week_starts_on"": 0,
  ""custom_app_id"": ""string""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(AppUpdate content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(AppUpdate content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/apps/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/apps/{id}

Update Apps

Update the name of the app for the selected organization

POST https://api.moesif.com/v1/~/apps/{id}

Example Request

{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}

Parameters

Name In Type Required Description
id path string true none
body body AppUpdate true none

Example responses

200 Response

{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}

Responses

Status Meaning Description Schema
200 OK success AppUpdate

deleteApp

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/apps/{id} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/apps/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/apps/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/apps/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/apps/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/apps/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/apps/{id}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/apps/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/apps/{id}

Delete Apps

Delete the app for the selected organization

DELETE https://api.moesif.com/v1/~/apps/{id}

Parameters

Name In Type Required Description
id path string true none

Responses

Status Meaning Description Schema
200 OK success None

Product Catalog

createMoesifPlan

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/billing/catalog/plans?provider=string \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/plans?provider=string',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}

r = requests.post('https://api.moesif.com/v1/~/billing/catalog/plans', params={
  'provider': 'string'

}, headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}')

result = RestClient.post 'https://api.moesif.com/v1/~/billing/catalog/plans',
  params: {
  'provider' => 'string'
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/billing/catalog/plans', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/catalog/plans", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/catalog/plans";

      string json = @"{
  ""name"": ""string"",
  ""prices"": [
    {
      ""name"": ""string"",
      ""transform_quantity"": {
        ""divide_by"": 0,
        ""round"": ""string""
      },
      ""provider"": ""string"",
      ""price_in_decimal"": ""string"",
      ""tiers"": [
        {
          ""up_to"": null,
          ""unit_price_in_decimal"": ""string"",
          ""flat_price_in_decimal"": ""string""
        }
      ],
      ""period_units"": ""string"",
      ""plan_id"": ""string"",
      ""id"": ""string"",
      ""status"": ""string"",
      ""pricing_model"": ""string"",
      ""tax_behavior"": ""string"",
      ""currency"": ""string"",
      ""metadata"": null,
      ""created_at"": ""2024-04-11T04:01:35.090Z"",
      ""unit"": ""string"",
      ""usage_aggregator"": ""string"",
      ""period"": 0
    }
  ],
  ""provider"": ""string"",
  ""description"": ""string"",
  ""id"": ""string"",
  ""status"": ""string"",
  ""product_id"": ""string"",
  ""metadata"": null,
  ""created_at"": ""2024-04-11T04:01:35.090Z"",
  ""unit"": ""string"",
  ""updated_at"": ""2024-04-11T04:01:35.090Z""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(MoesifPlan content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(MoesifPlan content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans?provider=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/billing/catalog/plans

Create a new Moesif Plan

POST https://api.moesif.com/v1/~/billing/catalog/plans

Example Request

{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}

Parameters

Name In Type Required Description
provider query string true none
body body MoesifPlan true none

Example responses

201 Response

{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}

Responses

Status Meaning Description Schema
201 Created created MoesifPlan

listMoesifPlans

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/billing/catalog/plans \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/plans',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/billing/catalog/plans', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/plans',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/plans', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/plans")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/catalog/plans";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/billing/catalog/plans

List all Moesif Plans

GET https://api.moesif.com/v1/~/billing/catalog/plans

Parameters

Name In Type Required Description
provider query string false none
includes query string false none
limit query integer(int32) false A limit on the number of objects to be returned. Limit can range between 1 and 1000 (inclusive). Defaults to 1000.

Example responses

200 Response

[
  {
    "name": "string",
    "prices": [
      {
        "name": "string",
        "transform_quantity": {
          "divide_by": 0,
          "round": "string"
        },
        "provider": "string",
        "price_in_decimal": "string",
        "tiers": [
          {
            "up_to": null,
            "unit_price_in_decimal": "string",
            "flat_price_in_decimal": "string"
          }
        ],
        "period_units": "string",
        "plan_id": "string",
        "id": "string",
        "status": "string",
        "pricing_model": "string",
        "tax_behavior": "string",
        "currency": "string",
        "metadata": null,
        "created_at": "2024-04-11T04:01:35.090Z",
        "unit": "string",
        "usage_aggregator": "string",
        "period": 0
      }
    ],
    "provider": "string",
    "description": "string",
    "id": "string",
    "status": "string",
    "product_id": "string",
    "metadata": null,
    "created_at": "2024-04-11T04:01:35.090Z",
    "unit": "string",
    "updated_at": "2024-04-11T04:01:35.090Z"
  }
]

Responses

Status Meaning Description Schema
200 OK success Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [MoesifPlan] false none none
» name string false none none
» prices [MoesifPrice] false none none
»» name string false none none
»» transform_quantity object false none none
»»» divide_by integer(int64) true none none
»»» round string true none none
»» provider string false none none
»» price_in_decimal string false none none
»» tiers [MoesifPriceTier] false none none
»»» up_to util.either[scala.long,string] true none none
»»» unit_price_in_decimal string false none none
»»» flat_price_in_decimal string false none none
»» period_units string false none none
»» plan_id string false none none
»» id string false none none
»» status string false none none
»» pricing_model string false none none
»» tax_behavior string false none none
»» currency string false none none
»» metadata .map[string,string] false none none
»» created_at string(date-time) false none none
»» unit string false none none
»» usage_aggregator string false none none
»» period integer(int64) false none none
» provider string false none none
» description string false none none
» id string false none none
» status string false none none
» product_id string false none none
» metadata .map[string,string] false none none
» created_at string(date-time) false none none
» unit string false none none
» updated_at string(date-time) false none none

getMoesifPlan

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params={
  'provider': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/plans/{id}',
  params: {
  'provider' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/plans/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/plans/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/catalog/plans/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/billing/catalog/plans/{id}

Get a Moesif Plan

Get the Moesif Plan for authenticated users

GET https://api.moesif.com/v1/~/billing/catalog/plans/{id}

Parameters

Name In Type Required Description
id path string true none
provider query string true none

Example responses

200 Response

{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}

Responses

Status Meaning Description Schema
200 OK success MoesifPlan

deleteMoesifPlan

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params={
  'provider': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/billing/catalog/plans/{id}',
  params: {
  'provider' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/billing/catalog/plans/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/billing/catalog/plans/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/billing/catalog/plans/{id}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/billing/catalog/plans/{id}

Delete a Moesif Plan

DELETE https://api.moesif.com/v1/~/billing/catalog/plans/{id}

Parameters

Name In Type Required Description
id path string true none
provider query string true none

Responses

Status Meaning Description Schema
204 No Content no content None

updateMoesifPlan

Code samples

# You can also use wget
curl -X PUT https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string',
{
  method: 'PUT',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}

r = requests.put('https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params={
  'provider': 'string'

}, headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}')

result = RestClient.put 'https://api.moesif.com/v1/~/billing/catalog/plans/{id}',
  params: {
  'provider' => 'string'
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('PUT','https://api.moesif.com/v1/~/billing/catalog/plans/{id}', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("PUT", "https://api.moesif.com/v1/~/billing/catalog/plans/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }



    /// Make a dummy request
    public async Task MakePutRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/billing/catalog/plans/{id}";


      string json = @"{
  ""name"": ""string"",
  ""prices"": [
    {
      ""name"": ""string"",
      ""transform_quantity"": {
        ""divide_by"": 0,
        ""round"": ""string""
      },
      ""provider"": ""string"",
      ""price_in_decimal"": ""string"",
      ""tiers"": [
        {
          ""up_to"": null,
          ""unit_price_in_decimal"": ""string"",
          ""flat_price_in_decimal"": ""string""
        }
      ],
      ""period_units"": ""string"",
      ""plan_id"": ""string"",
      ""id"": ""string"",
      ""status"": ""string"",
      ""pricing_model"": ""string"",
      ""tax_behavior"": ""string"",
      ""currency"": ""string"",
      ""metadata"": null,
      ""created_at"": ""2024-04-11T04:01:35.090Z"",
      ""unit"": ""string"",
      ""usage_aggregator"": ""string"",
      ""period"": 0
    }
  ],
  ""provider"": ""string"",
  ""description"": ""string"",
  ""id"": ""string"",
  ""status"": ""string"",
  ""product_id"": ""string"",
  ""metadata"": null,
  ""created_at"": ""2024-04-11T04:01:35.090Z"",
  ""unit"": ""string"",
  ""updated_at"": ""2024-04-11T04:01:35.090Z""
}";
      var content = JsonConvert.DeserializeObject(json);
      var result = await PutAsync(id, content, url);


    }

    /// Performs a PUT Request
    public async Task PutAsync(int id, MoesifPlan content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute PUT request
        HttpResponseMessage response = await Client.PutAsync(url + $"/{id}", jsonContent);

        //Return response
        return await DeserializeObject(response);
    }


    /// Serialize an object to Json
    private StringContent SerializeObject(MoesifPlan content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

PUT /~/billing/catalog/plans/{id}

Update a Moesif Plan

PUT https://api.moesif.com/v1/~/billing/catalog/plans/{id}

Example Request

{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}

Parameters

Name In Type Required Description
id path string true none
provider query string true none
body body MoesifPlan true none

Example responses

200 Response

{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}

Responses

Status Meaning Description Schema
200 OK success MoesifPlan

createMoesifPrice

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/billing/catalog/prices?provider=string \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/prices?provider=string',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}

r = requests.post('https://api.moesif.com/v1/~/billing/catalog/prices', params={
  'provider': 'string'

}, headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}')

result = RestClient.post 'https://api.moesif.com/v1/~/billing/catalog/prices',
  params: {
  'provider' => 'string'
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/billing/catalog/prices', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/catalog/prices", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/catalog/prices";

      string json = @"{
  ""name"": ""string"",
  ""transform_quantity"": {
    ""divide_by"": 0,
    ""round"": ""string""
  },
  ""provider"": ""string"",
  ""price_in_decimal"": ""string"",
  ""tiers"": [
    {
      ""up_to"": null,
      ""unit_price_in_decimal"": ""string"",
      ""flat_price_in_decimal"": ""string""
    }
  ],
  ""period_units"": ""string"",
  ""plan_id"": ""string"",
  ""id"": ""string"",
  ""status"": ""string"",
  ""pricing_model"": ""string"",
  ""tax_behavior"": ""string"",
  ""currency"": ""string"",
  ""metadata"": null,
  ""created_at"": ""2024-04-11T04:01:35.090Z"",
  ""unit"": ""string"",
  ""usage_aggregator"": ""string"",
  ""period"": 0
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(MoesifPrice content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(MoesifPrice content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices?provider=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/billing/catalog/prices

Create a new Moesif Price

POST https://api.moesif.com/v1/~/billing/catalog/prices

Example Request

{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}

Parameters

Name In Type Required Description
provider query string true none
body body MoesifPrice true none

Example responses

201 Response

{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}

Responses

Status Meaning Description Schema
201 Created created MoesifPrice

listMoesifPrices

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/billing/catalog/prices \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/prices',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/billing/catalog/prices', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/prices',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/prices', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/prices")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/catalog/prices";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/billing/catalog/prices

List all Moesif Prices for a specific Plan

GET https://api.moesif.com/v1/~/billing/catalog/prices

Parameters

Name In Type Required Description
provider query string false none
limit query integer(int32) false A limit on the number of objects to be returned. Limit can range between 1 and 1000 (inclusive). Defaults to 1000.

Example responses

200 Response

[
  {
    "name": "string",
    "transform_quantity": {
      "divide_by": 0,
      "round": "string"
    },
    "provider": "string",
    "price_in_decimal": "string",
    "tiers": [
      {
        "up_to": null,
        "unit_price_in_decimal": "string",
        "flat_price_in_decimal": "string"
      }
    ],
    "period_units": "string",
    "plan_id": "string",
    "id": "string",
    "status": "string",
    "pricing_model": "string",
    "tax_behavior": "string",
    "currency": "string",
    "metadata": null,
    "created_at": "2024-04-11T04:01:35.090Z",
    "unit": "string",
    "usage_aggregator": "string",
    "period": 0
  }
]

Responses

Status Meaning Description Schema
200 OK success Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [MoesifPrice] false none none
» name string false none none
» transform_quantity object false none none
»» divide_by integer(int64) true none none
»» round string true none none
» provider string false none none
» price_in_decimal string false none none
» tiers [MoesifPriceTier] false none none
»» up_to util.either[scala.long,string] true none none
»» unit_price_in_decimal string false none none
»» flat_price_in_decimal string false none none
» period_units string false none none
» plan_id string false none none
» id string false none none
» status string false none none
» pricing_model string false none none
» tax_behavior string false none none
» currency string false none none
» metadata .map[string,string] false none none
» created_at string(date-time) false none none
» unit string false none none
» usage_aggregator string false none none
» period integer(int64) false none none

getMoesifPrice

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params={
  'provider': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/prices/{id}',
  params: {
  'provider' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/prices/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/prices/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/catalog/prices/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/billing/catalog/prices/{id}

Get a Moesif Price

Get the Moesif Price for a specific Plan for authenticated users

GET https://api.moesif.com/v1/~/billing/catalog/prices/{id}

Parameters

Name In Type Required Description
id path string true none
provider query string true none

Example responses

200 Response

{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}

Responses

Status Meaning Description Schema
200 OK success MoesifPrice

deleteMoesifPrice

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params={
  'provider': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/billing/catalog/prices/{id}',
  params: {
  'provider' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/billing/catalog/prices/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/billing/catalog/prices/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/billing/catalog/prices/{id}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/billing/catalog/prices/{id}

Delete a Moesif Price

DELETE https://api.moesif.com/v1/~/billing/catalog/prices/{id}

Parameters

Name In Type Required Description
id path string true none
provider query string true none

Responses

Status Meaning Description Schema
204 No Content no content None

updateMoesifPrice

Code samples

# You can also use wget
curl -X PUT https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string',
{
  method: 'PUT',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}

r = requests.put('https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params={
  'provider': 'string'

}, headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}')

result = RestClient.put 'https://api.moesif.com/v1/~/billing/catalog/prices/{id}',
  params: {
  'provider' => 'string'
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('PUT','https://api.moesif.com/v1/~/billing/catalog/prices/{id}', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("PUT", "https://api.moesif.com/v1/~/billing/catalog/prices/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }



    /// Make a dummy request
    public async Task MakePutRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/billing/catalog/prices/{id}";


      string json = @"{
  ""name"": ""string"",
  ""transform_quantity"": {
    ""divide_by"": 0,
    ""round"": ""string""
  },
  ""provider"": ""string"",
  ""price_in_decimal"": ""string"",
  ""tiers"": [
    {
      ""up_to"": null,
      ""unit_price_in_decimal"": ""string"",
      ""flat_price_in_decimal"": ""string""
    }
  ],
  ""period_units"": ""string"",
  ""plan_id"": ""string"",
  ""id"": ""string"",
  ""status"": ""string"",
  ""pricing_model"": ""string"",
  ""tax_behavior"": ""string"",
  ""currency"": ""string"",
  ""metadata"": null,
  ""created_at"": ""2024-04-11T04:01:35.090Z"",
  ""unit"": ""string"",
  ""usage_aggregator"": ""string"",
  ""period"": 0
}";
      var content = JsonConvert.DeserializeObject(json);
      var result = await PutAsync(id, content, url);


    }

    /// Performs a PUT Request
    public async Task PutAsync(int id, MoesifPrice content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute PUT request
        HttpResponseMessage response = await Client.PutAsync(url + $"/{id}", jsonContent);

        //Return response
        return await DeserializeObject(response);
    }


    /// Serialize an object to Json
    private StringContent SerializeObject(MoesifPrice content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

PUT /~/billing/catalog/prices/{id}

Update a Moesif Price

PUT https://api.moesif.com/v1/~/billing/catalog/prices/{id}

Example Request

{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}

Parameters

Name In Type Required Description
id path string true none
provider query string true none
body body MoesifPrice true none

Example responses

200 Response

{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}

Responses

Status Meaning Description Schema
200 OK success MoesifPrice

Billing Meters

listMeters

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/billing/meters \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/meters',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/billing/meters', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/billing/meters',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/billing/meters', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/meters")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/meters";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/meters");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/billing/meters

List Billing Meters

List Billing Meters

GET https://api.moesif.com/v1/~/billing/meters

Parameters

Name In Type Required Description

Example responses

200 Response

[
  {
    "name": "string",
    "billing_plan": {
      "provider_slug": "string",
      "friendly_name": "string",
      "params": {
        "usage_rounding_mode": "string",
        "webhook_params": {
          "reporting": {},
          "channel_ids": [
            null
          ],
          "custom_plan": {}
        },
        "recurly_params": {
          "plan": {},
          "add_on": {},
          "add_ons": [
            null
          ]
        },
        "chargebee_params": {
          "item_plan": {},
          "item_price": {},
          "item_prices": [
            null
          ],
          "reporting": {}
        },
        "stripe_params": {
          "product": {},
          "price": {},
          "prices": [
            null
          ],
          "reporting": {}
        },
        "zuora_params": {
          "plan_id": "string",
          "price_id": "string",
          "price_ids": [
            null
          ]
        },
        "usage_multiplier": null
      }
    },
    "url_query": "string",
    "_id": "string",
    "slug": "string",
    "status": "string",
    "modified_at": "2024-04-11T04:01:35.090Z",
    "es_query": "string",
    "created_at": "2024-04-11T04:01:35.090Z",
    "zero_balance_behavior": "string",
    "app_id": "string",
    "org_id": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK success Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [BillingMeterDocument] false none none
» name string true none none
» billing_plan object true none none
»» provider_slug string true none none
»» friendly_name string false none none
»» params object false none none
»»» usage_rounding_mode string false none none
»»» webhook_params object false none none
»»»» reporting object false none none
»»»»» report_when [string] true none none
»»»» channel_ids [string] true none none
»»»» custom_plan object true none none
»»»»» plan_id string true none none
»»» recurly_params object false none none
»»»» plan object false none none
»»»»» name string false none none
»»»»» id string false none none
»»»»» code string true none none
»»»» add_on object false none none
»»»»» name string false none none
»»»»» currencies [RecurlyCurrencyAmount] false none none
»»»»»» currency string true none none
»»»»»» unit_amount double false none none
»»»»»» unit_amount_decimal string false none none
»»»»» usage_percentage double false none none
»»»»» add_on_type string false none none
»»»»» external_sku string false none none
»»»»» state string false none none
»»»»» tiers [RecurlyAddOnTier] false none none
»»»»»» ending_quantity integer(int64) false none none
»»»»»» currencies [RecurlyCurrencyAmount] true none none
»»»»» tier_type string false none none
»»»»» code string true none none
»»»»» plan_id string false none none
»»»»» id string false none none
»»»»» percentage_tiers [RecurlyAddOnPercentageTiers] false none none
»»»»»» tiers [RecurlyAddOnPercentageTier] false none none
»»»»»»» ending_amount double false none none
»»»»»»» usage_percent string false none none
»»»»»» currency string false none none
»»»»» usage_type string false none none
»»»»» created_at string false none none
»»»»» usage_calculation_type string false none none
»»»»» updated_at string false none none
»»»»» deleted_at string false none none
»»»» add_ons [RecurlyPlanAddOn] false none none
»»» chargebee_params object false none none
»»»» item_plan object false none none
»»»»» name string false none none
»»»»» item_family_id string false none none
»»»»» description string false none none
»»»»» usage_calculation string false none none
»»»»» external_name string false none none
»»»»» metered boolean false none none
»»»»» id string true none none
»»»»» status string false none none
»»»»» unit string false none none
»»»»» updated_at integer(int64) false none none
»»»»» archived_at integer(int64) false none none
»»»» item_price object false none none
»»»»» name string false none none
»»»»» item_id string false none none
»»»»» description string false none none
»»»»» price integer(int64) false none none
»»»»» price_in_decimal string false none none
»»»»» external_name string false none none
»»»»» tiers [ChargebeeItemPriceTier] false none none
»»»»»» starting_unit integer(int32) true none none
»»»»»» ending_unit integer(int32) false none none
»»»»»» price integer(int32) true none none
»»»»» trial_end_action string false none none
»»»»» trial_period integer(int64) false none none
»»»»» id string true none none
»»»»» status string false none none
»»»»» pricing_model string false none none
»»»»» created_at integer(int64) false none none
»»»»» period_unit string false none none
»»»»» updated_at integer(int64) false none none
»»»»» trial_period_unit string false none none
»»»»» item_type string false none none
»»»»» currency_code string false none none
»»»»» archived_at integer(int64) false none none
»»»»» free_quantity integer(int64) false none none
»»»»» period integer(int64) false none none
»»»» item_prices [ChargebeeItemPrice] false none none
»»»» reporting object false none none
»»»»» reporting_period string false none none
»»» stripe_params object false none none
»»»» product object false none none
»»»»» name string true none none
»»»»» description string false none none
»»»»» unit_label string false none none
»»»»» id string true none none
»»»»» usage_type string false none none
»»»» price object false none none
»»»»» tiers_mode string false none none
»»»»» transform_quantity object false none none
»»»»»» divide_by integer(int64) false none none
»»»»»» round string false none none
»»»»» price_id string true none none
»»»»» tiers [StripeTier] false none none
»»»»»» flat_amount_decimal string false none none
»»»»»» up_to integer(int64) false none none
»»»»»» unit_amount_decimal string false none none
»»»»»» flat_amount integer(int64) false none none
»»»»»» unit_amount integer(int64) false none none
»»»»» recurring object false none none
»»»»»» trial_period_days integer(int64) false none none
»»»»»» interval string false none none
»»»»»» usage_type string false none none
»»»»»» interval_count integer(int64) false none none
»»»»»» aggregate_usage string false none none
»»»»» unit_amount_decimal string false none none
»»»»» price_nickname string false none none
»»»»» currency string false none none
»»»»» billing_scheme string false none none
»»»»» unit_amount integer(int64) false none none
»»»»» created integer(int64) false none none
»»»»» active boolean false none none
»»»» prices [StripePrice] false none none
»»»» reporting object false none none
»»» zuora_params object false none none
»»»» plan_id string false none none
»»»» price_id string false none none
»»»» price_ids [string] false none none
»»» usage_multiplier double false none none
» url_query string true none none
» _id string false none none
» slug string true none none
» status string true none none
» modified_at string(date-time) true none none
» es_query string true none none
» created_at string(date-time) true none none
» zero_balance_behavior string false none none
» app_id string true none none
» org_id string true none none

getMeter

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/billing/meters/{meterId} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/meters/{meterId}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/billing/meters/{meterId}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/billing/meters/{meterId}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/billing/meters/{meterId}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/meters/{meterId}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/meters/{meterId}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/meters/{meterId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/billing/meters/{meterId}

Get Billing Meter by id

Get Billing Meter by id

GET https://api.moesif.com/v1/~/billing/meters/{meterId}

Parameters

Name In Type Required Description
meterId path string true none

Example responses

200 Response

{
  "name": "string",
  "billing_plan": {
    "provider_slug": "string",
    "friendly_name": "string",
    "params": {
      "usage_rounding_mode": "string",
      "webhook_params": {
        "reporting": {
          "report_when": null
        },
        "channel_ids": [
          "string"
        ],
        "custom_plan": {
          "plan_id": null
        }
      },
      "recurly_params": {
        "plan": {
          "name": null,
          "id": null,
          "code": null
        },
        "add_on": {
          "name": null,
          "currencies": null,
          "usage_percentage": null,
          "add_on_type": null,
          "external_sku": null,
          "state": null,
          "tiers": null,
          "tier_type": null,
          "code": null,
          "plan_id": null,
          "id": null,
          "percentage_tiers": null,
          "usage_type": null,
          "created_at": null,
          "usage_calculation_type": null,
          "updated_at": null,
          "deleted_at": null
        },
        "add_ons": [
          {}
        ]
      },
      "chargebee_params": {
        "item_plan": {
          "name": null,
          "item_family_id": null,
          "description": null,
          "usage_calculation": null,
          "external_name": null,
          "metered": null,
          "id": null,
          "status": null,
          "unit": null,
          "updated_at": null,
          "archived_at": null
        },
        "item_price": {
          "name": null,
          "item_id": null,
          "description": null,
          "price": null,
          "price_in_decimal": null,
          "external_name": null,
          "tiers": null,
          "trial_end_action": null,
          "trial_period": null,
          "id": null,
          "status": null,
          "pricing_model": null,
          "created_at": null,
          "period_unit": null,
          "updated_at": null,
          "trial_period_unit": null,
          "item_type": null,
          "currency_code": null,
          "archived_at": null,
          "free_quantity": null,
          "period": null
        },
        "item_prices": [
          {}
        ],
        "reporting": {
          "reporting_period": null
        }
      },
      "stripe_params": {
        "product": {
          "name": null,
          "description": null,
          "unit_label": null,
          "id": null,
          "usage_type": null
        },
        "price": {
          "tiers_mode": null,
          "transform_quantity": null,
          "price_id": null,
          "tiers": null,
          "recurring": null,
          "unit_amount_decimal": null,
          "price_nickname": null,
          "currency": null,
          "billing_scheme": null,
          "unit_amount": null,
          "created": null,
          "active": null
        },
        "prices": [
          {}
        ],
        "reporting": {
          "reporting_period": null
        }
      },
      "zuora_params": {
        "plan_id": "string",
        "price_id": "string",
        "price_ids": [
          "string"
        ]
      },
      "usage_multiplier": null
    }
  },
  "url_query": "string",
  "_id": "string",
  "slug": "string",
  "status": "string",
  "modified_at": "2024-04-11T04:01:35.090Z",
  "es_query": "string",
  "created_at": "2024-04-11T04:01:35.090Z",
  "app_id": "string",
  "org_id": "string"
}

Responses

Status Meaning Description Schema
200 OK success BillingMeterDocument

deleteMeter

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/billing/meters/{meterId} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/meters/{meterId}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/billing/meters/{meterId}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/billing/meters/{meterId}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/billing/meters/{meterId}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/billing/meters/{meterId}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/billing/meters/{meterId}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/meters/{meterId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/billing/meters/{meterId}

Delete Billing Meter by id

Delete Billing Meter by id

DELETE https://api.moesif.com/v1/~/billing/meters/{meterId}

Parameters

Name In Type Required Description
meterId path string true none

Responses

Status Meaning Description Schema
200 OK success None

Billing Reports

getBillingReports

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/billing/reports \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/reports',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/billing/reports', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/billing/reports',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/billing/reports', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/reports")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/reports";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/reports");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/billing/reports

Get BillingReports

Query audit history of billing reports to external billing providers

GET https://api.moesif.com/v1/~/billing/reports

Parameters

Name In Type Required Description
from query string(date-time) false none
to query string(date-time) false none
billing_meter_id query string false none
company_id query string false none
provider query string false none
subscription_id query string false none
success query boolean false none
status_code query integer(int32) false none
error_code query string false none
type query string false none

Example responses

200 Response

[
  {
    "ending_balance": {
      "sequence_id": 0,
      "current_balance": 0.1,
      "pending_activity": 0.1,
      "available_balance": 0.1
    },
    "company_id": "string",
    "success": true,
    "provider": "string",
    "report_version": 0,
    "usage_end_time": "2024-04-11T04:01:35.090Z",
    "usage": {
      "invoice": {
        "period_start": "2024-04-11T04:01:35.090Z",
        "period_end": "2024-04-11T04:01:35.090Z",
        "id": "string"
      },
      "aggregator": "string"
    },
    "_id": "string",
    "meter_usage": 0,
    "last_success_time": "2024-04-11T04:01:35.090Z",
    "beginning_balance": {
      "sequence_id": 0,
      "current_balance": 0.1,
      "pending_activity": 0.1,
      "available_balance": 0.1
    },
    "billing_meter_id": "string",
    "amount": 0.1,
    "usage_start_time": "2024-04-11T04:01:35.090Z",
    "status": "string",
    "provider_requests": [
      {
        "success": true,
        "status_code": 0,
        "job_id": "string",
        "error_message": "string",
        "error_code": "string",
        "request_time": "2024-04-11T04:01:35.090Z"
      }
    ],
    "currency": "string",
    "report_total_usage": 0,
    "channel_requests": [
      {
        "channel_id": "string",
        "channel_name": "string",
        "provider_requests": [
          {
            "success": true,
            "status_code": 0,
            "job_id": "string",
            "error_message": "string",
            "error_code": "string",
            "request_time": "2024-04-11T04:01:35.090Z"
          }
        ]
      }
    ],
    "created_at": "2024-04-11T04:01:35.090Z",
    "app_id": "string",
    "subscription_id": "string",
    "subscription_period_start": "2024-04-11T04:01:35.090Z",
    "balance_changes": [
      {
        "amount": 0.1
      }
    ],
    "type": "string",
    "updated_at": "2024-04-11T04:01:35.090Z",
    "org_id": "string",
    "subscription_period_end": "2024-04-11T04:01:35.090Z",
    "meter_metric": 0
  }
]

Responses

Status Meaning Description Schema
200 OK success Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [BillingReport] false none none
» ending_balance object false none none
»» sequence_id integer(int32) true none none
»» current_balance number(double) true none none
»» pending_activity number(double) true none none
»» available_balance number(double) true none none
» company_id string true none none
» success boolean true none none
» provider string true none none
» report_version integer(int32) false none none
» usage_end_time string(date-time) true none none
» usage object false none none
»» invoice object false none none
»»» period_start string(date-time) false none none
»»» period_end string(date-time) false none none
»»» id string true none none
»» aggregator string false none none
» _id string false none none
» meter_usage integer(int64) true none none
» last_success_time string(date-time) false none none
» beginning_balance object false none none
» billing_meter_id string true none none
» amount number(double) false none none
» usage_start_time string(date-time) true none none
» status string false none none
» provider_requests [ProviderRequest] true none none
»» success boolean true none none
»» status_code integer(int32) true none none
»» job_id string true none none
»» error_message string true none none
»» error_code string true none none
»» request_time string(date-time) true none none
» currency string false none none
» report_total_usage integer(int64) true none none
» channel_requests [ChannelRequest] false none none
»» channel_id string true none none
»» channel_name string true none none
»» provider_requests [ProviderRequest] true none none
» created_at string(date-time) false none none
» app_id string true none none
» subscription_id string true none none
» subscription_period_start string(date-time) false none none
» balance_changes [BalanceChange] false none none
»» amount number(double) true none none
» type string false none none
» updated_at string(date-time) false none none
» org_id string true none none
» subscription_period_end string(date-time) false none none
» meter_metric integer(int64) true none none

getBillingReportsMetrics

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/billing/reports/metrics', params={
  'from': '2024-04-11T04:01:35.090Z',  'to': '2024-04-11T04:01:35.090Z'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/billing/reports/metrics',
  params: {
  'from' => 'string(date-time)',
  'to' => 'string(date-time)'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/billing/reports/metrics', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/reports/metrics")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/reports/metrics";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/billing/reports/metrics

Get BillingReports' values for a given meter and time range for a single company or all companies

Get BillingReports' values for a given meter and time range for a single company or all companies

GET https://api.moesif.com/v1/~/billing/reports/metrics

Parameters

Name In Type Required Description
from query string(date-time) true none
to query string(date-time) true none
billing_meter_id query string false none
success query boolean false none
aggregator query string false none
interval query string false none
company_id query string false none
subscription_id query string false none
type query array[string] false none

Example responses

200 Response

{
  "buckets": [
    {
      "start": "2024-04-11T04:01:35.090Z",
      "metric": 0.1,
      "amounts": null,
      "ending_balance": {
        "current_balance": 0.1,
        "pending_activity": 0.1,
        "available_balance": 0.1
      }
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK three buckets of aggregates for the given meter and time range including Metric Value, Reported Usage, and list of errors. BillingMetricResponse

Balance Transactions

createBalanceTransaction

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/billing/reports/balance_transactions \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "company_id": "string",
  "description": "string",
  "expire_at": "2024-04-11T04:01:35.090Z",
  "active_at": "2024-04-11T04:01:35.090Z",
  "amount": 0.1,
  "transaction_id": "string",
  "subscription_id": "string",
  "type": "string"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "company_id": "string",
  "description": "string",
  "expire_at": "2024-04-11T04:01:35.090Z",
  "active_at": "2024-04-11T04:01:35.090Z",
  "amount": 0.1,
  "transaction_id": "string",
  "subscription_id": "string",
  "type": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/billing/reports/balance_transactions',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "company_id": "string",
  "description": "string",
  "expire_at": "2024-04-11T04:01:35.090Z",
  "active_at": "2024-04-11T04:01:35.090Z",
  "amount": 0.1,
  "transaction_id": "string",
  "subscription_id": "string",
  "type": "string"
}

r = requests.post('https://api.moesif.com/v1/~/billing/reports/balance_transactions', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "company_id": "string",
  "description": "string",
  "expire_at": "2024-04-11T04:01:35.090Z",
  "active_at": "2024-04-11T04:01:35.090Z",
  "amount": 0.1,
  "transaction_id": "string",
  "subscription_id": "string",
  "type": "string"
}')

result = RestClient.post 'https://api.moesif.com/v1/~/billing/reports/balance_transactions',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "company_id": "string",
  "description": "string",
  "expire_at": "2024-04-11T04:01:35.090Z",
  "active_at": "2024-04-11T04:01:35.090Z",
  "amount": 0.1,
  "transaction_id": "string",
  "subscription_id": "string",
  "type": "string"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/billing/reports/balance_transactions', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "company_id": "string",
  "description": "string",
  "expire_at": "2024-04-11T04:01:35.090Z",
  "active_at": "2024-04-11T04:01:35.090Z",
  "amount": 0.1,
  "transaction_id": "string",
  "subscription_id": "string",
  "type": "string"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/reports/balance_transactions", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/billing/reports/balance_transactions";

      string json = @"{
  ""company_id"": ""string"",
  ""description"": ""string"",
  ""expire_at"": ""2024-04-11T04:01:35.090Z"",
  ""active_at"": ""2024-04-11T04:01:35.090Z"",
  ""amount"": 0.1,
  ""transaction_id"": ""string"",
  ""subscription_id"": ""string"",
  ""type"": ""string""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(BillingReportBalanceTransCreate content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(BillingReportBalanceTransCreate content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/billing/reports/balance_transactions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "company_id": "string",
  "description": "string",
  "expire_at": "2024-04-11T04:01:35.090Z",
  "active_at": "2024-04-11T04:01:35.090Z",
  "amount": 0.1,
  "transaction_id": "string",
  "subscription_id": "string",
  "type": "string"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/billing/reports/balance_transactions

Post BillingReports Balance Transactions

Post a billing report of type balance_transaction

POST https://api.moesif.com/v1/~/billing/reports/balance_transactions

Example Request

{
  "company_id": "string",
  "description": "string",
  "expire_at": "2024-04-11T04:01:35.090Z",
  "active_at": "2024-04-11T04:01:35.090Z",
  "amount": 0.1,
  "transaction_id": "string",
  "subscription_id": "string",
  "type": "string"
}

Parameters

Name In Type Required Description
body body BillingReportBalanceTransCreate true none

Responses

Status Meaning Description Schema
204 No Content success, no content and BillingReports were created or updated None

Cohorts

createCohort

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/cohorts \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/cohorts',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}

r = requests.post('https://api.moesif.com/v1/~/cohorts', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}')

result = RestClient.post 'https://api.moesif.com/v1/~/cohorts',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/cohorts', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/cohorts", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/cohorts";

      string json = @"{
  ""channels"": null,
  ""priority"": 0,
  ""url_query"": ""string"",
  ""criteria"": {},
  ""notification_rule"": {
    ""send_on_addition"": true,
    ""send_on_removal"": true,
    ""period"": ""string"",
    ""fields"": [
      ""string""
    ]
  },
  ""cohort_name"": ""string"",
  ""to"": ""string"",
  ""week_starts_on"": 0,
  ""locked_by"": ""string"",
  ""from"": ""string"",
  ""cohort_type"": ""string"",
  ""time_zone"": ""string""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(CohortCreateItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(CohortCreateItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/cohorts");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/cohorts

Create New Cohort

POST https://api.moesif.com/v1/~/cohorts

Example Request

{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}

Parameters

Name In Type Required Description
body body CohortCreateItem true none

Example responses

201 Response

{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": "string",
  "_id": "string",
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "modified_at": "2024-04-11T04:01:35.090Z",
  "from": "string",
  "created_at": "2024-04-11T04:01:35.090Z",
  "app_id": "string",
  "cohort_type": "string",
  "time_zone": "string",
  "org_id": "string"
}

Responses

Status Meaning Description Schema
201 Created success CohortDocument

getCohorts

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/cohorts?cohort_type=string \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/cohorts?cohort_type=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/cohorts', params={
  'cohort_type': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/cohorts',
  params: {
  'cohort_type' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/cohorts', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/cohorts")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/cohorts";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/cohorts?cohort_type=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/cohorts

Get Cohorts

GET https://api.moesif.com/v1/~/cohorts

Parameters

Name In Type Required Description
cohort_type query string true none

Responses

Status Meaning Description Schema
200 OK success None

updateCohort

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/cohorts/{cohortId} \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}

r = requests.post('https://api.moesif.com/v1/~/cohorts/{cohortId}', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}')

result = RestClient.post 'https://api.moesif.com/v1/~/cohorts/{cohortId}',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/cohorts/{cohortId}', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/cohorts/{cohortId}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}";

      string json = @"{
  ""channels"": null,
  ""priority"": 0,
  ""url_query"": ""string"",
  ""criteria"": {},
  ""sample_rate"": 0,
  ""notification_rule"": {
    ""send_on_addition"": true,
    ""send_on_removal"": true,
    ""period"": ""string"",
    ""fields"": [
      ""string""
    ]
  },
  ""cohort_name"": ""string"",
  ""to"": ""string"",
  ""week_starts_on"": 0,
  ""locked_by"": ""string"",
  ""from"": ""string"",
  ""cohort_type"": ""string"",
  ""time_zone"": ""string""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(CohortUpdateItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(CohortUpdateItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/cohorts/{cohortId}

Update a Cohort

POST https://api.moesif.com/v1/~/cohorts/{cohortId}

Example Request

{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}

Parameters

Name In Type Required Description
cohortId path string true none
body body CohortUpdateItem true none

Responses

Status Meaning Description Schema
200 OK success None

getCohort

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/cohorts/{cohortId}?cohort_type=string \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}?cohort_type=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/cohorts/{cohortId}', params={
  'cohort_type': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/cohorts/{cohortId}',
  params: {
  'cohort_type' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/cohorts/{cohortId}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/cohorts/{cohortId}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}?cohort_type=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/cohorts/{cohortId}

Get Cohort

GET https://api.moesif.com/v1/~/cohorts/{cohortId}

Parameters

Name In Type Required Description
cohort_type query string true none
cohortId path string true none

Responses

Status Meaning Description Schema
200 OK success None

deleteCohort

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/cohorts/{cohortId} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/cohorts/{cohortId}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/cohorts/{cohortId}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/cohorts/{cohortId}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/cohorts/{cohortId}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/cohorts/{cohortId}

Delete Cohort

DELETE https://api.moesif.com/v1/~/cohorts/{cohortId}

Parameters

Name In Type Required Description
cohortId path string true none

Responses

Status Meaning Description Schema
200 OK success None

deleteCohortSampleRate

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/cohorts/{cohortId}/sample_rate

Delete Sample Rate for a Cohort

DELETE https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate

Parameters

Name In Type Required Description
cohortId path string true none

Responses

Status Meaning Description Schema
200 OK success None

Dashboards

deleteDashboards

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/dashboard/{dashId} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboard/{dashId}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/dashboard/{dashId}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/dashboard/{dashId}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboard/{dashId}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboard/{dashId}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/dashboard/{dashId}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboard/{dashId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/dashboard/{dashId}

Delete a Dashboard

DELETE https://api.moesif.com/v1/~/dashboard/{dashId}

Parameters

Name In Type Required Description
dashId path string true none
parent_id query string false none

Responses

Status Meaning Description Schema
200 OK success None

copyDashboard

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboard/{id}/copy \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboard/{id}/copy',
{
  method: 'POST',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.post('https://api.moesif.com/v1/~/dashboard/{id}/copy', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.post 'https://api.moesif.com/v1/~/dashboard/{id}/copy',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/dashboard/{id}/copy', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboard/{id}/copy")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/dashboard/{id}/copy";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboard/{id}/copy");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/dashboard/{id}/copy

Copy Dashboard

POST https://api.moesif.com/v1/~/dashboard/{id}/copy

Parameters

Name In Type Required Description
id path string true none

Responses

Status Meaning Description Schema
201 Created success None

createDashboard

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboards \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboards',
{
  method: 'POST',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.post('https://api.moesif.com/v1/~/dashboards', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.post 'https://api.moesif.com/v1/~/dashboards',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/dashboards";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboards");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/dashboards

Create New Dashboard

POST https://api.moesif.com/v1/~/dashboards

Parameters

Name In Type Required Description

Example responses

201 Response

{
  "parent": "string",
  "name": "string",
  "_id": "string",
  "auth_user_id": "string",
  "profile_view_promotion": "string",
  "app_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  },
  "org_id": "string",
  "migration": {},
  "created": "2024-04-11T04:01:35.090Z"
}

Responses

Status Meaning Description Schema
201 Created success DashboardDocument

getDashboards

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/dashboards \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboards',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/dashboards', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/dashboards',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/dashboards', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/dashboards")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/dashboards";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboards");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/dashboards

Get a Dashboard

GET https://api.moesif.com/v1/~/dashboards

Parameters

Name In Type Required Description

Responses

Status Meaning Description Schema
200 OK success None

copyAllDashboards

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=string \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=string',
{
  method: 'POST',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.post('https://api.moesif.com/v1/~/dashboards/copy', params={
  'app_id': 'string',  'to_app_id': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/copy',
  params: {
  'app_id' => 'string',
  'to_app_id' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/copy', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/copy")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/dashboards/copy";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/dashboards/copy

Copy All Dashboards

POST https://api.moesif.com/v1/~/dashboards/copy

Parameters

Name In Type Required Description

Responses

Status Meaning Description Schema
201 Created success None

updateDashboard

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboards/{dashId} \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "parent": "string",
  "name": "string",
  "dashboard_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}' 
const fetch = require('node-fetch');
const inputBody = {
  "parent": "string",
  "name": "string",
  "dashboard_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
};
const headers = {
  'Content-Type':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboards/{dashId}',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "parent": "string",
  "name": "string",
  "dashboard_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}

r = requests.post('https://api.moesif.com/v1/~/dashboards/{dashId}', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "parent": "string",
  "name": "string",
  "dashboard_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}')

result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/{dashId}',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "parent": "string",
  "name": "string",
  "dashboard_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/{dashId}', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "parent": "string",
  "name": "string",
  "dashboard_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/{dashId}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/dashboards/{dashId}";

      string json = @"{
  ""parent"": ""string"",
  ""name"": ""string"",
  ""dashboard_id"": ""string"",
  ""workspace_ids"": [
    [
      ""string""
    ]
  ],
  ""sort_order"": 0.1,
  ""dashboard_ids"": [
    ""string""
  ],
  ""policy"": {
    ""acl"": [
      {
        ""grantee"": ""string"",
        ""permission"": ""string""
      }
    ],
    ""resource"": {},
    ""api_scopes"": [
      ""string""
    ],
    ""original_encoded_resource"": ""string""
  }
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(DashboardUpdateItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(DashboardUpdateItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "parent": "string",
  "name": "string",
  "dashboard_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/dashboards/{dashId}

Update a Dashboard

POST https://api.moesif.com/v1/~/dashboards/{dashId}

Example Request

{
  "parent": "string",
  "name": "string",
  "dashboard_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}

Parameters

Name In Type Required Description
dashId path string true none
body body DashboardUpdateItem true none

Responses

Status Meaning Description Schema
201 Created success None

deleteDashboard

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/dashboards/{dashId} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboards/{dashId}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/dashboards/{dashId}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{dashId}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboards/{dashId}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{dashId}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/dashboards/{dashId}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/dashboards/{dashId}

Delete a Dashboard

DELETE https://api.moesif.com/v1/~/dashboards/{dashId}

Parameters

Name In Type Required Description
dashId path string true none

Responses

Status Meaning Description Schema
200 OK success None

cascadeDeleteDashboard

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/dashboards/{dashId}/cascade \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboards/{dashId}/cascade',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{dashId}/cascade',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{dashId}/cascade")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/dashboards/{dashId}/cascade";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}/cascade");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/dashboards/{dashId}/cascade

Casccade delete a Dashboard

DELETE https://api.moesif.com/v1/~/dashboards/{dashId}/cascade

Parameters

Name In Type Required Description
dashId path string true none

Responses

Status Meaning Description Schema
200 OK success None

addACLPermissions

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboards/{id}/policy/acl \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl',
{
  method: 'POST',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.post('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/{id}/policy/acl',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl";


      await PostAsync(null, url);

    }

    /// Performs a POST Request
    public async Task PostAsync(undefined content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(undefined content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{id}/policy/acl");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/dashboards/{id}/policy/acl

Add Dashboards ACL permission

POST https://api.moesif.com/v1/~/dashboards/{id}/policy/acl

Parameters

Name In Type Required Description
id path string true none
grantee query string false none
permission query string false none

Responses

Status Meaning Description Schema
200 OK success None

deleteACLPermissions

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', params={
  'grantee': 'string'

}, headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{id}/policy/acl',
  params: {
  'grantee' => 'string'
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/dashboards/{id}/policy/acl

Delete Dashboards ACL permission

DELETE https://api.moesif.com/v1/~/dashboards/{id}/policy/acl

Parameters

Name In Type Required Description
id path string true none
grantee query string true none

Responses

Status Meaning Description Schema
200 OK success None

Email Templates

createEmailTemplate

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/emails/templates \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/emails/templates',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}

r = requests.post('https://api.moesif.com/v1/~/emails/templates', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}')

result = RestClient.post 'https://api.moesif.com/v1/~/emails/templates',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/emails/templates', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/emails/templates", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/emails/templates";

      string json = @"{
  ""name"": ""string"",
  ""state"": 0,
  ""cohorts"": [
    {
      ""id"": ""string"",
      ""type"": ""string"",
      ""config"": {
        ""url_query"": ""string"",
        ""criteria"": ""string"",
        ""cohort_name"": ""string"",
        ""to"": ""string"",
        ""from"": ""string"",
        ""cohort_type"": ""string"",
        ""time_zone"": ""string""
      }
    }
  ],
  ""dynamic_fields"": [
    {
      ""token"": ""string"",
      ""field"": ""string"",
      ""aggregator"": ""avg""
    }
  ],
  ""content"": {
    ""html"": ""string"",
    ""chunks"": {}
  },
  ""template"": {
    ""subject"": ""string"",
    ""editor"": ""string"",
    ""design"": {},
    ""thumbnail_url"": ""string""
  },
  ""period"": ""string"",
  ""addresses"": {
    ""from"": ""string"",
    ""cc"": [
      ""string""
    ],
    ""bcc"": [
      ""string""
    ]
  }
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(EmailTemplateCreateItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(EmailTemplateCreateItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/emails/templates");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/emails/templates

Create New Email Template

POST https://api.moesif.com/v1/~/emails/templates

Example Request

{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}

Parameters

Name In Type Required Description
body body EmailTemplateCreateItem true none

Example responses

Responses

Status Meaning Description Schema
201 Created success None

Response Schema

getEmailTemplates

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/emails/templates \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/emails/templates',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/emails/templates', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/emails/templates',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/emails/templates', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/emails/templates")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/emails/templates";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/emails/templates");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/emails/templates

Get Email Templates

GET https://api.moesif.com/v1/~/emails/templates

Parameters

Name In Type Required Description
cohort_id query string false none

Responses

Status Meaning Description Schema
200 OK success None

updateEmailTemplate

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/emails/templates/{id} \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
};
const headers = {
  'Content-Type':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/emails/templates/{id}',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}

r = requests.post('https://api.moesif.com/v1/~/emails/templates/{id}', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}')

result = RestClient.post 'https://api.moesif.com/v1/~/emails/templates/{id}',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/emails/templates/{id}', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/emails/templates/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/emails/templates/{id}";

      string json = @"{
  ""name"": ""string"",
  ""state"": 0,
  ""cohorts"": [
    {
      ""id"": ""string"",
      ""type"": ""string"",
      ""config"": {
        ""url_query"": ""string"",
        ""criteria"": ""string"",
        ""cohort_name"": ""string"",
        ""to"": ""string"",
        ""from"": ""string"",
        ""cohort_type"": ""string"",
        ""time_zone"": ""string""
      }
    }
  ],
  ""dynamic_fields"": [
    {
      ""token"": ""string"",
      ""field"": ""string"",
      ""aggregator"": ""avg""
    }
  ],
  ""content"": {
    ""html"": ""string"",
    ""chunks"": {}
  },
  ""template"": {
    ""subject"": ""string"",
    ""editor"": ""string"",
    ""design"": {},
    ""thumbnail_url"": ""string""
  },
  ""period"": ""string"",
  ""addresses"": {
    ""from"": ""string"",
    ""cc"": [
      ""string""
    ],
    ""bcc"": [
      ""string""
    ]
  }
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(EmailTemplateUpdateItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(EmailTemplateUpdateItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/emails/templates/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/emails/templates/{id}

Update an Email Template

POST https://api.moesif.com/v1/~/emails/templates/{id}

Example Request

{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}

Parameters

Name In Type Required Description
id path string true none
body body EmailTemplateUpdateItem true none

Responses

Status Meaning Description Schema
200 OK success None

getEmailTemplate

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/emails/templates/{id} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/emails/templates/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/emails/templates/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/emails/templates/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/emails/templates/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/emails/templates/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/emails/templates/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/emails/templates/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/emails/templates/{id}

Get Email Template

GET https://api.moesif.com/v1/~/emails/templates/{id}

Parameters

Name In Type Required Description
id path string true none

Responses

Status Meaning Description Schema
200 OK success None

deleteEmailTemplate

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/emails/templates/{id} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/emails/templates/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/emails/templates/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/emails/templates/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/emails/templates/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/emails/templates/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/emails/templates/{id}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/emails/templates/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/emails/templates/{id}

Delete Email Template

DELETE https://api.moesif.com/v1/~/emails/templates/{id}

Parameters

Name In Type Required Description
id path string true none

Responses

Status Meaning Description Schema
200 OK success None

Governance Rules

createGovernanceRule

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/governance/rules \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/governance/rules',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}

r = requests.post('https://api.moesif.com/v1/~/governance/rules', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}')

result = RestClient.post 'https://api.moesif.com/v1/~/governance/rules',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/governance/rules', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/governance/rules", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/governance/rules";

      string json = @"{
  ""name"": ""string"",
  ""priority"": 0,
  ""model"": ""string"",
  ""state"": 0,
  ""cohorts"": [
    {}
  ],
  ""variables"": [
    {
      ""name"": ""string"",
      ""path"": ""string""
    }
  ],
  ""applied_to"": ""string"",
  ""block"": true,
  ""response"": {
    ""status"": 0,
    ""headers"": null,
    ""body"": {},
    ""original_encoded_body"": ""string""
  },
  ""applied_to_unidentified"": true,
  ""regex_config"": [
    {
      ""conditions"": [
        {
          ""path"": ""string"",
          ""value"": ""string""
        }
      ],
      ""sample_rate"": 0
    }
  ],
  ""plans"": [
    {
      ""provider"": ""string"",
      ""plan_id"": ""string"",
      ""price_ids"": [
        ""string""
      ]
    }
  ],
  ""type"": ""string""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(GovernanceRuleCreateItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(GovernanceRuleCreateItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/governance/rules");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/governance/rules

Create New Governance Rules

POST https://api.moesif.com/v1/~/governance/rules

Example Request

{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}

Parameters

Name In Type Required Description
body body GovernanceRuleCreateItem true none

Example responses

201 Response

{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "_id": "string",
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "created_at": "2024-04-11T04:01:35.090Z",
  "app_id": "string",
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string",
  "org_id": "string"
}

Responses

Status Meaning Description Schema
201 Created success GovernanceRulesDocument

getGovernanceRules

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/governance/rules \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/governance/rules',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/governance/rules', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/governance/rules',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/governance/rules', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/governance/rules")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/governance/rules";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/governance/rules");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/governance/rules

Get Governance Rules

GET https://api.moesif.com/v1/~/governance/rules

Parameters

Name In Type Required Description

Example responses

200 Response

{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "_id": "string",
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "created_at": "2024-04-11T04:01:35.090Z",
  "app_id": "string",
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string",
  "org_id": "string"
}

Responses

Status Meaning Description Schema
200 OK success GovernanceRulesDocument

updateGovernanceRule

Code samples

# You can also use wget
curl -X POST https://api.moesif.com/v1/~/governance/rules/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

  -d '{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}' 
const fetch = require('node-fetch');
const inputBody = {
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/governance/rules/{id}',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
input_body = {
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}

r = requests.post('https://api.moesif.com/v1/~/governance/rules/{id}', headers = headers, json = input_body)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

input_payload = JSON.parse('{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}')

result = RestClient.post 'https://api.moesif.com/v1/~/governance/rules/{id}',
  params: {
  }, 
  payload: input_payload.to_json, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$inputPayload = json_decode('{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}')

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('POST','https://api.moesif.com/v1/~/governance/rules/{id}', array(
        'headers' => $headers,
        'json' => $inputPayload,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }
    jsonPayload := `{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}`
    data := bytes.NewBuffer([]byte(jsonPayload))
    req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/governance/rules/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }


    /// Make a dummy request
    public async Task MakePostRequest()
    {
      string url = "https://api.moesif.com/v1/~/governance/rules/{id}";

      string json = @"{
  ""name"": ""string"",
  ""priority"": 0,
  ""model"": ""string"",
  ""state"": 0,
  ""cohorts"": [
    {}
  ],
  ""variables"": [
    {
      ""name"": ""string"",
      ""path"": ""string""
    }
  ],
  ""applied_to"": ""string"",
  ""block"": true,
  ""response"": {
    ""status"": 0,
    ""headers"": null,
    ""body"": {},
    ""original_encoded_body"": ""string""
  },
  ""applied_to_unidentified"": true,
  ""regex_config"": [
    {
      ""conditions"": [
        {
          ""path"": ""string"",
          ""value"": ""string""
        }
      ],
      ""sample_rate"": 0
    }
  ],
  ""plans"": [
    {
      ""provider"": ""string"",
      ""plan_id"": ""string"",
      ""price_ids"": [
        ""string""
      ]
    }
  ],
  ""type"": ""string""
}";
      var content = JsonConvert.DeserializeObject(json);
      await PostAsync(content, url);


    }

    /// Performs a POST Request
    public async Task PostAsync(GovernanceRuleUpdateItem content, string url)
    {
        //Serialize Object
        StringContent jsonContent = SerializeObject(content);

        //Execute POST request
        HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
    }



    /// Serialize an object to Json
    private StringContent SerializeObject(GovernanceRuleUpdateItem content)
    {
        //Serialize Object
        string jsonObject = JsonConvert.SerializeObject(content);

        //Create Json UTF8 String Content
        return new StringContent(jsonObject, Encoding.UTF8, "application/json");
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/governance/rules/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");

con.setRequestProperty("Content-Type",'application/json');
con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

// Enable sending a request body
con.setDoOutput(true);

String jsonPayload = """{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}""";

// Write payload to the request
try(OutputStream os = con.getOutputStream()) {
    byte[] input = jsonPayload.getBytes("utf-8");
    os.write(input, 0, input.length);           
}

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /~/governance/rules/{id}

Update a Governance Rule

POST https://api.moesif.com/v1/~/governance/rules/{id}

Example Request

{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}

Parameters

Name In Type Required Description
id path string true none
body body GovernanceRuleUpdateItem true none

Example responses

201 Response

{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "_id": "string",
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "created_at": "2024-04-11T04:01:35.090Z",
  "app_id": "string",
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string",
  "org_id": "string"
}

Responses

Status Meaning Description Schema
201 Created success GovernanceRulesDocument

getGovernanceRule

Code samples

# You can also use wget
curl -X GET https://api.moesif.com/v1/~/governance/rules/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/governance/rules/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.get('https://api.moesif.com/v1/~/governance/rules/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.get 'https://api.moesif.com/v1/~/governance/rules/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://api.moesif.com/v1/~/governance/rules/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/governance/rules/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }

    /// Make a dummy request
    public async Task MakeGetRequest()
    {
      string url = "https://api.moesif.com/v1/~/governance/rules/{id}";
      var result = await GetAsync(url);
    }

    /// Performs a GET Request
    public async Task GetAsync(string url)
    {
        //Start the request
        HttpResponseMessage response = await Client.GetAsync(url);

        //Validate result
        response.EnsureSuccessStatusCode();

    }




    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/governance/rules/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");

con.setRequestProperty("Accept",'application/json');
con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /~/governance/rules/{id}

Get a Governance Rule

GET https://api.moesif.com/v1/~/governance/rules/{id}

Parameters

Name In Type Required Description
id path string true none

Example responses

200 Response

{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "_id": "string",
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "created_at": "2024-04-11T04:01:35.090Z",
  "app_id": "string",
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string",
  "org_id": "string"
}

Responses

Status Meaning Description Schema
200 OK success GovernanceRulesDocument

deleteGovernanceRule

Code samples

# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/governance/rules/{id} \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'

const fetch = require('node-fetch');

const headers = {
  'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};

fetch('https://api.moesif.com/v1/~/governance/rules/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}

r = requests.delete('https://api.moesif.com/v1/~/governance/rules/{id}', headers = headers)

print(r.json())

require 'rest-client'
require 'json'

headers = {
  'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}

result = RestClient.delete 'https://api.moesif.com/v1/~/governance/rules/{id}',
  params: {
  }, 
  headers: headers

p JSON.parse(result)

<?php

require 'vendor/autoload.php';

$headers = array(
    'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('DELETE','https://api.moesif.com/v1/~/governance/rules/{id}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
    }


    req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/governance/rules/{id}")
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
    private HttpClient Client { get; set; }

    /// <<summary>>
    /// Setup http client
    /// <</summary>>
    public HttpExample()
    {
      Client = new HttpClient();
    }




    /// Make a dummy request
    public async Task MakeDeleteRequest()
    {
      int id = 1;
      string url = "https://api.moesif.com/v1/~/governance/rules/{id}";

      await DeleteAsync(id, url);
    }

    /// Performs a DELETE Request
    public async Task DeleteAsync(int id, string url)
    {
        //Execute DELETE request
        HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");

        //Return response
        await DeserializeObject(response);
    }

    /// Deserialize object from request response
    private async Task DeserializeObject(HttpResponseMessage response)
    {
        //Read body 
        string responseBody = await response.Content.ReadAsStringAsync();

        //Deserialize Body to object
        var result = JsonConvert.DeserializeObject(responseBody);
    }
}

URL obj = new URL("https://api.moesif.com/v1/~/governance/rules/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");

con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY');

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

DELETE /~/governance/rules/{id}

Delete a Governance Rule

DELETE https://api.moesif.com/v1/~/governance/rules/{id}

Parameters

Name In Type Required Description
id path string true none

Responses

Status Meaning Description Schema
204 No Content success None

Schemas

StripeTier

{
  "flat_amount_decimal": "string",
  "up_to": 0,
  "unit_amount_decimal": "string",
  "flat_amount": 0,
  "unit_amount": 0
}

Properties

Name Type Required Restrictions Description
flat_amount_decimal string false none none
up_to integer(int64) false none none
unit_amount_decimal string false none none
flat_amount integer(int64) false none none
unit_amount integer(int64) false none none

CohortDocument

{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": "string",
  "_id": "string",
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "modified_at": "2024-04-11T04:01:35.090Z",
  "from": "string",
  "created_at": "2024-04-11T04:01:35.090Z",
  "app_id": "string",
  "cohort_type": "string",
  "time_zone": "string",
  "org_id": "string"
}

Properties

Name Type Required Restrictions Description
channels array[string] false none none
priority integer(int32) false none none
url_query string false none none
criteria string true none none
_id string false none none
sample_rate integer(int32) false none none
notification_rule NotificationRule false none none
cohort_name string true none none
to string false none none
week_starts_on integer(int32) false none none
locked_by string false none none
modified_at string(date-time) true none none
from string false none none
created_at string(date-time) true none none
app_id string true none none
cohort_type string true none none
time_zone string false none none
org_id string true none none

RulesResponseItem

{
  "status": 0,
  "headers": null,
  "body": {},
  "original_encoded_body": "string"
}

Properties

Name Type Required Restrictions Description
status integer(int32) false none none
headers .map[string,string] false none none
body object false none none
original_encoded_body string false none none

AppCreate

{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}

Properties

Name Type Required Restrictions Description
name string true none none
time_zone string false none none
week_starts_on integer(int32) false none none
custom_app_id string false none none

AppUpdate

{
  "name": "string",
  "time_zone": "string",
  "week_starts_on": 0,
  "custom_app_id": "string"
}

Properties

Name Type Required Restrictions Description
name string false none none
time_zone string false none none
week_starts_on integer(int32) false none none
custom_app_id string false none none

BillingReportUsageInvoice

{
  "period_start": "2024-04-11T04:01:35.090Z",
  "period_end": "2024-04-11T04:01:35.090Z",
  "id": "string"
}

Properties

Name Type Required Restrictions Description
period_start string(date-time) false none none
period_end string(date-time) false none none
id string true none none

CohortCreateItem

{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}

Properties

Name Type Required Restrictions Description
channels array[string] false none none
priority integer(int32) false none none
url_query string false none none
criteria object true none none
notification_rule NotificationRule false none none
cohort_name string true none none
to string false none none
week_starts_on integer(int32) false none none
locked_by string false none none
from string false none none
cohort_type string true none none
time_zone string false none none

CustomReportPlan

{
  "plan_id": "string"
}

Properties

Name Type Required Restrictions Description
plan_id string true none none

BillingReportUsage

{
  "invoice": {
    "period_start": "2024-04-11T04:01:35.090Z",
    "period_end": "2024-04-11T04:01:35.090Z",
    "id": "string"
  },
  "aggregator": "string"
}

Properties

Name Type Required Restrictions Description
invoice BillingReportUsageInvoice false none none
aggregator string false none none

BillingMetricResponse

{
  "buckets": [
    {
      "start": "2024-04-11T04:01:35.090Z",
      "metric": 0.1,
      "amounts": null,
      "ending_balance": {
        "current_balance": 0.1,
        "pending_activity": 0.1,
        "available_balance": 0.1
      }
    }
  ]
}

Properties

Name Type Required Restrictions Description
buckets [BillingMetricBucket] true none none

EmailAddresses

{
  "from": "string",
  "cc": [
    "string"
  ],
  "bcc": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
from string true none none
cc [string] true none none
bcc [string] true none none

Plan

{
  "provider": "string",
  "plan_id": "string",
  "price_ids": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
provider string true none none
plan_id string true none none
price_ids [string] true none none

SequenceItem

{
  "delay": 0,
  "submit_data": {
    "body": {},
    "url": "string",
    "params": [
      {
        "key": "string",
        "val": "string"
      }
    ],
    "verb": "string",
    "headers": [
      {
        "key": "string",
        "val": "string"
      }
    ]
  }
}

Properties

Name Type Required Restrictions Description
delay integer(int32) true none none
submit_data SubmitData true none none

Cohort

{
  "id": "string",
  "type": "string",
  "config": {
    "url_query": "string",
    "criteria": "string",
    "cohort_name": "string",
    "to": "string",
    "from": "string",
    "cohort_type": "string",
    "time_zone": "string"
  }
}

Properties

Name Type Required Restrictions Description
id string true none none
type string true none none
config CohortConfig false none none

BalanceChange

{
  "amount": 0.1
}

Properties

Name Type Required Restrictions Description
amount number(double) true none none

StripePrice

{
  "tiers_mode": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "price_id": "string",
  "tiers": [
    {
      "flat_amount_decimal": "string",
      "up_to": 0,
      "unit_amount_decimal": "string",
      "flat_amount": 0,
      "unit_amount": 0
    }
  ],
  "recurring": {
    "trial_period_days": 0,
    "interval": "string",
    "usage_type": "string",
    "interval_count": 0,
    "aggregate_usage": "string"
  },
  "unit_amount_decimal": "string",
  "price_nickname": "string",
  "currency": "string",
  "billing_scheme": "string",
  "unit_amount": 0,
  "created": 0,
  "active": true
}

Properties

Name Type Required Restrictions Description
tiers_mode string false none none
transform_quantity StripeTransformQuantity false none none
price_id string true none none
tiers [StripeTier] false none none
recurring StripeRecurring false none none
unit_amount_decimal string false none none
price_nickname string false none none
currency string false none none
billing_scheme string false none none
unit_amount integer(int64) false none none
created integer(int64) false none none
active boolean false none none

RegexCondition

{
  "path": "string",
  "value": "string"
}

Properties

Name Type Required Restrictions Description
path string true none none
value string true none none

TemplateConfig

{
  "subject": "string",
  "editor": "string",
  "design": {},
  "thumbnail_url": "string"
}

Properties

Name Type Required Restrictions Description
subject string true none none
editor string true none none
design object true none none
thumbnail_url string false none none

RecurlyCurrencyAmount

{
  "currency": "string",
  "unit_amount": null,
  "unit_amount_decimal": "string"
}

Properties

Name Type Required Restrictions Description
currency string true none none
unit_amount double false none none
unit_amount_decimal string false none none

MoesifTransformQuantity

{
  "divide_by": 0,
  "round": "string"
}

Properties

Name Type Required Restrictions Description
divide_by integer(int64) true none none
round string true none none

StripeRecurring

{
  "trial_period_days": 0,
  "interval": "string",
  "usage_type": "string",
  "interval_count": 0,
  "aggregate_usage": "string"
}

Properties

Name Type Required Restrictions Description
trial_period_days integer(int64) false none none
interval string false none none
usage_type string false none none
interval_count integer(int64) false none none
aggregate_usage string false none none

DashboardUpdateItem

{
  "parent": "string",
  "name": "string",
  "dashboard_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}

Properties

Name Type Required Restrictions Description
parent string false none none
name string false none none
dashboard_id string false none none
workspace_ids [array] false none none
sort_order number(double) false none none
dashboard_ids [string] false none none
policy PolicyItem false none none

Comments

{
  "summary": {
    "count": 0,
    "latest_comment": {
      "auth_user_id": "string",
      "comment_id": "string",
      "mentions": [
        "string"
      ],
      "partner_user_id": "string",
      "message": "string",
      "created_at": "2024-04-11T04:01:35.090Z",
      "updated_at": "2024-04-11T04:01:35.090Z"
    }
  }
}

Properties

Name Type Required Restrictions Description
summary Summary true none none

SignedToken

{
  "_id": "string",
  "token": "string",
  "url": "string"
}

Properties

Name Type Required Restrictions Description
_id string true none none
token string true none none
url string false none none

ChargebeeItemPrice

{
  "name": "string",
  "item_id": "string",
  "description": "string",
  "price": 0,
  "price_in_decimal": "string",
  "external_name": "string",
  "tiers": [
    {
      "starting_unit": 0,
      "ending_unit": 0,
      "price": 0
    }
  ],
  "trial_end_action": "string",
  "trial_period": 0,
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "created_at": 0,
  "period_unit": "string",
  "updated_at": 0,
  "trial_period_unit": "string",
  "item_type": "string",
  "currency_code": "string",
  "archived_at": 0,
  "free_quantity": 0,
  "period": 0
}

Properties

Name Type Required Restrictions Description
name string false none none
item_id string false none none
description string false none none
price integer(int64) false none none
price_in_decimal string false none none
external_name string false none none
tiers [ChargebeeItemPriceTier] false none none
trial_end_action string false none none
trial_period integer(int64) false none none
id string true none none
status string false none none
pricing_model string false none none
created_at integer(int64) false none none
period_unit string false none none
updated_at integer(int64) false none none
trial_period_unit string false none none
item_type string false none none
currency_code string false none none
archived_at integer(int64) false none none
free_quantity integer(int64) false none none
period integer(int64) false none none

MoesifPrice

{
  "name": "string",
  "transform_quantity": {
    "divide_by": 0,
    "round": "string"
  },
  "provider": "string",
  "price_in_decimal": "string",
  "tiers": [
    {
      "up_to": null,
      "unit_price_in_decimal": "string",
      "flat_price_in_decimal": "string"
    }
  ],
  "period_units": "string",
  "plan_id": "string",
  "id": "string",
  "status": "string",
  "pricing_model": "string",
  "tax_behavior": "string",
  "currency": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "usage_aggregator": "string",
  "period": 0
}

Properties

Name Type Required Restrictions Description
name string false none none
transform_quantity MoesifTransformQuantity false none none
provider string false none none
price_in_decimal string false none none
tiers [MoesifPriceTier] false none none
period_units string false none none
plan_id string false none none
id string false none none
status string false none none
pricing_model string false none none
tax_behavior string false none none
currency string false none none
metadata .map[string,string] false none none
created_at string(date-time) false none none
unit string false none none
usage_aggregator string false none none
period integer(int64) false none none

EmailTemplateCreateItem

{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}

Properties

Name Type Required Restrictions Description
name string true none none
state integer(int32) true none none
cohorts [Cohort] true none none
dynamic_fields [DynamicField] false none none
content TemplateContent true none none
template TemplateConfig true none none
period string false none none
addresses EmailAddresses true none none

PolicyItem

{
  "acl": [
    {
      "grantee": "string",
      "permission": "string"
    }
  ],
  "resource": {},
  "api_scopes": [
    "string"
  ],
  "original_encoded_resource": "string"
}

Properties

Name Type Required Restrictions Description
acl [ACLItem] true none none
resource object true none none
api_scopes [string] false none none
original_encoded_resource string false none none

RecurlyAddOnPercentageTier

{
  "ending_amount": null,
  "usage_percent": "string"
}

Properties

Name Type Required Restrictions Description
ending_amount double false none none
usage_percent string false none none

StripeTransformQuantity

{
  "divide_by": 0,
  "round": "string"
}

Properties

Name Type Required Restrictions Description
divide_by integer(int64) false none none
round string false none none

BillingMetricBucket

{
  "start": "2024-04-11T04:01:35.090Z",
  "metric": 0.1,
  "amounts": null,
  "ending_balance": {
    "current_balance": 0.1,
    "pending_activity": 0.1,
    "available_balance": 0.1
  }
}

Properties

Name Type Required Restrictions Description
start string(date-time) true none none
metric number(double) false none none
amounts .map[string,scala.double] false none none
ending_balance CreditBalanceMetric false none none

DashboardDocument

{
  "parent": "string",
  "name": "string",
  "_id": "string",
  "auth_user_id": "string",
  "profile_view_promotion": "string",
  "app_id": "string",
  "workspace_ids": [
    [
      "string"
    ]
  ],
  "sort_order": 0.1,
  "dashboard_ids": [
    "string"
  ],
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  },
  "org_id": "string",
  "migration": {},
  "created": "2024-04-11T04:01:35.090Z"
}

Properties

Name Type Required Restrictions Description
parent string false none none
name string true none none
_id string false none none
auth_user_id string true none none
profile_view_promotion string false none none
app_id string true none none
workspace_ids [array] true none none
sort_order number(double) false none none
dashboard_ids [string] true none none
policy PolicyItem false none none
org_id string true none none
migration object false none none
created string(date-time) true none none

ChargebeeItemPlan

{
  "name": "string",
  "item_family_id": "string",
  "description": "string",
  "usage_calculation": "string",
  "external_name": "string",
  "metered": true,
  "id": "string",
  "status": "string",
  "unit": "string",
  "updated_at": 0,
  "archived_at": 0
}

Properties

Name Type Required Restrictions Description
name string false none none
item_family_id string false none none
description string false none none
usage_calculation string false none none
external_name string false none none
metered boolean false none none
id string true none none
status string false none none
unit string false none none
updated_at integer(int64) false none none
archived_at integer(int64) false none none

CreditBalanceMetric

{
  "current_balance": 0.1,
  "pending_activity": 0.1,
  "available_balance": 0.1
}

Properties

Name Type Required Restrictions Description
current_balance number(double) true none none
pending_activity number(double) true none none
available_balance number(double) true none none

CreateCommentItem

{
  "auth_user_id": "string",
  "comment_id": "string",
  "mentions": [
    "string"
  ],
  "partner_user_id": "string",
  "message": "string",
  "created_at": "2024-04-11T04:01:35.090Z",
  "updated_at": "2024-04-11T04:01:35.090Z"
}

Properties

Name Type Required Restrictions Description
auth_user_id string false none none
comment_id string false none none
mentions [string] false none none
partner_user_id string false none none
message string false none none
created_at string(date-time) false none none
updated_at string(date-time) false none none

StripeBillingParams

{
  "product": {
    "name": "string",
    "description": "string",
    "unit_label": "string",
    "id": "string",
    "usage_type": "string"
  },
  "price": {
    "tiers_mode": "string",
    "transform_quantity": {
      "divide_by": 0,
      "round": "string"
    },
    "price_id": "string",
    "tiers": [
      {
        "flat_amount_decimal": "string",
        "up_to": 0,
        "unit_amount_decimal": "string",
        "flat_amount": 0,
        "unit_amount": 0
      }
    ],
    "recurring": {
      "trial_period_days": 0,
      "interval": "string",
      "usage_type": "string",
      "interval_count": 0,
      "aggregate_usage": "string"
    },
    "unit_amount_decimal": "string",
    "price_nickname": "string",
    "currency": "string",
    "billing_scheme": "string",
    "unit_amount": 0,
    "created": 0,
    "active": true
  },
  "prices": [
    {
      "tiers_mode": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "price_id": "string",
      "tiers": [
        {
          "flat_amount_decimal": "string",
          "up_to": 0,
          "unit_amount_decimal": "string",
          "flat_amount": 0,
          "unit_amount": 0
        }
      ],
      "recurring": {
        "trial_period_days": 0,
        "interval": "string",
        "usage_type": "string",
        "interval_count": 0,
        "aggregate_usage": "string"
      },
      "unit_amount_decimal": "string",
      "price_nickname": "string",
      "currency": "string",
      "billing_scheme": "string",
      "unit_amount": 0,
      "created": 0,
      "active": true
    }
  ],
  "reporting": {
    "reporting_period": "string"
  }
}

Properties

Name Type Required Restrictions Description
product StripeProduct false none none
price StripePrice false none none
prices [StripePrice] false none none
reporting ProviderReporting false none none

TemplateContent

{
  "html": "string",
  "chunks": {}
}

Properties

Name Type Required Restrictions Description
html string true none none
chunks object true none none

DynamicField

{
  "token": "string",
  "field": "string",
  "aggregator": "avg"
}

Properties

Name Type Required Restrictions Description
token string true none none
field string true none none
aggregator string true none none

Enumerated Values

Property Value
aggregator avg
aggregator min
aggregator max
aggregator terms
aggregator sum

BillingReportBalanceTransCreate

{
  "company_id": "string",
  "description": "string",
  "expire_at": "2024-04-11T04:01:35.090Z",
  "active_at": "2024-04-11T04:01:35.090Z",
  "amount": 0.1,
  "transaction_id": "string",
  "subscription_id": "string",
  "type": "string"
}

Properties

Name Type Required Restrictions Description
company_id string true none none
description string false none none
expire_at string(date-time) false none none
active_at string(date-time) false none none
amount number(double) true none none
transaction_id string true none none
subscription_id string true none none
type string true none none

WorkspaceCreateItem

{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "dashboard": {},
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}

Properties

Name Type Required Restrictions Description
name string true none none
is_default boolean false none none
view_count integer(int32) false none none
dashboard object false none none
colors object false none none
drawings [DrawingItem] false none none
chart ChartItem true none none
template TemplateItem false none none
type string false none none
width number(double) false none none
sort_order number(double) false none none
policy PolicyItem true none none

RecurlyAddOnTier

{
  "ending_quantity": 0,
  "currencies": [
    {
      "currency": "string",
      "unit_amount": null,
      "unit_amount_decimal": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
ending_quantity integer(int64) false none none
currencies [RecurlyCurrencyAmount] true none none

CreditBalance

{
  "sequence_id": 0,
  "current_balance": 0.1,
  "pending_activity": 0.1,
  "available_balance": 0.1
}

Properties

Name Type Required Restrictions Description
sequence_id integer(int32) true none none
current_balance number(double) true none none
pending_activity number(double) true none none
available_balance number(double) true none none

ChargebeeItemPriceTier

{
  "starting_unit": 0,
  "ending_unit": 0,
  "price": 0
}

Properties

Name Type Required Restrictions Description
starting_unit integer(int32) true none none
ending_unit integer(int32) false none none
price integer(int32) true none none

MoesifPlan

{
  "name": "string",
  "prices": [
    {
      "name": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "provider": "string",
      "price_in_decimal": "string",
      "tiers": [
        {
          "up_to": null,
          "unit_price_in_decimal": "string",
          "flat_price_in_decimal": "string"
        }
      ],
      "period_units": "string",
      "plan_id": "string",
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "tax_behavior": "string",
      "currency": "string",
      "metadata": null,
      "created_at": "2024-04-11T04:01:35.090Z",
      "unit": "string",
      "usage_aggregator": "string",
      "period": 0
    }
  ],
  "provider": "string",
  "description": "string",
  "id": "string",
  "status": "string",
  "product_id": "string",
  "metadata": null,
  "created_at": "2024-04-11T04:01:35.090Z",
  "unit": "string",
  "updated_at": "2024-04-11T04:01:35.090Z"
}

Properties

Name Type Required Restrictions Description
name string false none none
prices [MoesifPrice] false none none
provider string false none none
description string false none none
id string false none none
status string false none none
product_id string false none none
metadata .map[string,string] false none none
created_at string(date-time) false none none
unit string false none none
updated_at string(date-time) false none none

ChargebeeBillingParams

{
  "item_plan": {
    "name": "string",
    "item_family_id": "string",
    "description": "string",
    "usage_calculation": "string",
    "external_name": "string",
    "metered": true,
    "id": "string",
    "status": "string",
    "unit": "string",
    "updated_at": 0,
    "archived_at": 0
  },
  "item_price": {
    "name": "string",
    "item_id": "string",
    "description": "string",
    "price": 0,
    "price_in_decimal": "string",
    "external_name": "string",
    "tiers": [
      {
        "starting_unit": 0,
        "ending_unit": 0,
        "price": 0
      }
    ],
    "trial_end_action": "string",
    "trial_period": 0,
    "id": "string",
    "status": "string",
    "pricing_model": "string",
    "created_at": 0,
    "period_unit": "string",
    "updated_at": 0,
    "trial_period_unit": "string",
    "item_type": "string",
    "currency_code": "string",
    "archived_at": 0,
    "free_quantity": 0,
    "period": 0
  },
  "item_prices": [
    {
      "name": "string",
      "item_id": "string",
      "description": "string",
      "price": 0,
      "price_in_decimal": "string",
      "external_name": "string",
      "tiers": [
        {
          "starting_unit": 0,
          "ending_unit": 0,
          "price": 0
        }
      ],
      "trial_end_action": "string",
      "trial_period": 0,
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "created_at": 0,
      "period_unit": "string",
      "updated_at": 0,
      "trial_period_unit": "string",
      "item_type": "string",
      "currency_code": "string",
      "archived_at": 0,
      "free_quantity": 0,
      "period": 0
    }
  ],
  "reporting": {
    "reporting_period": "string"
  }
}

Properties

Name Type Required Restrictions Description
item_plan ChargebeeItemPlan false none none
item_price ChargebeeItemPrice false none none
item_prices [ChargebeeItemPrice] false none none
reporting ProviderReporting false none none

GovernanceRuleCreateItem

{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}

Properties

Name Type Required Restrictions Description
name string true none none
priority integer(int32) false none none
model string false none none
state integer(int32) true none none
cohorts [object] false none none
variables [GovernanceRulesVariables] false none none
applied_to string false none none
block boolean true none none
response RulesResponseItem false none none
applied_to_unidentified boolean false none none
regex_config [RegexRule] false none none
plans [Plan] false none none
type string true none none

RecurlyPlanAddOn

{
  "name": "string",
  "currencies": [
    {
      "currency": "string",
      "unit_amount": null,
      "unit_amount_decimal": "string"
    }
  ],
  "usage_percentage": null,
  "add_on_type": "string",
  "external_sku": "string",
  "state": "string",
  "tiers": [
    {
      "ending_quantity": 0,
      "currencies": [
        {
          "currency": "string",
          "unit_amount": null,
          "unit_amount_decimal": "string"
        }
      ]
    }
  ],
  "tier_type": "string",
  "code": "string",
  "plan_id": "string",
  "id": "string",
  "percentage_tiers": [
    {
      "tiers": [
        {
          "ending_amount": null,
          "usage_percent": "string"
        }
      ],
      "currency": "string"
    }
  ],
  "usage_type": "string",
  "created_at": "string",
  "usage_calculation_type": "string",
  "updated_at": "string",
  "deleted_at": "string"
}

Properties

Name Type Required Restrictions Description
name string false none none
currencies [RecurlyCurrencyAmount] false none none
usage_percentage double false none none
add_on_type string false none none
external_sku string false none none
state string false none none
tiers [RecurlyAddOnTier] false none none
tier_type string false none none
code string true none none
plan_id string false none none
id string false none none
percentage_tiers [RecurlyAddOnPercentageTiers] false none none
usage_type string false none none
created_at string false none none
usage_calculation_type string false none none
updated_at string false none none
deleted_at string false none none

DrawingItem

{
  "name": "string",
  "direction": "string",
  "id": "string",
  "type": "string",
  "value": 0.1
}

Properties

Name Type Required Restrictions Description
name string true none none
direction string true none none
id string true none none
type string true none none
value number(double) true none none

ChartItem

{
  "original_encoded_view_elements": "string",
  "funnel_query": {},
  "url_query": "string",
  "to": "string",
  "view_elements": {},
  "from": "string",
  "original_encoded_funnel_query": "string",
  "es_query": {},
  "args": "string",
  "original_encoded_query": "string",
  "time_zone": "string",
  "view": "string"
}

Properties

Name Type Required Restrictions Description
original_encoded_view_elements string false none none
funnel_query object false none none
url_query string true none none
to string false none none
view_elements object false none none
from string false none none
original_encoded_funnel_query string false none none
es_query object false none none
args string false none none
original_encoded_query string false none none
time_zone string false none none
view string true none none

RecurlyAddOnPercentageTiers

{
  "tiers": [
    {
      "ending_amount": null,
      "usage_percent": "string"
    }
  ],
  "currency": "string"
}

Properties

Name Type Required Restrictions Description
tiers [RecurlyAddOnPercentageTier] false none none
currency string false none none

CustomReporting

{
  "report_when": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
report_when [string] true none none

BillingReport

{
  "ending_balance": {
    "sequence_id": 0,
    "current_balance": 0.1,
    "pending_activity": 0.1,
    "available_balance": 0.1
  },
  "company_id": "string",
  "success": true,
  "provider": "string",
  "report_version": 0,
  "usage_end_time": "2024-04-11T04:01:35.090Z",
  "usage": {
    "invoice": {
      "period_start": "2024-04-11T04:01:35.090Z",
      "period_end": "2024-04-11T04:01:35.090Z",
      "id": "string"
    },
    "aggregator": "string"
  },
  "_id": "string",
  "meter_usage": 0,
  "last_success_time": "2024-04-11T04:01:35.090Z",
  "beginning_balance": {
    "sequence_id": 0,
    "current_balance": 0.1,
    "pending_activity": 0.1,
    "available_balance": 0.1
  },
  "billing_meter_id": "string",
  "amount": 0.1,
  "usage_start_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "provider_requests": [
    {
      "success": true,
      "status_code": 0,
      "job_id": "string",
      "error_message": "string",
      "error_code": "string",
      "request_time": "2024-04-11T04:01:35.090Z"
    }
  ],
  "currency": "string",
  "report_total_usage": 0,
  "channel_requests": [
    {
      "channel_id": "string",
      "channel_name": "string",
      "provider_requests": [
        {
          "success": true,
          "status_code": 0,
          "job_id": "string",
          "error_message": "string",
          "error_code": "string",
          "request_time": "2024-04-11T04:01:35.090Z"
        }
      ]
    }
  ],
  "created_at": "2024-04-11T04:01:35.090Z",
  "app_id": "string",
  "subscription_id": "string",
  "subscription_period_start": "2024-04-11T04:01:35.090Z",
  "balance_changes": [
    {
      "amount": 0.1
    }
  ],
  "type": "string",
  "updated_at": "2024-04-11T04:01:35.090Z",
  "org_id": "string",
  "subscription_period_end": "2024-04-11T04:01:35.090Z",
  "meter_metric": 0
}

Properties

Name Type Required Restrictions Description
ending_balance CreditBalance false none none
company_id string true none none
success boolean true none none
provider string true none none
report_version integer(int32) false none none
usage_end_time string(date-time) true none none
usage BillingReportUsage false none none
_id string false none none
meter_usage integer(int64) true none none
last_success_time string(date-time) false none none
beginning_balance CreditBalance false none none
billing_meter_id string true none none
amount number(double) false none none
usage_start_time string(date-time) true none none
status string false none none
provider_requests [ProviderRequest] true none none
currency string false none none
report_total_usage integer(int64) true none none
channel_requests [ChannelRequest] false none none
created_at string(date-time) false none none
app_id string true none none
subscription_id string true none none
subscription_period_start string(date-time) false none none
balance_changes [BalanceChange] false none none
type string false none none
updated_at string(date-time) false none none
org_id string true none none
subscription_period_end string(date-time) false none none
meter_metric integer(int64) true none none

ACLItem

{
  "grantee": "string",
  "permission": "string"
}

Properties

Name Type Required Restrictions Description
grantee string true none none
permission string true none none

ZuoraBillingParams

{
  "plan_id": "string",
  "price_id": "string",
  "price_ids": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
plan_id string false none none
price_id string false none none
price_ids [string] false none none

CohortConfig

{
  "url_query": "string",
  "criteria": "string",
  "cohort_name": "string",
  "to": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}

Properties

Name Type Required Restrictions Description
url_query string true none none
criteria string true none none
cohort_name string true none none
to string true none none
from string true none none
cohort_type string true none none
time_zone string true none none

RegexRule

{
  "conditions": [
    {
      "path": "string",
      "value": "string"
    }
  ],
  "sample_rate": 0
}

Properties

Name Type Required Restrictions Description
conditions [RegexCondition] true none none
sample_rate integer(int32) false none none

GovernanceRulesVariables

{
  "name": "string",
  "path": "string"
}

Properties

Name Type Required Restrictions Description
name string true none none
path string true none none

ChannelRequest

{
  "channel_id": "string",
  "channel_name": "string",
  "provider_requests": [
    {
      "success": true,
      "status_code": 0,
      "job_id": "string",
      "error_message": "string",
      "error_code": "string",
      "request_time": "2024-04-11T04:01:35.090Z"
    }
  ]
}

Properties

Name Type Required Restrictions Description
channel_id string true none none
channel_name string true none none
provider_requests [ProviderRequest] true none none

WorkspaceDocument

{
  "name": "string",
  "is_default": true,
  "view_count": 0,
  "_id": "string",
  "is_template": true,
  "dashboard": {},
  "auth_user_id": "string",
  "colors": {},
  "sequence": [
    {
      "delay": 0,
      "submit_data": {
        "body": {},
        "url": "string",
        "params": [
          {
            "key": null,
            "val": null
          }
        ],
        "verb": "string",
        "headers": [
          {
            "key": null,
            "val": null
          }
        ]
      }
    }
  ],
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "app_id": "string",
  "type": "string",
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  },
  "org_id": "string",
  "migration": {},
  "created": "2024-04-11T04:01:35.090Z",
  "comments": {
    "summary": {
      "count": 0,
      "latest_comment": {
        "auth_user_id": "string",
        "comment_id": "string",
        "mentions": [
          "string"
        ],
        "partner_user_id": "string",
        "message": "string",
        "created_at": "2024-04-11T04:01:35.090Z",
        "updated_at": "2024-04-11T04:01:35.090Z"
      }
    }
  }
}

Properties

Name Type Required Restrictions Description
name string false none none
is_default boolean false none none
view_count integer(int32) true none none
_id string false none none
is_template boolean false none none
dashboard object false none none
auth_user_id string true none none
colors object false none none
sequence [SequenceItem] false none none
drawings [DrawingItem] false none none
chart ChartItem false none none
template TemplateItem false none none
app_id string true none none
type string false none none
width number(double) false none none
sort_order number(double) false none none
policy PolicyItem false none none
org_id string true none none
migration object false none none
created string(date-time) true none none
comments Comments false none none

MoesifPriceTier

{
  "up_to": null,
  "unit_price_in_decimal": "string",
  "flat_price_in_decimal": "string"
}

Properties

Name Type Required Restrictions Description
up_to util.either[scala.long,string] true none none
unit_price_in_decimal string false none none
flat_price_in_decimal string false none none

BillingMeterDocument

{
  "name": "string",
  "billing_plan": {
    "provider_slug": "string",
    "friendly_name": "string",
    "params": {
      "usage_rounding_mode": "string",
      "webhook_params": {
        "reporting": {
          "report_when": null
        },
        "channel_ids": [
          "string"
        ],
        "custom_plan": {
          "plan_id": null
        }
      },
      "recurly_params": {
        "plan": {
          "name": null,
          "id": null,
          "code": null
        },
        "add_on": {
          "name": null,
          "currencies": null,
          "usage_percentage": null,
          "add_on_type": null,
          "external_sku": null,
          "state": null,
          "tiers": null,
          "tier_type": null,
          "code": null,
          "plan_id": null,
          "id": null,
          "percentage_tiers": null,
          "usage_type": null,
          "created_at": null,
          "usage_calculation_type": null,
          "updated_at": null,
          "deleted_at": null
        },
        "add_ons": [
          {}
        ]
      },
      "chargebee_params": {
        "item_plan": {
          "name": null,
          "item_family_id": null,
          "description": null,
          "usage_calculation": null,
          "external_name": null,
          "metered": null,
          "id": null,
          "status": null,
          "unit": null,
          "updated_at": null,
          "archived_at": null
        },
        "item_price": {
          "name": null,
          "item_id": null,
          "description": null,
          "price": null,
          "price_in_decimal": null,
          "external_name": null,
          "tiers": null,
          "trial_end_action": null,
          "trial_period": null,
          "id": null,
          "status": null,
          "pricing_model": null,
          "created_at": null,
          "period_unit": null,
          "updated_at": null,
          "trial_period_unit": null,
          "item_type": null,
          "currency_code": null,
          "archived_at": null,
          "free_quantity": null,
          "period": null
        },
        "item_prices": [
          {}
        ],
        "reporting": {
          "reporting_period": null
        }
      },
      "stripe_params": {
        "product": {
          "name": null,
          "description": null,
          "unit_label": null,
          "id": null,
          "usage_type": null
        },
        "price": {
          "tiers_mode": null,
          "transform_quantity": null,
          "price_id": null,
          "tiers": null,
          "recurring": null,
          "unit_amount_decimal": null,
          "price_nickname": null,
          "currency": null,
          "billing_scheme": null,
          "unit_amount": null,
          "created": null,
          "active": null
        },
        "prices": [
          {}
        ],
        "reporting": {
          "reporting_period": null
        }
      },
      "zuora_params": {
        "plan_id": "string",
        "price_id": "string",
        "price_ids": [
          "string"
        ]
      },
      "usage_multiplier": null
    }
  },
  "url_query": "string",
  "_id": "string",
  "slug": "string",
  "status": "string",
  "modified_at": "2024-04-11T04:01:35.090Z",
  "es_query": "string",
  "created_at": "2024-04-11T04:01:35.090Z",
  "zero_balance_behavior": "string",
  "app_id": "string",
  "org_id": "string"
}

Properties

Name Type Required Restrictions Description
name string true none none
billing_plan BillingPlan true none none
url_query string true none none
_id string false none none
slug string true none none
status string true none none
modified_at string(date-time) true none none
es_query string true none none
created_at string(date-time) true none none
zero_balance_behavior string false none none
app_id string true none none
org_id string true none none

KeyValuePair

{
  "key": "string",
  "val": "string"
}

Properties

Name Type Required Restrictions Description
key string true none none
val string true none none

ProviderReporting

{
  "reporting_period": "string"
}

Properties

Name Type Required Restrictions Description
reporting_period string false none none

AppResponse

{
  "name": "string",
  "custom_app_id": "string",
  "search_api_base_url": "string",
  "week_starts_on": 0,
  "id": "string",
  "portal_api_base_url": "string",
  "secure_proxy": true,
  "time_zone": "string"
}

Properties

Name Type Required Restrictions Description
name string true none none
custom_app_id string false none none
search_api_base_url string false none none
week_starts_on integer(int32) false none none
id string false none none
portal_api_base_url string false none none
secure_proxy boolean false none none
time_zone string false none none

CohortUpdateItem

{
  "channels": null,
  "priority": 0,
  "url_query": "string",
  "criteria": {},
  "sample_rate": 0,
  "notification_rule": {
    "send_on_addition": true,
    "send_on_removal": true,
    "period": "string",
    "fields": [
      "string"
    ]
  },
  "cohort_name": "string",
  "to": "string",
  "week_starts_on": 0,
  "locked_by": "string",
  "from": "string",
  "cohort_type": "string",
  "time_zone": "string"
}

Properties

Name Type Required Restrictions Description
channels array[string] false none none
priority integer(int32) false none none
url_query string false none none
criteria object false none none
sample_rate integer(int32) false none none
notification_rule NotificationRule false none none
cohort_name string false none none
to string false none none
week_starts_on integer(int32) false none none
locked_by string false none none
from string false none none
cohort_type string true none none
time_zone string false none none

EmailTemplateUpdateItem

{
  "name": "string",
  "state": 0,
  "cohorts": [
    {
      "id": "string",
      "type": "string",
      "config": {
        "url_query": "string",
        "criteria": "string",
        "cohort_name": "string",
        "to": "string",
        "from": "string",
        "cohort_type": "string",
        "time_zone": "string"
      }
    }
  ],
  "dynamic_fields": [
    {
      "token": "string",
      "field": "string",
      "aggregator": "avg"
    }
  ],
  "content": {
    "html": "string",
    "chunks": {}
  },
  "template": {
    "subject": "string",
    "editor": "string",
    "design": {},
    "thumbnail_url": "string"
  },
  "period": "string",
  "addresses": {
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ]
  }
}

Properties

Name Type Required Restrictions Description
name string false none none
state integer(int32) false none none
cohorts [Cohort] false none none
dynamic_fields [DynamicField] false none none
content TemplateContent false none none
template TemplateConfig false none none
period string false none none
addresses EmailAddresses false none none

RecurlyPlan

{
  "name": "string",
  "id": "string",
  "code": "string"
}

Properties

Name Type Required Restrictions Description
name string false none none
id string false none none
code string true none none

StripeProduct

{
  "name": "string",
  "description": "string",
  "unit_label": "string",
  "id": "string",
  "usage_type": "string"
}

Properties

Name Type Required Restrictions Description
name string true none none
description string false none none
unit_label string false none none
id string true none none
usage_type string false none none

BillingParams

{
  "usage_rounding_mode": "string",
  "webhook_params": {
    "reporting": {
      "report_when": [
        "string"
      ]
    },
    "channel_ids": [
      "string"
    ],
    "custom_plan": {
      "plan_id": "string"
    }
  },
  "recurly_params": {
    "plan": {
      "name": "string",
      "id": "string",
      "code": "string"
    },
    "add_on": {
      "name": "string",
      "currencies": [
        {
          "currency": "string",
          "unit_amount": null,
          "unit_amount_decimal": "string"
        }
      ],
      "usage_percentage": null,
      "add_on_type": "string",
      "external_sku": "string",
      "state": "string",
      "tiers": [
        {
          "ending_quantity": 0,
          "currencies": [
            null
          ]
        }
      ],
      "tier_type": "string",
      "code": "string",
      "plan_id": "string",
      "id": "string",
      "percentage_tiers": [
        {
          "tiers": [
            null
          ],
          "currency": "string"
        }
      ],
      "usage_type": "string",
      "created_at": "string",
      "usage_calculation_type": "string",
      "updated_at": "string",
      "deleted_at": "string"
    },
    "add_ons": [
      {
        "name": "string",
        "currencies": [
          {
            "currency": null,
            "unit_amount": null,
            "unit_amount_decimal": null
          }
        ],
        "usage_percentage": null,
        "add_on_type": "string",
        "external_sku": "string",
        "state": "string",
        "tiers": [
          {
            "ending_quantity": null,
            "currencies": null
          }
        ],
        "tier_type": "string",
        "code": "string",
        "plan_id": "string",
        "id": "string",
        "percentage_tiers": [
          {
            "tiers": null,
            "currency": null
          }
        ],
        "usage_type": "string",
        "created_at": "string",
        "usage_calculation_type": "string",
        "updated_at": "string",
        "deleted_at": "string"
      }
    ]
  },
  "chargebee_params": {
    "item_plan": {
      "name": "string",
      "item_family_id": "string",
      "description": "string",
      "usage_calculation": "string",
      "external_name": "string",
      "metered": true,
      "id": "string",
      "status": "string",
      "unit": "string",
      "updated_at": 0,
      "archived_at": 0
    },
    "item_price": {
      "name": "string",
      "item_id": "string",
      "description": "string",
      "price": 0,
      "price_in_decimal": "string",
      "external_name": "string",
      "tiers": [
        {
          "starting_unit": 0,
          "ending_unit": 0,
          "price": 0
        }
      ],
      "trial_end_action": "string",
      "trial_period": 0,
      "id": "string",
      "status": "string",
      "pricing_model": "string",
      "created_at": 0,
      "period_unit": "string",
      "updated_at": 0,
      "trial_period_unit": "string",
      "item_type": "string",
      "currency_code": "string",
      "archived_at": 0,
      "free_quantity": 0,
      "period": 0
    },
    "item_prices": [
      {
        "name": "string",
        "item_id": "string",
        "description": "string",
        "price": 0,
        "price_in_decimal": "string",
        "external_name": "string",
        "tiers": [
          {
            "starting_unit": null,
            "ending_unit": null,
            "price": null
          }
        ],
        "trial_end_action": "string",
        "trial_period": 0,
        "id": "string",
        "status": "string",
        "pricing_model": "string",
        "created_at": 0,
        "period_unit": "string",
        "updated_at": 0,
        "trial_period_unit": "string",
        "item_type": "string",
        "currency_code": "string",
        "archived_at": 0,
        "free_quantity": 0,
        "period": 0
      }
    ],
    "reporting": {
      "reporting_period": "string"
    }
  },
  "stripe_params": {
    "product": {
      "name": "string",
      "description": "string",
      "unit_label": "string",
      "id": "string",
      "usage_type": "string"
    },
    "price": {
      "tiers_mode": "string",
      "transform_quantity": {
        "divide_by": 0,
        "round": "string"
      },
      "price_id": "string",
      "tiers": [
        {
          "flat_amount_decimal": "string",
          "up_to": 0,
          "unit_amount_decimal": "string",
          "flat_amount": 0,
          "unit_amount": 0
        }
      ],
      "recurring": {
        "trial_period_days": 0,
        "interval": "string",
        "usage_type": "string",
        "interval_count": 0,
        "aggregate_usage": "string"
      },
      "unit_amount_decimal": "string",
      "price_nickname": "string",
      "currency": "string",
      "billing_scheme": "string",
      "unit_amount": 0,
      "created": 0,
      "active": true
    },
    "prices": [
      {
        "tiers_mode": "string",
        "transform_quantity": {
          "divide_by": 0,
          "round": "string"
        },
        "price_id": "string",
        "tiers": [
          {
            "flat_amount_decimal": null,
            "up_to": null,
            "unit_amount_decimal": null,
            "flat_amount": null,
            "unit_amount": null
          }
        ],
        "recurring": {
          "trial_period_days": 0,
          "interval": "string",
          "usage_type": "string",
          "interval_count": 0,
          "aggregate_usage": "string"
        },
        "unit_amount_decimal": "string",
        "price_nickname": "string",
        "currency": "string",
        "billing_scheme": "string",
        "unit_amount": 0,
        "created": 0,
        "active": true
      }
    ],
    "reporting": {
      "reporting_period": "string"
    }
  },
  "zuora_params": {
    "plan_id": "string",
    "price_id": "string",
    "price_ids": [
      "string"
    ]
  },
  "usage_multiplier": null
}

Properties

Name Type Required Restrictions Description
usage_rounding_mode string false none none
webhook_params BillingWebhookParams false none none
recurly_params RecurlyBillingParams false none none
chargebee_params ChargebeeBillingParams false none none
stripe_params StripeBillingParams false none none
zuora_params ZuoraBillingParams false none none
usage_multiplier double false none none

RecurlyBillingParams

{
  "plan": {
    "name": "string",
    "id": "string",
    "code": "string"
  },
  "add_on": {
    "name": "string",
    "currencies": [
      {
        "currency": "string",
        "unit_amount": null,
        "unit_amount_decimal": "string"
      }
    ],
    "usage_percentage": null,
    "add_on_type": "string",
    "external_sku": "string",
    "state": "string",
    "tiers": [
      {
        "ending_quantity": 0,
        "currencies": [
          {
            "currency": null,
            "unit_amount": null,
            "unit_amount_decimal": null
          }
        ]
      }
    ],
    "tier_type": "string",
    "code": "string",
    "plan_id": "string",
    "id": "string",
    "percentage_tiers": [
      {
        "tiers": [
          {
            "ending_amount": null,
            "usage_percent": null
          }
        ],
        "currency": "string"
      }
    ],
    "usage_type": "string",
    "created_at": "string",
    "usage_calculation_type": "string",
    "updated_at": "string",
    "deleted_at": "string"
  },
  "add_ons": [
    {
      "name": "string",
      "currencies": [
        {
          "currency": "string",
          "unit_amount": null,
          "unit_amount_decimal": "string"
        }
      ],
      "usage_percentage": null,
      "add_on_type": "string",
      "external_sku": "string",
      "state": "string",
      "tiers": [
        {
          "ending_quantity": 0,
          "currencies": [
            {}
          ]
        }
      ],
      "tier_type": "string",
      "code": "string",
      "plan_id": "string",
      "id": "string",
      "percentage_tiers": [
        {
          "tiers": [
            {}
          ],
          "currency": "string"
        }
      ],
      "usage_type": "string",
      "created_at": "string",
      "usage_calculation_type": "string",
      "updated_at": "string",
      "deleted_at": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
plan RecurlyPlan false none none
add_on RecurlyPlanAddOn false none none
add_ons [RecurlyPlanAddOn] false none none

GovernanceRulesDocument

{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "_id": "string",
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "created_at": "2024-04-11T04:01:35.090Z",
  "app_id": "string",
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string",
  "org_id": "string"
}

Properties

Name Type Required Restrictions Description
name string true none none
priority integer(int32) false none none
model string false none none
state integer(int32) true none none
cohorts [object] false none none
_id string false none none
variables [GovernanceRulesVariables] false none none
applied_to string false none none
block boolean true none none
response RulesResponseItem false none none
applied_to_unidentified boolean false none none
regex_config [RegexRule] false none none
created_at string(date-time) true none none
app_id string true none none
plans [Plan] false none none
type string true none none
org_id string true none none

BillingPlan

{
  "provider_slug": "string",
  "friendly_name": "string",
  "params": {
    "usage_rounding_mode": "string",
    "webhook_params": {
      "reporting": {
        "report_when": [
          "string"
        ]
      },
      "channel_ids": [
        "string"
      ],
      "custom_plan": {
        "plan_id": "string"
      }
    },
    "recurly_params": {
      "plan": {
        "name": "string",
        "id": "string",
        "code": "string"
      },
      "add_on": {
        "name": "string",
        "currencies": [
          {}
        ],
        "usage_percentage": null,
        "add_on_type": "string",
        "external_sku": "string",
        "state": "string",
        "tiers": [
          {}
        ],
        "tier_type": "string",
        "code": "string",
        "plan_id": "string",
        "id": "string",
        "percentage_tiers": [
          {}
        ],
        "usage_type": "string",
        "created_at": "string",
        "usage_calculation_type": "string",
        "updated_at": "string",
        "deleted_at": "string"
      },
      "add_ons": [
        {
          "name": "string",
          "currencies": [
            null
          ],
          "usage_percentage": null,
          "add_on_type": "string",
          "external_sku": "string",
          "state": "string",
          "tiers": [
            null
          ],
          "tier_type": "string",
          "code": "string",
          "plan_id": "string",
          "id": "string",
          "percentage_tiers": [
            null
          ],
          "usage_type": "string",
          "created_at": "string",
          "usage_calculation_type": "string",
          "updated_at": "string",
          "deleted_at": "string"
        }
      ]
    },
    "chargebee_params": {
      "item_plan": {
        "name": "string",
        "item_family_id": "string",
        "description": "string",
        "usage_calculation": "string",
        "external_name": "string",
        "metered": true,
        "id": "string",
        "status": "string",
        "unit": "string",
        "updated_at": 0,
        "archived_at": 0
      },
      "item_price": {
        "name": "string",
        "item_id": "string",
        "description": "string",
        "price": 0,
        "price_in_decimal": "string",
        "external_name": "string",
        "tiers": [
          {}
        ],
        "trial_end_action": "string",
        "trial_period": 0,
        "id": "string",
        "status": "string",
        "pricing_model": "string",
        "created_at": 0,
        "period_unit": "string",
        "updated_at": 0,
        "trial_period_unit": "string",
        "item_type": "string",
        "currency_code": "string",
        "archived_at": 0,
        "free_quantity": 0,
        "period": 0
      },
      "item_prices": [
        {
          "name": "string",
          "item_id": "string",
          "description": "string",
          "price": 0,
          "price_in_decimal": "string",
          "external_name": "string",
          "tiers": [
            null
          ],
          "trial_end_action": "string",
          "trial_period": 0,
          "id": "string",
          "status": "string",
          "pricing_model": "string",
          "created_at": 0,
          "period_unit": "string",
          "updated_at": 0,
          "trial_period_unit": "string",
          "item_type": "string",
          "currency_code": "string",
          "archived_at": 0,
          "free_quantity": 0,
          "period": 0
        }
      ],
      "reporting": {
        "reporting_period": "string"
      }
    },
    "stripe_params": {
      "product": {
        "name": "string",
        "description": "string",
        "unit_label": "string",
        "id": "string",
        "usage_type": "string"
      },
      "price": {
        "tiers_mode": "string",
        "transform_quantity": {
          "divide_by": null,
          "round": null
        },
        "price_id": "string",
        "tiers": [
          {}
        ],
        "recurring": {
          "trial_period_days": null,
          "interval": null,
          "usage_type": null,
          "interval_count": null,
          "aggregate_usage": null
        },
        "unit_amount_decimal": "string",
        "price_nickname": "string",
        "currency": "string",
        "billing_scheme": "string",
        "unit_amount": 0,
        "created": 0,
        "active": true
      },
      "prices": [
        {
          "tiers_mode": "string",
          "transform_quantity": {},
          "price_id": "string",
          "tiers": [
            null
          ],
          "recurring": {},
          "unit_amount_decimal": "string",
          "price_nickname": "string",
          "currency": "string",
          "billing_scheme": "string",
          "unit_amount": 0,
          "created": 0,
          "active": true
        }
      ],
      "reporting": {
        "reporting_period": "string"
      }
    },
    "zuora_params": {
      "plan_id": "string",
      "price_id": "string",
      "price_ids": [
        "string"
      ]
    },
    "usage_multiplier": null
  }
}

Properties

Name Type Required Restrictions Description
provider_slug string true none none
friendly_name string false none none
params BillingParams false none none

SubmitData

{
  "body": {},
  "url": "string",
  "params": [
    {
      "key": "string",
      "val": "string"
    }
  ],
  "verb": "string",
  "headers": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
body object false none none
url string true none none
params [KeyValuePair] false none none
verb string true none none
headers [KeyValuePair] false none none

ProviderRequest

{
  "success": true,
  "status_code": 0,
  "job_id": "string",
  "error_message": "string",
  "error_code": "string",
  "request_time": "2024-04-11T04:01:35.090Z"
}

Properties

Name Type Required Restrictions Description
success boolean true none none
status_code integer(int32) true none none
job_id string true none none
error_message string true none none
error_code string true none none
request_time string(date-time) true none none

CommentItem

{
  "message": "string",
  "mentions": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
message string false none none
mentions [string] false none none

NotificationRule

{
  "send_on_addition": true,
  "send_on_removal": true,
  "period": "string",
  "fields": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
send_on_addition boolean true none none
send_on_removal boolean true none none
period string false none none
fields [string] false none none

TemplateItem

{
  "dynamic_fields": [
    "string"
  ],
  "dynamic_time": true
}

Properties

Name Type Required Restrictions Description
dynamic_fields [string] true none none
dynamic_time boolean false none none

Summary

{
  "count": 0,
  "latest_comment": {
    "auth_user_id": "string",
    "comment_id": "string",
    "mentions": [
      "string"
    ],
    "partner_user_id": "string",
    "message": "string",
    "created_at": "2024-04-11T04:01:35.090Z",
    "updated_at": "2024-04-11T04:01:35.090Z"
  }
}

Properties

Name Type Required Restrictions Description
count integer(int32) true none none
latest_comment CreateCommentItem false none none

GovernanceRuleUpdateItem

{
  "name": "string",
  "priority": 0,
  "model": "string",
  "state": 0,
  "cohorts": [
    {}
  ],
  "variables": [
    {
      "name": "string",
      "path": "string"
    }
  ],
  "applied_to": "string",
  "block": true,
  "response": {
    "status": 0,
    "headers": null,
    "body": {},
    "original_encoded_body": "string"
  },
  "applied_to_unidentified": true,
  "regex_config": [
    {
      "conditions": [
        {
          "path": "string",
          "value": "string"
        }
      ],
      "sample_rate": 0
    }
  ],
  "plans": [
    {
      "provider": "string",
      "plan_id": "string",
      "price_ids": [
        "string"
      ]
    }
  ],
  "type": "string"
}

Properties

Name Type Required Restrictions Description
name string false none none
priority integer(int32) false none none
model string false none none
state integer(int32) false none none
cohorts [object] false none none
variables [GovernanceRulesVariables] false none none
applied_to string false none none
block boolean false none none
response RulesResponseItem false none none
applied_to_unidentified boolean false none none
regex_config [RegexRule] false none none
plans [Plan] false none none
type string false none none

WorkspaceUpdateItem

{
  "name": "string",
  "colors": {},
  "drawings": [
    {
      "name": "string",
      "direction": "string",
      "id": "string",
      "type": "string",
      "value": 0.1
    }
  ],
  "chart": {
    "original_encoded_view_elements": "string",
    "funnel_query": {},
    "url_query": "string",
    "to": "string",
    "view_elements": {},
    "from": "string",
    "original_encoded_funnel_query": "string",
    "es_query": {},
    "args": "string",
    "original_encoded_query": "string",
    "time_zone": "string",
    "view": "string"
  },
  "template": {
    "dynamic_fields": [
      "string"
    ],
    "dynamic_time": true
  },
  "width": 0.1,
  "sort_order": 0.1,
  "policy": {
    "acl": [
      {
        "grantee": "string",
        "permission": "string"
      }
    ],
    "resource": {},
    "api_scopes": [
      "string"
    ],
    "original_encoded_resource": "string"
  }
}

Properties

Name Type Required Restrictions Description
name string false none none
colors object false none none
drawings [DrawingItem] false none none
chart ChartItem false none none
template TemplateItem false none none
width number(double) false none none
sort_order number(double) false none none
policy PolicyItem false none none

BillingWebhookParams

{
  "reporting": {
    "report_when": [
      "string"
    ]
  },
  "channel_ids": [
    "string"
  ],
  "custom_plan": {
    "plan_id": "string"
  }
}

Properties

Name Type Required Restrictions Description
reporting CustomReporting false none none
channel_ids [string] true none none
custom_plan CustomReportPlan true none none

searchUsersResponse

{
  "took": 11,
  "timed_out": false,
  "hits": {
    "total": 420,
    "hits": [
      {
        "_id": "123456",
        "_source": {
          "first_name": "[",
          "body": {},
          "name": "[",
          "email": "[",
          "first_seen_time": "[",
          "user_agent": {},
          "geo_ip": {},
          "modified_time": "[",
          "last_name": "[",
          "ip_address": "[",
          "session_token": [
            null
          ],
          "last_seen_time": "[",
          "app_id": "[",
          "org_id": "["
        },
        "sort": [
          1519768519464
        ]
      }
    ]
  }
}

Properties

Name Type Required Restrictions Description
took integer false none none
timed_out boolean false none none
hits object false none none
» total integer false none none
» hits [userResponse] false none none

Subscription

{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "app_id": "string",
  "subscription_id": "string",
  "version_id": "string",
  "type": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "org_id": "string",
  "created": "2024-04-11T04:01:35.090Z"
}

Properties

Name Type Required Restrictions Description
trial_start string(date-time) false none none
company_id string true none none
start_date string(date-time) false none none
collection_method string false none none
provider string false none none
items [SubscriptionItem] false none none
current_period_start string(date-time) false none none
company_external_id string false none none
payment_status string false none none
modified_time string(date-time) false none none
cancel_time string(date-time) false none none
status string true none none
trial_end string(date-time) false none none
external_id string false none none
metadata object false none none
app_id string true none none
subscription_id string true none none
version_id string false none none
type string true none none
current_period_end string(date-time) false none none
org_id string true none none
created string(date-time) false none none

searchEventsResponse

{
  "took": 358,
  "timed_out": false,
  "hits": {
    "total": 947,
    "hits": [
      {
        "_id": "AWF5M-FDTqLFD8l5y2f4",
        "_source": {
          "company_id": "[",
          "duration_ms": "[",
          "request": {},
          "user_id": "[",
          "company": {},
          "response": {},
          "id": "[",
          "event_type": "[",
          "session_token": "[",
          "metadata": {},
          "app_id": "[",
          "org_id": "[",
          "user": {}
        },
        "sort": [
          0
        ]
      }
    ]
  }
}

Properties

Name Type Required Restrictions Description
took integer false none none
timed_out boolean false none none
hits object false none none
» total integer false none none
» hits [eventResponse] false none none

searchcompanysResponse

{
  "took": 11,
  "timed_out": false,
  "hits": {
    "total": 420,
    "hits": []
  }
}

Properties

Name Type Required Restrictions Description
took integer false none none
timed_out boolean false none none
hits object false none none
» total integer false none none
» hits [companyResponse] false none none

UserUpdate

{
  "company_id": "string",
  "first_name": "string",
  "name": "string",
  "email": "string",
  "photo_url": "string",
  "user_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "last_name": "string",
  "metadata": {},
  "user_name": "string",
  "phone": "string"
}

Properties

Name Type Required Restrictions Description
company_id string false none none
first_name string false none none
name string false none none
email string false none none
photo_url string false none none
user_id string true none none
modified_time string(date-time) false none none
last_name string false none none
metadata object false none none
user_name string false none none
phone string false none none

SubscriptionItem

{
  "item_price_id": "string",
  "price_id": "string",
  "is_metered": true,
  "plan_id": "string",
  "unit_of_measure": "string",
  "status": "string",
  "subscription_item_id": "string"
}

Properties

Name Type Required Restrictions Description
item_price_id string false none none
price_id string false none none
is_metered boolean false none none
plan_id string true none none
unit_of_measure string false none none
status string false none none
subscription_item_id string false none none

userResponse

{
  "_id": "123456",
  "_source": {
    "first_name": "John",
    "body": {},
    "name": "John Doe",
    "email": "[email protected]",
    "first_seen_time": "2023-07-27T21:52:58.0990000Z",
    "user_agent": {
      "name": "Android",
      "os_major": "7",
      "os": "Android 7.0",
      "os_name": "Android",
      "os_minor": "0",
      "major": "7",
      "device": "Samsung SM-G955U",
      "minor": "0"
    },
    "geo_ip": {
      "ip": "107.200.85.196",
      "region_name": "South Carolina",
      "continent_code": "NA",
      "location": {
        "lon": -79.85489654541016,
        "lat": 32.822898864746094
      },
      "latitude": 32.822898864746094,
      "timezone": "America/New_York",
      "longitude": -79.85489654541016,
      "dma_code": 519,
      "postal_code": "29464",
      "region_code": "SC",
      "city_name": "Mt. Pleasant",
      "country_code2": "US",
      "country_code3": "US",
      "country_name": "United States"
    },
    "modified_time": "2023-07-27T21:55:19.464",
    "last_name": "Doe",
    "ip_address": "107.200.85.196",
    "session_token": [
      "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF"
    ],
    "last_seen_time": "2023-07-27T21:52:58.0990000Z",
    "app_id": "198:3",
    "org_id": "177:3"
  },
  "sort": [
    1519768519464
  ]
}

Properties

Name Type Required Restrictions Description
_id string false none none
_source object false none none
» first_name string false none none
» body object false none none
» name string false none none
» email string false none none
» first_seen_time string false none none
» user_agent object false none none
»» name string false none none
»» os_major string false none none
»» os string false none none
»» os_name string false none none
»» os_minor string false none none
»» major string false none none
»» device string false none none
»» minor string false none none
» geo_ip object false none none
»» ip string false none none
»» region_name string false none none
»» continent_code string false none none
»» location object false none none
»»» lon double false none none
»»» lat double false none none
»» latitude double false none none
»» timezone string false none none
»» longitude double false none none
»» dma_code integer false none none
»» postal_code string false none none
»» region_code string false none none
»» city_name string false none none
»» country_code2 string false none none
»» country_code3 string false none none
»» country_name string false none none
» modified_time string false none none
» last_name string false none none
» ip_address string false none none
» session_token [string] false none none
» last_seen_time string false none none
» app_id string false none none
» org_id string false none none
sort [integer] false none none

eventResponse

{
  "_id": "AWF5M-FDTqLFD8l5y2f4",
  "_source": {
    "company_id": "67890",
    "duration_ms": 76,
    "request": {
      "body": "json",
      "uri": "https://api.github.com",
      "user_agent": {
        "patch": "1",
        "major": "7",
        "minor": "1",
        "name": "PostmanRuntime"
      },
      "geo_ip": {
        "ip": "73.189.235.253",
        "region_name": "CA",
        "continent_code": "NA",
        "location": [
          "["
        ],
        "latitude": 37.769,
        "timezone": "America/Los_Angeles",
        "area_code": 415,
        "longitude": -122.393,
        "real_region_name": "California",
        "dma_code": 807,
        "postal_code": "94107",
        "city_name": "San Francisco",
        "country_code2": "US",
        "country_code3": "USA",
        "country_name": "United States"
      },
      "ip_address": "73.189.235.253",
      "verb": "GET",
      "route": "/",
      "time": "2023-07-09T06:14:58.550",
      "headers": {}
    },
    "user_id": "123454",
    "company": {},
    "response": {
      "body": {},
      "transfer_encoding": "json",
      "status": 200,
      "time": "2023-07-09T06:14:58.626",
      "headers": {}
    },
    "id": "AWF5M-FDTqLFD8l5y2f4",
    "event_type": "api_call",
    "session_token": "rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME",
    "metadata": {},
    "app_id": "198:3",
    "org_id": "177:3",
    "user": {}
  },
  "sort": [
    0
  ]
}

Properties

Name Type Required Restrictions Description
_id string false none none
_source object false none none
» company_id string false none none
» duration_ms integer false none none
» request object false none none
»» body object false none none
»» uri string false none none
»» user_agent object false none none
»»» patch string false none none
»»» major string false none none
»»» minor string false none none
»»» name string false none none
»» geo_ip object false none none
»»» ip string false none none
»»» region_name string false none none
»»» continent_code string false none none
»»» location [double] false none none
»»» latitude double false none none
»»» timezone string false none none
»»» area_code integer false none none
»»» longitude double false none none
»»» real_region_name string false none none
»»» dma_code integer false none none
»»» postal_code string false none none
»»» city_name string false none none
»»» country_code2 string false none none
»»» country_code3 string false none none
»»» country_name string false none none
»» ip_address string false none none
»» verb string false none none
»» route string false none none
»» time string false none none
»» headers object false none none
» user_id string false none none
» company object false none none
» response object false none none
»» body object false none none
»» transfer_encoding string false none none
»» status integer false none none
»» time string false none none
»» headers object false none none
» id string false none none
» event_type string false none none
» session_token string false none none
» metadata object false none none
» app_id string false none none
» org_id string false none none
» user object false none none
sort [integer] false none none

AddSubscription

{
  "trial_start": "2024-04-11T04:01:35.090Z",
  "company_id": "string",
  "start_date": "2024-04-11T04:01:35.090Z",
  "collection_method": "string",
  "provider": "string",
  "items": [
    {
      "item_price_id": "string",
      "price_id": "string",
      "is_metered": true,
      "plan_id": "string",
      "unit_of_measure": "string",
      "status": "string",
      "subscription_item_id": "string"
    }
  ],
  "current_period_start": "2024-04-11T04:01:35.090Z",
  "company_external_id": "string",
  "payment_status": "string",
  "cancel_time": "2024-04-11T04:01:35.090Z",
  "status": "string",
  "trial_end": "2024-04-11T04:01:35.090Z",
  "external_id": "string",
  "metadata": {},
  "subscription_id": "string",
  "version_id": "string",
  "current_period_end": "2024-04-11T04:01:35.090Z",
  "created": "2024-04-11T04:01:35.090Z"
}

Properties

Name Type Required Restrictions Description
trial_start string(date-time) false none none
company_id string true none none
start_date string(date-time) false none none
collection_method string false none none
provider string false none none
items [SubscriptionItem] false none none
current_period_start string(date-time) false none none
company_external_id string false none none
payment_status string false none none
cancel_time string(date-time) false none none
status string true none none
trial_end string(date-time) false none none
external_id string false none none
metadata object false none none
subscription_id string true none none
version_id string false none none
current_period_end string(date-time) false none none
created string(date-time) false none none

CompanyUpdate

{
  "company_id": "string",
  "modified_time": "2024-04-11T04:01:35.090Z",
  "session_token": "string",
  "company_domain": "string",
  "metadata": {}
}

Properties

Name Type Required Restrictions Description
company_id string true none none
modified_time string(date-time) false none none
session_token string false none none
company_domain string false none none
metadata object false none none