With an API key, your own systems, scripts or integration partners can read and write data in Moment through Moment's REST API. Each key belongs to one user in Moment and has that user's permissions.
Before you start
Turn on API Access. Go to Setup → Settings → Integrations, click + Create integration and choose API Access (API tilgang).
- Tick Enabled.
- Choose who should be notified about the integration.
- Save.
Price. Access to the API has a monthly cost. Normal use is included. Very many requests or very large amounts of data can be invoiced extra. See Cost below.
Choose the right user. A key gets exactly the same access as the user it is created for. We recommend this:
- Use a dedicated user for the API, for example api@yourcompany.no, not a personal user who might leave the company. If the user is no longer employed, the key stops working.
- The user must be active and licensed in Moment.
- Give the user only the access it needs. The key works in every company the user has access to, including companies where the user is an external user.
Create an API key
- Go to Company → API keys (Firma → API-nøkler). This page is only shown when API Access is enabled, and you need administrator access.
- Click + Create key (+ Opprett nøkkel).
- Fill in:
| Field (EN / NB) | Description |
|---|---|
| Resource / Ressurs | The user the key belongs to. Only current employees are listed. |
| Environment / Miljø | Choose Production or All. The Sandbox environment is no longer available. |
| Test | Creates a test key that expires after 14 days. The expiry date is set automatically and can't be changed. |
| Expiry date / Utløpsdato | The last date the key can be used. It must be in the future. |
- Click Generate (Generer).
- Copy the key right away and store it somewhere safe, such as a password manager. Moment shows: "Note! Copy and save this API key, it cannot be retrieved again." If you lose the key, create a new one.
Notification. The recipients chosen in the API Access integration get an e-mail every time a key is created, changed or deleted.
Manage your keys
The list under Company → API keys shows each key's:
- Resource
- Environment
- whether it is a Test key
- Expiry date
Change the expiry date. Click the pencil icon. Test keys can't be changed.
Delete a key. Click the bin icon and confirm with "Are you sure you want to remove this API key?". The key is removed from the list.
If a key may have been exposed, for example sent by e-mail or published by mistake, contact Moment support right away.
When a key expires, Moment rejects it with 401 Unauthorized. Change the expiry date, or create a new key, before it runs out.
Use the API key
Authentication
Moment's API uses Basic authentication:
| Value | |
|---|---|
| Username | apikey |
| Password | (your actual API key) |
In practice, every request gets this header:
Authorization: Basic <base64 of "apikey:YOUR_API_KEY">
Most tools do this for you. In Postman, for example, choose Authorization → Type: Basic Auth, enter apikey as Username, and the key as Password.
URL
https://app.moment.team/api/1.0/companies/{COMPANYCODE}/{ENDPOINT}{COMPANYCODE}is your company code, which you find in the URL when you are logged in to Moment.{ENDPOINT}is the data you want, for examplecustomers,projectsortimeRecords.
Example: list all customers.
GET https://app.moment.team/api/1.0/companies/{COMPANYCODE}/customersExample with curl:
curl -u apikey:YOUR_API_KEY https://app.moment.team/api/1.0/companies/YOURCOMPANY/customers
API documentation
The endpoints are documented in Swagger at https://app.moment.team/api/1.0/docs/.
Standard operations. All data types follow the same pattern:
| Action | Request |
|---|---|
| Create | POST / |
| Read one | GET /{id} |
| Read a list | GET / |
| Update | PUT or PATCH /{id} |
| Delete | DELETE /{id} |
| Several at once, in one transaction | POST /batch |
Responses and errors
| Response | Meaning |
|---|---|
| 200 | OK |
| 401 Unauthorized | The key is wrong, expired or deleted, or the username isn't apikey. |
| 403 Forbidden | The key works, but its user has no access to this company or this data. Check the user's permissions in Moment. |
| 429 Too Many Requests | Too many requests in a short time. Wait and try again. |
Changes can take a few minutes. A new key, a changed expiry date or a deleted key can take up to 5 minutes to take effect.
Limits
- Rate limit: 120 requests per second per IP address, and 30 requests per second per key. Above this, the API answers 429.
- Large lists: some lists return a limited number of records. The response then contains
limitWasExceeded. AddnoLimit=trueto get more, up to a maximum of 30,000 records. If you need more than that, narrow your filter.
Tip: find the right request
The easiest way to find the request for some data is to open the report in Moment that shows that data. Then look in your browser's Developer tools, under Network → Fetch/XHR, at which API URL the page calls. Use the same URL and parameters with your API key.
Webhooks and the API
If you want to know when something changes in Moment, combine the API with webhooks. A webhook sends a short message with the ID of what changed, and you fetch the full data with the API key. See Webhooks.
Import key (Moment Importer)
Under Setup → Settings → Import key (Importnøkkel) you find a different kind of key. It isn't an API key for everyday use:
| API key | Import key | |
|---|---|---|
| Purpose | Integrations and your own systems | The first import of data with Moment Importer |
| Access | The chosen user's permissions | Full administrator access to the company |
| Validity | Until the expiry date you choose | 2 days |
| Requires API Access | Yes | No |
Only use the import key when Moment support asks you to.
Cost
From Moment's price terms.
- Monthly fee. API access has a monthly fee.
- Number of keys included. You can create as many API keys as you have licensed users. Extra keys are invoiced according to the price list.
- Test keys aren't invoiced, up to three per user. Additional test keys are invoiced as ordinary keys.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article