Developer quickstart

1. Obtaining your API Keys

All requests to the Morta API must be authenticated using an API key that is tied to your user account.

Your API key will also carry a set of permissions attached to it, this will allow you to define which Morta resources the key will have access to.

To issue a new API key, head over to Profile -> Settings and click on the "New API Key" button. This will display a form where you can attach a name to the key and restrict the key to specific resources. When you click "Generate API Key" a new key will be created for your account.

It is important that you save the key somewhere, and you should not share it with anyone.

2. Making your first request

To ensure that your API key works, the best way is to make a test request to the Morta API. For example, you can get your user information by issuing a request to v1/user/me

import requests

api_key = "YourApiKey"
headers = {
  "Authorization": f"Bearer {api_key}"
}
response = requests.get("https://api.morta.io/v1/user/me", headers=headers)

The response should contain infomation about the user that is tied to the API key.

{
  "data": {
    "apiKeys": [
      {
        "hash": "c85ddfafac74565e7dc5a2d4b54456fa5445aeb88e8cd9d492d2f2be3125cc31",
        "ipAddresses": [],
        "name": "Generated Key",
        "prefix": "e3e3",
        "publicId": "61338a7b-51dd-4d6c-912f-2d8ce427db45",
        "scope": []
      }
    ],
    "bio": null,
    "constructionSoftware": [],
    "email": "s**j@morta.io",
    "firebaseUserId": "ymSMW86x6HScISFxErcLaG7EwxF3",
    "linkedin": null,
    "name": "Test User",
    "phone": null,
    "profilePicture": "https://firebasestorage.googleapis.com/v0/b/morta-new-live.appspot.com/o/userPublic%2FymSMW86x6HScISFxErcLaG7EwxF3%2F8ea8ecd5-6664-4e0b-ad8c-89aa46e80ce4.png?alt=media&token=768b78ab-2297-4be6-a1f6-dd5ec4d672f4",
    "projectsWorkedOn": [],
    "publicId": "ada5f52e-fc21-489f-9062-b6b98a73cb44",
    "signature": null,
    "specialisms": [],
    "stripeId": "cus_HkVmiamfYMYluH",
    "twitter": null,
    "university": "Bristol University",
    "universityDegree": null
  },
  "metadata": {}
}