# Elastic.co account and billing summary dashboard

**URL:** https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275
**Category:** Elasticsearch
**Created:** [August 3, 2021, 6:33am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275 "2021-08-03T06:33:06Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)
#### Post date: [August 3, 2021, 6:33am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/1 "2021-08-03T06:33:06Z")

</div>

Hi All,

I am using elastic. co to check account and billing information.  
Can I make a dashboard in kibana from [elastic.co](http://elastic.co) data present in account and billing info.  
Please let me know if there is a way around to extract billing data from [elastic.co](http://elastic.co) to kibana and build elastic,co cost analysis dashboard in kibana.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/7/77513eb6e2dd85b359223f4b2b46512478e6e815.png)

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [August 3, 2021, 10:35pm UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/2 "2021-08-03T22:35:54Z")

</div>

AFAIk there's no way to do this.

I would suggest contacting the Support team to make sure, and they might be able to pass this onto the product team as a feature request.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 4, 2021, 2:59am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/3 "2021-08-04T02:59:58Z")

</div>

@Divyank_Mahalle Thanks for using Elastic Cloud

Actually there is an Account Billing API Here

> **[Billing Costs Analysis | Elasticsearch Service Documentation | Elastic](https://www.elastic.co/guide/en/cloud/current/Billing_Costs_Analysis.html#Billing_Costs_Analysis)**

You will need to pull the data and the ingest it into your elasticsearch cluster ... yeah not so easy, I think at some point we will work on making this easier... but you can then do build a dashboard if you want.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [August 4, 2021, 3:05am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/4 "2021-08-04T03:05:14Z")

</div>

Oh that's awesome!

---

<div class="post-metadata">

### Author: ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)
#### Post date: [August 4, 2021, 6:53am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/5 "2021-08-04T06:53:32Z")

</div>

Thanks for the Solution.

For this below GET request, I got deployment id but was unable to find organization\_id in [elastic.co](http://elastic.co) id.

- Is organisation\_id and cluster\_ID are same?

- I generate API key using for Billing API in [elastic.co](http://elastic.co) feature tab.Can I used this API key to request billing data or there is different way?

```auto
GET /api/v1/billing/costs/{organization_id}/deployments/{deployment_id}/items

```

Once organiization ID is confirmed, here is Psuedo API request looks like-  
Is it correct?

```auto
curl -XGET https://api.elastic-cloud.com/api/v1/billing/costs/{< 
   >}/deployments/{< >}/items \
-H "Authorization: ApiKey <AKJSBEHXk13123ksdkwbeiabds>"

```

Sorry for asking the novice questions, as I am using it for first time.

Thank you once again!

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 4, 2021, 2:33pm UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/6 "2021-08-04T14:33:44Z")

</div>

@Divyank_Mahalle No Problem

The `organization_id` should be your account id on The Account and Billing Page

 ![Screen Shot 2021-08-04 at 7.20.27 AM](https://us1.discourse-cdn.com/elastic/original/3X/f/0/f0594888faf311de0842d9db71d28ffc397bf6f8.png)

With respect to the API Syntax Yes that looks correct (although there are several variations on the page I referenced) and you need to make sure you get the Deployment ID correct From the Deployments page you can either copy it from the URL or from the Copy Cluster ID link.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [August 5, 2021, 5:30am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/8 "2021-08-05T05:30:01Z")

</div>

I've deleted that last post, you probably don't want to be publicly posting your auth key.

---

<div class="post-metadata">

### Author: ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)
#### Post date: [August 5, 2021, 5:32am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/9 "2021-08-05T05:32:20Z")

</div>

Thanks, Got it both organization and deployment id.

I tried running API requests on the browser to check if it's fetching data, but it showing an error message.  
I guess I am missing something here.

> #{"errors":[{"code":"root.unauthenticated","message":"The resource requires authentication, which was not supplied with the request"}]}

Psuedo API request format-

```auto
https://api.elastic-cloud.com/api/v1/billing/costs/<org id>/deployments/<deployement id>/items \
-H "Authorization: ApiKey <API Key>"

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/e/be771620e657ef5ff1bcd94a5be3450b1e0e9dfc.png)

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 5, 2021, 5:38am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/10 "2021-08-05T05:38:33Z")

</div>

I ran mine directly as documented with `curl` and I got the results

Did you follow these instructions to get the proper API key?

> **[Authentication | Elasticsearch Service Documentation | Elastic](https://www.elastic.co/guide/en/cloud/current/ec-api-authentication.html)**

You should try with `curl` not in a browser.

---

<div class="post-metadata">

### Author: ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)
#### Post date: [August 9, 2021, 11:03am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/11 "2021-08-09T11:03:37Z")

</div>

> [@stephenb](#):
>
> Did you follow these instructions to get the proper API k

Yes, I follow the same procedure and generate API Key.

Still getting the same error while running the using curl command in the VM/linux.  
Please let me know where i am doing wrong.

```auto
$ curl -XGET https://api.elastic-cloud.com/api/v1/billing/costs/<org id> \ -H "Authorization: ApiKey $EC_<Api key>"
{"errors":[{"code":"root.unauthenticated","message":"The resource requires authentication, which was not supplied with the request"}]}curl: (6) Could not resolve host: -H; Unknown error
curl: (6) Could not resolve host: Authorization; Unknown error

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/d/2d03d75aff53c1fc5f3e37c099e7b01debe4b16c.png)

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 9, 2021, 12:59pm UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/12 "2021-08-09T12:59:44Z")

</div>

> [@Divyank\_Mahalle](#):
>
> `$EC_<Api key>`

Don't Prefix the API KEY with the `$EC_`

Just paste in directly.

```auto
curl -XGET https://api.elastic-cloud.com/api/v1/billing/costs/<organization_id> \
-H "Authorization: ApiKey <yourapikey>"

```

OR

if you use the syntax in the docs set this before

That is an example when using an environment variable.

`export EC_API_KEY=<yourapikey>`

then

```auto
curl -XGET https://api.elastic-cloud.com/api/v1/billing/costs/<organization_id> \
-H "Authorization: ApiKey $EC_API_KEY"

```

**Also if you put it on 1 line do not include `\`**

---

<div class="post-metadata">

### Author: ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)
#### Post date: [August 9, 2021, 2:33pm UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/13 "2021-08-09T14:33:39Z")

</div>

Thank you so much API is working and I am able to get output results.

I checked with "Get costs overview for the organization" and getting correct values for current values which are billed till today for the current month.

```auto
curl -XGET https://api.elastic-cloud.com/api/v1/billing/costs/<organization_id> \
-H "Authorization: ApiKey <yourapikey>"

{
  "costs" : {
    "total" : 55.5166,
    "resources" : 40.8226,
    "data_transfer_and_storage" : 14.694
  },
  "trials" : 0.0,
  "hourly_rate" : 0.1989,
  "balance" : {
    "available" : 0.0,
    "remaining" : 0.0,
    "line_items" : [
    ]
  }

```

While I checked for "Get itemized costs for the organization" its showing different values from [elastic.co](http://elastic.co) billing and showing values for 734 hours instead it showing calculate hours from 1 st aug till today.

Is it forecasting the values of resources for the next 20 days?

```auto
curl -XGET https://api.elastic-cloud.com/api/v1/billing/costs/{organization_id}/items 
-H "Authorization: ApiKey API_KEY"

{
  "costs" : {
    "total" : 160.76,
    "resources" : 146.0128,
    "data_transfer_and_storage" : 14.7472
  },
  "resources" : [
    {
      "hours" : 734,
      "instance_count" : 1,
      "period" : {
        "start" : "2021-08-01T00:00:00.000Z",
        "end" : "2021-08-31T14:06:06.783Z"
      },
      "kind" : "apm",
      "price" : 0.0,
      "price_per_hour" : 0.0,
      "name" : " <Name>" ",
      "sku" : "<Name>"
    },
    {
      "hours" : 734,
      "instance_count" : 1,
      "period" : {
        "start" : "2021-08-01T00:00:00.000Z",
        "end" : "2021-08-31T14:06:06.783Z"
      },
      "kind" : "elasticsearch",
      "price" : 132.1383,
      "price_per_hour" : 0.18,
      "name" : "<NAME>",
      "sku" : "<NAME>"
    },
    {
      "hours" : 734,
      "instance_count" : 1,
      "period" : {
        "start" : "2021-08-01T00:00:00.000Z",
        "end" : "2021-08-31T14:06:06.783Z"
      },
      "kind" : "elasticsearch",
      "price" : 13.8745,
      "price_per_hour" : 0.0189,
      "name" : "<NAME>",
      "sku" : "<NAME>"
    },
    {
      "hours" : 734,
      "instance_count" : 1,
      "period" : {
        "start" : "2021-08-01T00:00:00.000Z",
        "end" : "2021-08-31T14:06:06.783Z"
      },
      "kind" : "kibana",
      "price" : 0.0,
      "price_per_hour" : 0.0,
      "name" : "<NAME>",
      "sku" : "<NAME>"
    }
  ]

```

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 9, 2021, 2:59pm UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/14 "2021-08-09T14:59:53Z")

</div>

Yes if you look at the documentation [specifically here](https://www.elastic.co/guide/en/cloud/current/Billing_Costs_Analysis.html#ec_query_parameters_3)

#### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | `string` | N | A datetime for the beginning of the desired range for which to fetch costs. **Defaults to start of current month.** Note: there is currently a three-month maximum date range. |
| `to` | `string` | N | A datetime for the end of the desired range for which to fetch costs. **Defaults to end of current month.** Note: there is currently a three-month maximum date range. |

I am a little curious why the end date is not 23:59.59 on Aug 31 (I am asking internally)

Remember this is still experimental meaning this is new and can change.  
I would also recommend reading the docs closely.

---

<div class="post-metadata">

### Author: ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)
#### Post date: [August 10, 2021, 8:08am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/15 "2021-08-10T08:08:01Z")

</div>

I got your point and referring Billing API documentation,

Now I am testing billing API for "Get costs to overview for the organization"

Config file and Output attached. Getting error of Invalid URL or root unauthenticated.  
Although I search for HTTP poller authentication, got this link, but didn't get much idea how to process it in URL.

[https://discuss.elastic.co/t/http-poller-authentication-encode-token/143532](https://discuss.elastic.co/t/http-poller-authentication-encode-token/143532)

This config setting is just for testing purpose-

```auto
input{
http_poller {
        type => "billing"
        urls => {
          url => "https://api.elastic-cloud.com/api/v1/billing/costs/<orgid>-HAuthorization:ApiKey<my api key>"
        }
        request_timeout => 60
        schedule => { every => "5s"}
        codec => "json"
    }

}
output {
    stdout {
        codec => rubydebug
    }
    #elasticsearch {
        #host ip to be changed to new test system
        # hosts => ["<hostaname>"]
       #index => "<Billing>"
   # user => "<username>"
      # password => "<password>"
   #}

}

```

Output

```auto
-bash-4.2$ sudo bin/logstash -f /etc/logstash/conf.d/billing1.conf
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in ve rsion 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules (fil e:/usr/share/logstash/logstash-core/lib/jars/jruby-complete-9.2.11.1.jar) to met hod sun.nio.ch.NativeThread.signal(long)
WARNING: Please consider reporting this to the maintainers of com.headius.backpo rt9.modules.Modules
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflect ive access operations
WARNING: All illegal access operations will be denied in a future release
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/conf ig or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.pr operties. Using default config which logs errors to the console
[WARN] 2021-08-10 07:49:26.800 [LogStash::Runner] multilocal - Ignoring the 'pi pelines.yml' file because modules or command line options are specified
[INFO] 2021-08-10 07:49:26.828 [LogStash::Runner] runner - Starting Logstash {" logstash.version"=>"7.8.0", "jruby.version"=>"jruby 9.2.11.1 (2.5.7) 2020-03-25 b1f55b1a40 OpenJDK 64-Bit Server VM 11.0.12+7-LTS on 11.0.12+7-LTS +indy +jit [l inux-x86_64]"}
[INFO] 2021-08-10 07:49:35.000 [Converge PipelineAction::Create<main>] Reflections - Reflections took 328 ms to scan 1 urls, producing 21 keys and 41 values
[INFO] 2021-08-10 07:49:37.791 [[main]-pipeline-manager] javapipeline - Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>500, "pipeline.sources"=>["/etc/logstash/conf.d/billing1.conf"], :thread=>"#<Thread:0x54177e5c run>"}
[INFO] 2021-08-10 07:49:41.357 [[main]-pipeline-manager] http_poller - Registering http_poller Input {:type=>"billing", :schedule=>{"every"=>"5s"}, :timeout=>nil}
[INFO] 2021-08-10 07:49:41.459 [[main]-pipeline-manager] javapipeline - Pipeline started {"pipeline.id"=>"main"}
[INFO] 2021-08-10 07:49:41.769 [Agent thread] agent - Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[INFO] 2021-08-10 07:49:43.077 [Api Webserver] agent - Successfully started Logstash API endpoint {:port=>9600}
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/awesome_print-1.7.0/lib/awesome_print/formatters/base_formatter.rb:31: warning: constant ::Fixnum is deprecated
{
          "type" => "billing",
      "@version" => "1",
    "@timestamp" => 2021-08-10T07:49:51.423Z,
        "errors" => [
        [0] {
            "message" => "The resource requires authentication, which was not supplied with the request",
               "code" => "root.unauthenticated"
        }
    ]
}

```

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 10, 2021, 2:30pm UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/16 "2021-08-10T14:30:25Z")

</div>

You should open a separate thread since you now have a Logstash question.

Per the docs [here](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-http_poller.html#_example) the first example shows how to use headers

```auto
test2 => {
        # Supports all options supported by ruby's Manticore HTTP client
        method => get
        user => "AzureDiamond"
        password => "hunter2"
        url => "http://localhost:9200/_cluster/health"
        headers => {
          Accept => "application/json"
        }
     }

```

---

<div class="post-metadata">

### Author: ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)
#### Post date: [August 11, 2021, 12:41pm UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/17 "2021-08-11T12:41:05Z")

</div>

Sure @stephenb ,Thank you so much for addressing my queries.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 4, 2022, 8:31am UTC](https://discuss.elastic.co/t/elastic-co-account-and-billing-summary-dashboard/280275/19 "2022-11-04T08:31:41Z")

</div>


