Import the Postman collection

Import the Samva email API into Postman from the OpenAPI spec and authenticate your requests with an API key.

Import the Samva API into Postman to test and explore the email endpoints from a request client. Postman builds the collection from the published OpenAPI spec, so it always reflects the current API.

Import the collection

Postman can build a collection directly from the OpenAPI spec.

  1. Open Postman.
  2. Click Import in the top left.
  3. Select the Link tab.
  4. Enter https://api.samva.app/v1/openapi.json.
  5. Click Continue, then Import.

Authenticate the collection

Set your API key once at the collection level so every request inherits it.

  1. Click the collection name in the sidebar.
  2. Go to the Variables tab.
  3. Add a variable named apiKey and set its value to your API key.
  4. Click Save.

Then configure the collection's authorization:

  1. Go to the Authorization tab.
  2. Select API Key as the type.
  3. Set Key to x-api-key.
  4. Set Value to {{apiKey}}.
  5. Set Add to to Header.

Requests authenticate with the x-api-key header. See API keys for details on creating and scoping keys.

Set up environments

Use Postman environments to switch between production and staging without editing requests.

// Production
{
  "baseUrl": "https://api.samva.app/v1",
  "apiKey": "samva_sk_live_your_api_key"
}
// Staging
{
  "baseUrl": "https://staging.api.samva.app/v1",
  "apiKey": "samva_sk_test_your_api_key"
}

Send a test request

  1. Open the request for POST /v1/messages.

  2. Set the body to an email send payload:

    {
      "to": [{ "email": "ada@example.com" }],
      "channel": "email",
      "email": {
        "subject": "Welcome to Samva",
        "html": "<h1>Welcome!</h1>"
      }
    }
  3. Click Send and check the response.

Next steps

On this page