POST
/
v2
/
authentication
/
permissions
/
add
Add Permissions
curl --request POST \
  --url https://api.velt.dev/v2/authentication/permissions/add \
  --header 'Content-Type: application/json' \
  --header 'x-velt-api-key: <x-velt-api-key>' \
  --header 'x-velt-auth-token: <x-velt-auth-token>' \
  --data '{
  "data": {
    "user": {
      "userId": "<string>"
    },
    "permissions": {
      "resources": [
        {
          "type": "<string>",
          "id": "<string>",
          "organizationId": "<string>",
          "expiresAt": 123
        }
      ]
    }
  }
}'
{
  "result": {
    "status": "success",
    "message": "Permissions added successfully."
  }
}
Use this API to add permissions to a user for various resources like organizations, folders, documents, etc.
  • You can add permissions for multiple resources in a single API call.
  • The expiresAt field is optional. If provided, the permission will expire at the given timestamp.

Endpoint

POST https://api.velt.dev/v2/authentication/permissions/add

Headers

x-velt-api-key
string
required
Your API key.
x-velt-auth-token
string
required

Body

data
object
required

Example Request

Here is an example of the request body in JSON format.
{
  "data": {
    "user": {
      "userId": "some-user-id"
    },
    "permissions": {
      "resources": [
        {
          "type": "organization",
          "id": "YOUR_ORGANIZATION_ID"
        },
        {
          "type": "document",
          "id": "YOUR_DOCUMENT_ID",
          "organizationId": "YOUR_ORGANIZATION_ID",
          "expiresAt": 1728902400
        }
      ]
    }
  }
}

Response

Success Response

{
  "result": {
    "status": "success",
    "message": "Permissions added successfully."
  }
}

Failure Response

{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
{
  "result": {
    "status": "success",
    "message": "Permissions added successfully."
  }
}