API Keys

We use API keys to authenticate requests. You can view and manage your API keys through the vivenu Dashboard or via the API.

The API Key Object

Required attributes

  • Name
    _id
    Type
    string
    Description

    The ID of the API key.

  • Name
    name
    Type
    string
    Description

    An internal name to identify the API key.

  • Name
    key
    Type
    string
    Description

    The secret key to be used to authenticate against the API.

  • Name
    createdAt
    Type
    string
    Description

    An ISO Timestamp indicating when the API Key was created.

  • Name
    updatedAt
    Type
    string
    Description

    An ISO Timestamp indicating when the API Key was last updated.

Optional attributes

  • Name
    active
    Type
    boolean
    Description

    Whether the API key can be used to authenticate against the API.

  • Name
    sellerId
    Type
    string
    Description

    The ID of the seller that owns the API key.

  • Name
    orgId
    Type
    string
    Description

    The ID of the organisation that owns the API key.

  • Name
    createdBy
    Type
    object
    Description

    The entity that created the API key.

    Required nested attributes (2)
    • Name
      type
      Type
      enum(USER, APP, API_KEY, SYSTEM)
      Description

      The type of the entity

    • Name
      id
      Type
      string
      Description

      The ID of the entity

  • Name
    expiresAt
    Type
    string
    Description

    Optional ISO instant after which the key no longer authenticates; omit or null for no automatic expiry.

Example

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "key": "key_somerandomcombinationofnumbersandletters",
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z",
  "active": true,
  "sellerId": "507f191e810c19729de860ea",
  "orgId": "507f191e810c19729de860ea",
  "createdBy": {
    "type": "USER",
    "id": "507f191e810c19729de860ea"
  },
  "expiresAt": "2030-01-23T23:00:00.123Z"
}

POST/api/keys/default

Get or Create a Default API Key

Get or Create a Default API Key

Payload

Required attributes

  • Name
    sellerId
    Type
    string
    Description

    The seller ID to get or create the API key for.

Request

POST
/api/keys/default
const response = await fetch('https://vivenu.com/api/keys/default', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "sellerId": "507f191e810c19729de860ea"
  }),
})

const data = await response.json()

Response (200)

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "key": "key_somerandomcombinationofnumbersandletters",
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z",
  "active": true,
  "sellerId": "507f191e810c19729de860ea",
  "orgId": "507f191e810c19729de860ea",
  "createdBy": {
    "type": "USER",
    "id": "507f191e810c19729de860ea"
  },
  "expiresAt": "2030-01-23T23:00:00.123Z"
}

Was this page helpful?