Facing error while creating a virtual account

Hello. I have been trying to create a virtual account. I have been following How to create a virtual calendar

Command:

curl --location --request POST 'https://api.nylas.com/connect/authorize' \
    --data-raw '{
    "client_id": "I am using client id of my sandbox application",
    "provider": "nylas",
    "scopes": "calendar",
    "email": "health-provider-01@nubrix.io",
    "name": "Virtual Calendar for health provider 01",
    "settings": {}
    }'

Error:

{"message": "Please provide a valid client_id. The client_id URL parameter should be the Client ID of your application in the Nylas Dashboard.", "type": "auth_error", "error": "Invalid application."}

Client ID Screenshot:


I have been using the hidden client id

1 Like

Hi @krutd33 thanks for the message, just to clarify the video is using our Nylas API v2, which is not our latest API.

If you are looking for more relevant code samples, take a look at this section of our docs that goes over how to create a virtual calendar in Nylas API v3.

PS - The dashboard image shared, Client ID Screenshot is for our Nylas API v3.

Also, more relevant on the same page, we share how to create a virtual account as well!

I’m following this link: create a virtual account

I’m confused actually, in the documentation first call is done to authenticate virtual account. But I don’t have any virtual account to authenticate. I want to know how to create virtual account. But still I went forward with executing the first api and I’m receiving error.

API:

curl --location 'https://api.us.nylas.com/v3/connectors' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY_OR_ACCESS_TOKEN>' \
  --data '{
    "provider": "virtual-calendar",
    "name": "nylas"
}'   

Error:
{"request_id":"a9e9be3a-e88c-4d68-ba48-4cac35552e54","error":{"type":"api.invalid_request_error","message":"Could not verify access credential"}}

I tried with api key starting with nyk as well as api key visible in the api keys section of the application in the dashboard.

Hi @krutd33 - let me take a look at your message shortly, will circle back soon!

1 Like

@krutd33 Just breaking down the steps so we can ensure everything is working, I’m going to try this in our postman collection as well:

Step 1) We need to create a Connector (so we need a connector setup very similar to a Google or Microsoft), so that’s the first call to:
https://api.us.nylas.com/v3/connectors

This will let us create virtual calendars. We are still at this step based on your message.

Step 2) Next we need to create an actual user account, so a virtual user account, so the call will be do:
https://api.us.nylas.com/v3/connect/custom

Step 3) By creating a virtual user account, we should receive a grant_id that we can use to create virtual calendars, using this call:
https://api.us.nylas.com/v3/grants/:grant_id/calendars


So let’s go back to Step 1, let me try this out via postman, and I was able to create one using the following cURL command shared by postman:

curl --location 'https://api.us.nylas.com/v3/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <NYLAS_API_KEY>' \
--data '{
  "provider": "virtual-calendar",
  "name": "nylas"
}'

The response was as follows:

{
    "request_id": "<REQUEST_ID>",
    "data": {
        "provider": "virtual-calendar"
    }
}

So one question for Step 1, for Authorization are you removing the keyword Bearer? We need to include Bearer so the Authorization should include: Bearer and the <NYLAS_API_KEY> (so the value nyk... taken from the API Keys on the v3 dashboard)

Another useful call I like to try to test things are working before re-trying creating a virtual connector is just grabbing the application details:

curl --location 'https://api.us.nylas.com/v3/applications' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <NYLAS_API_KEY>'

Hi @ram .

  1. I’m not removing Bearer for the Authorization header.
  2. https://api.us.nylas.com/v3/applications is also returning error for me: {"request_id":"30cc346a-7378-4c6c-9545-0bb67718714e","error":{"type":"api.invalid_request_error","message":"Could not verify access credential"}}

I’m posting the exact cURL call which I’m making. I’ll remove some characters from my token for security.

curl --location 'https://api.us.nylas.com/v3/applications' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer nyk_v0_VfC0vyRJTM4IH'

PS: I’m 100% sure of using the correct token. I had created the token just before making this api call.

1 Like

@krutd33 sorry this is still an issue, let me revisit this again to see what else we could try.

Let me see if I can reproduce this using a setup more similar to yours (fresh account setup) to see if there is a limitation I am not seeing.

@krutd33 Take a look at our pricing plans, I see that a virtual account is not part of the sandbox environment.

Actually, it’s confirmed in our docs that virtual calendar is not available in the sandbox environment.

Hi @ram.

The issue is resolved. The problem was actually very silly one. The api calls which i was making were api.us.nylas… But my sandbox application was in EU. So i had to use api.eu.nylas and it worked.

However, The main requirement which I have is to setup scheduler using virtual account. Will you be able to provide me some information for ETA of scheduler V3?

1 Like

Hi @krutd33 glad to hear that you were able to get past Step 1!

We are working to release Scheduler V3 soon, and I do not have an ETA, so I can post an announcement in the forums when Scheduler V3 is available :slight_smile: