How to pull monthly-exports (monthly cashflows)?

Submitted to the email - but posting here for everyone!

Looking for how to get a monthly export id so I can query my econ runs. Also - this returns per well - forcing me to roll up myself. I will post my code (Python) when I finish so everyone can get the rolled-up copy.

Thanks!

1 Like

Hey @michael.tanner , welcome to the forum.

Yeah, this part is not so obvious:

  1. You have to trigger the export with a POST monthly-exports.
    It will return an ID:
{
  "id": "7a0b236e-4a46-414d-bdf5-08de1d8adff7"
}
  1. You can use that ID to GET monthly-exports

However notice that in the returned record results will be empty until status becomes completed.

1 Like

Ahhh! That makes sense. So technically that is like clicking “run economics” in the UI - makes sense. Do I need to work about request limit?

This would be different than running economics in the UI. To get here you’ll need an “econ-run” ID beforehand, which is created after you run economics. This is more about making the data that you are interested in available to iterate via the API endpoint.

The general limits in the documentation apply to everything including these endpoints. Other than that the only limit would be the maximum number of records you can retrieve in a single request.

Note that this is a paginated endpoint, which means to fetch all the results you have to either:

  • Use the C# idiomatic iteration over the response (when using our C# client library)
  • Parse the Link response header which contains the URL to fetch the next page
  • Pass skip and take parameters manually

Hmmm ok Python/Node.js guy (working this solution with Python Client for now, might be switching).

Here is my code - getting a 404 Error on the urlone (which is https://api.combocurve.com/v1/projects/61a92c8f34254c0013cacf3e/scenarios/61a93338b763c20015f3f68f/econ-runs/61a9394934254c0013cbc73e)

What am I missing - comboname? Thanks as always.

auth_headers = combocurve_auth.get_auth_headers()
# URl econid
url = "https://api.combocurve.com/v1/projects/61a92c8f34254c0013cacf3e/scenarios/61a93338b763c20015f3f68f/econ-runs"

# URL get monthly production
# url = 'https://api.combocurve.com/v1/monthly-productions?skip=0&take=25'
response = requests.request("GET", url, headers=auth_headers)

jsonStr = response.text
dataObjBetter = json.loads(jsonStr)
row = dataObjBetter[0]
econId = row["id"]

auth_headers = combocurve_auth.get_auth_headers()
urlone = (
    "https://api.combocurve.com/v1/projects/61a92c8f34254c0013cacf3e/scenarios/61a93338b763c20015f3f68f/econ-runs/"
    + econId
)

response = requests.request("POST", urlone, headers=auth_headers)```

Hey @michael.tanner, the logic is correct, but you are getting a 404 because there is a slug missing in the POST monthly-exports url. Need to add /monthly-exports after the econ run id.

urlone = (
    "https://api.combocurve.com/v1/projects/61a92c8f34254c0013cacf3e/scenarios/61a93338b763c20015f3f68f/econ-runs/"
    + econId
    + "/monthly-exports"
)

Thanks! That is the elegant way of saying it - just need to read your docs more closely!!

now a 200 code

Ok so now here is the next question. Why is the below code return a 404. I have a variable econRunId that works great…thanks!

auth_headers = combocurve_auth.get_auth_headers()
urltwo = (
    "https://api.combocurve.com/v1/projects/61a92c8f34254c0013cacf3e/scenarios/61a93338b763c20015f3f68f/econ-runs/"
    + econId
    + "/monthly-exports"
    + econRunId
    + "?skip=0"
)

response = requests.request("GET", urltwo, headers=auth_headers)
jsonStr = response.text

@michael.tanner Nice hear you got 200. The last GET request is returning 404 because there is a missing / after monthly-exports

urltwo = (
    "https://api.combocurve.com/v1/projects/61a92c8f34254c0013cacf3e/scenarios/61a93338b763c20015f3f68f/econ-runs/"
    + econId
    + "/monthly-exports/"
    + econRunId
    + "?skip=0"
)

Easy - thanks! Response is now 200

Another question here then…this code works - but printing returns all 0 values - and I know that scercio is has a econ run - looking at my dev account now.

Wondering what the issue is? The date is 10-01-2021 which throws me off - I got access Dec 1 to the API…

# Call Stack - Get Econ Id

auth_headers = combocurve_auth.get_auth_headers()
# URl econid
url = "https://api.combocurve.com/v1/projects/61a92c8f34254c0013cacf3e/scenarios/61a93338b763c20015f3f68f/econ-runs"

# URL get monthly production
# url = 'https://api.combocurve.com/v1/monthly-productions?skip=0&take=25'
response = requests.request("GET", url, headers=auth_headers)

jsonStr = response.text
dataObjBetter = json.loads(jsonStr)
row = dataObjBetter[0]
econId = row["id"]

print(econId)

auth_headers = combocurve_auth.get_auth_headers()
urlone = (
    "https://api.combocurve.com/v1/projects/61a92c8f34254c0013cacf3e/scenarios/61a93338b763c20015f3f68f/econ-runs/"
    + econId
    + "/monthly-exports"
)

response = requests.request("POST", urlone, headers=auth_headers)

jsonStr = response.text
dataObjEconRunId = json.loads(jsonStr)
row = dataObjEconRunId
econRunId = row["id"]

auth_headers = combocurve_auth.get_auth_headers()
urltwo = (
    "https://api.combocurve.com/v1/projects/61a92c8f34254c0013cacf3e/scenarios/61a93338b763c20015f3f68f/econ-runs/"
    + econId
    + "/monthly-exports/"
    + econRunId
    + "?skip=0"
)

response = requests.request("GET", urltwo, headers=auth_headers)
jsonStr = response.text
print(jsonStr)

print(econRunId)

Wait…its actually working! I had the dates messed up - holla!!!

Next step is working on rolling this up into a single Res Monthly Cash Flow vs. Monthly Cash Flow.

1 Like

We were trying to figure what the problem could be, but awesome! Let us know if you run into any other issues.

Your team rocks - can’t say that enough. Yes, adjusted the dates and CAPEX to match and I am seeing the data, I had -120 FPD for CAPEX which was throwing me off.

Another question - so I want to eventually roll up these well monthly into res - I have 1 test well for 5 years future forecast with a length of 285536 (len(jsonStr) in the above code)

That seems wildly high - will I run into computing issues when I add more wells? We have 130 wells in our 2022 forecast that I will want to eventually add and loop through each well.

Thanks for the compliment!

So if I understand correctly, you are looking into rolling up by reserves category ?
Which would be the equivalent to the data you get when you download these files in the ComboCurve UI:

If that’s the case, we do calculate and store that when you run economics, but it’s not exposed in the REST API yet.

Let me know if that’s what you need and we can open a new post to track this as a feature request :slight_smile:

1 Like

Exactly - Reserves Category Monthly Cash Flow. I can loop through but just worried about compute time/local storage of 130 well monthly cash flow looping through 8-10 of the econ run outputs running into issues but ill see here shortly

Makes sense - yes I will add a feature request!!

1 Like

was a solution put in place to pull the same monthly cashflow csv export via the api?