Skip to main content
Contributor II
September 2, 2023
Solved

API patch action "status"=>403, "code"=>"permission_denied"

  • September 2, 2023
  • 6 replies
  • 403 views

I am trying to update field of one of my profiles and I am constantly getting:
klaviyo.profile_update('someprofileid')
=> {"errors"=>[{"id"=>"9a6ddf10-414f-4d4e-b455-d743396d97a1", "status"=>403, "code"=>"permission_denied", "title"=>"You do not have permission to perform this action.", "detail"=>"You do not have permission to perform this action.", "source"=>{"pointer"=>"/data/"}}]}

Using classic code sample in ruby:
ย 

module Klaviyo

class Api

API_URL = 'https://a.klaviyo.com/api/'

HEADERS = {

'Accept' => 'application/json',

'Content-Type' => 'application/json',

'Revision' => '2023-08-15'

}

ย 

def initialize

@api_key = ENV['KLAVIYO_KEY']

end

ย 

def call_api(http_method, endpoint, payload = nil)

url = URI("#{API_URL}#{endpoint}")

http = Net::HTTP.new(url.host, url.port)

http.use_ssl = true

ย 

headers = HEADERS.merge('Authorization' => "Klaviyo-API-Key #{@api_key}")

request = http_method.new(url, headers)

request.body = payload.to_json if payload

ย 

response = http.request(request)

JSON.parse(response.read_body) if response.read_body.present?

end

    This topic has been closed for replies.
    Best answer by Brian Turcotte

    Hi @zire!
    ย 

    My apologies for the delay here! Can you confirm that the API keyย youโ€™re using in these calls has fullย scope permissions?

    ย 

    If thatโ€™s not the issue, may I ask if youโ€™ve used this same key and authorization header to make other API calls successfully?

    ย 

    Best,

    Brian

    6 replies

    Brian Turcotte
    Klaviyo Alum
    September 6, 2023

    Hi @zire!

    Iโ€™m going to check on this with Engineering and Iโ€™ll update the thread ASAP!

    ย 

    Best,

    Brian

    Contributor I
    September 6, 2023

    Same!ย Can't get anything through with postman.

    Brian Turcotte
    Klaviyo Alum
    September 24, 2023

    Hi @zire!
    ย 

    My apologies for the delay here! Can you confirm that the API keyย youโ€™re using in these calls has fullย scope permissions?

    ย 

    If thatโ€™s not the issue, may I ask if youโ€™ve used this same key and authorization header to make other API calls successfully?

    ย 

    Best,

    Brian

    Contributor I
    January 5, 2024

    bump

    Contributor I
    January 5, 2024

    I am getting the same issue, however there is no solution in this solved thread. API keys have full access, tried both manually selecting all custom ones and giving full access.

    ย 

    Brian Turcotte
    Klaviyo Alum
    January 23, 2024

    Hi @ollie!

    This should be fixed now - are you still experiencing the issue?

    ย 

    Best,

    Brian